Thanks Buck!  Looks scary, but I'll give it a try.

>>> Buck.Calabro@commsoft.net 03/14/02 03:24PM >>>
Ted Barry wrote:

>I've never had to deal with this one
>until now...  Is it possible to select
>and/or even update a file with multiple
>record formats?

Maybe.  If you have packed numbers to update it gets harder - you'd probably
have to write your own UDFs.  Anyway, treat the record as a giant character
string and "select" based on a substring.  If your header records all have a
"1" in column 123 then you can select the headers with

select * from flatfile where substr(flatfile, 123, 1) = '1'

You update the same way.  Let's say you need to change that "1" to a "A"

update flatfile set flatfile = substr(flatfile,1,122)
       concat "A" concat substr(flatfile,124,length_of_rest_of_record)
       where substr(flatfile,123,1)='1'

Conceptually, you're building an entire new flat record composed of the
first part of the record concatenated with the changed columns concatenated
with the last part of the record.

I only do this in extreme cases, like being on a system without a compiler.
  --buck
_______________________________________________
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@midrange.com
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/cgi-bin/listinfo/midrange-l
or email: MIDRANGE-L-request@midrange.com
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.




As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.