|
I need to create an access path to an existing file using the firsttry this - not very elegent, but it works. - The trick is you have to map the field back into a field that exists in the record format of the file you are querying. - problem is, I think the progam that accesses it will see xxxx00 in that field.
(left-most) four positions of a numeric field as the key. I thought
this could be done via MAPFLD and KEYFLD in an OPNQRYF - but I'm not
having any luck. The CL compiles OK but execution fails with "Key field
*MAPFLD/FLDNAM not valid for record format". The meaning of this
message is not clear to me -and I can't find an appropriate reference
manual (online or elsewhere). Any ideas?
OPNQRYF FILE((file))
+
KEYFLD((*MAPFLD/filefld)) +
MAPFLD((QX '1/FGDATE' *CHAR 6) +
(QA '%SST(QX 1 4)' *CHAR 4) +
(QB '00' *CHAR 2)
+
(filefld 'QA || QB'))
another option would be to create a file that looks just like the original, except you've added an new field (4 numeric).
OPNQRYF FILE((oldfile)) FORMAT((newfile)) +
KEYFLD((*MAPFLD/newfld)) +
MAPFLD((QX '1/oldfld' *CHAR 6) +
(QA '%SST(QX 1 4)' *CHAR 4) +
(newfld 'QA'))
Hope this helps,
rick@work.tired
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.