• Subject: RE: OPNQRYF question: how to build format without mapping each field
  • From: Buck Calabro <mcalabro@xxxxxxxxxxxx>
  • Date: Tue, 30 Nov 1999 14:07:41 -0500

Joel,

>I use OPNQRYF to make one file format look like another.  
>If the input file format has 10 fields, and the output format 
>has 50 fields, must I map the 40 missing fields and load 
>each with a constant?

If the problem you're solving is to "make one file format look like another
with OPNQRYF" then the answer is yes.  You need to "pad" the output format
with mapped fields.  This would mean that the program doesn't use the
"missing" 40 fields from the emulating format.

If you're doing this to avoid a level check because you don't want to write
two programs to process similar data, then you have several other options
open to you.  1) Create a logical file which uses only the 10 fields that
are common to the two files.  Re-compile the program to use that logical,
and you'll only be dealing with those 10 fields and won't have to pad the
additional 40.  2) Consider an intermediate file approach, where you write a
simple CPYF *MAP *DROP from either input file to a "common 10 field" output
file.  Read the common file in your main processing program.  3) Code both
files in your program and use a parameter to open the appropriate file.  Set
the parameter in the same CL that does the OPNQRYF.

>Does SQL handle this better??? 

Yes - SQL does not use the concept of record format, so you won't be bogged
down with having to twist OPNQRYF's arm just to avoid getting a level check.
In either case, you'll be selecting only the 10 fields that the program
actually needs to process.

Buck Calabro
+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---

This thread ...


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

This mailing list archive is Copyright 1997-2019 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].