× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: Re: OPNQRYF
  • From: rbbaird@xxxxxxxxxxx (Rick Baird)
  • Date: Sun, 14 Sep 1997 20:03:07 -0500
  • Organization: Premium Systems, Inc.

saskia wrote:
I need to create an access path to an existing file using the first
(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?
try 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. 

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 thread ...

Replies:

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.