Create a logical file from a “simple” physical file

20 pts.
Tags:
AS 400
AS/400 logical file
AS/400 physical file
I have the following physical file: File Name . . . . . TCHE4067 Record Name . . TCHE4067 
Field Name. . . . .TCHE4067
How you can see this PF has only 1 field named the same as PF and also the same as the Record. I do not know how it was created, but I have to create a logical file from this physical file.
Currently I try to create one, but send error CPD7956 "Select or omit field specified incorrectly."
I have reviewed in several ways (WRKQRY, DSPFD and LSTFFD) the Record name.
My code is this:
R TCHE4067                  PFILE(TCHE4067)      
                                                 
  VAL05CHKP          I      SST(TCHE4067 1 6)    
1

Answer Wiki

Thanks. We'll let you know when a new response is added.

Simply put, a logical cannot be based on a flat file. You have to change the flat file to a proper Physical file.

With the file, record and field name all being the same it sounds like it may be a work file. Check to see when the file was last updated. If it’s been a while, try and find what created it. Make this a file using source code and separate names. A work around would be to create a new file and logical and copy that data into this file and use the new file.

Discuss This Question: 7  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • TheRealRaven
    Did you try the recovery options for the CPD7956 error message? What happened for them?
    32,320 pointsBadges:
    report
  • Splat
    Why the 'I' in (I assume) the field type?
    12,825 pointsBadges:
    report
  • GregManzo
    @Splat: This allows you to create a new field in the LF based on part of a field in the PF. In this case VAL05CHKP is a substring of the first 6 bytes of TCHE4067. I've also used it to create a field as upper(Name) to create a LF by name ignoring case.
    2,905 pointsBadges:
    report
  • mmanley
    CPD7956 says the "Select or omit field specified incorrectly".... "The select of omit fields must be specified after all of the key fields..." My first guess is that you don't have any key fields specified.
    470 pointsBadges:
    report
  • Splat
    @GregManzo, I've not done that in so long I'd forgotten.
    12,825 pointsBadges:
    report
  • ToddN2000
    Do you need to chain to this file by key or just read in a specific order? If you just need to read it, I would use embedded SQL to sort and select the records you need.
    125,530 pointsBadges:
    report
  • TheRealRaven
    Have you gotten anywhere? Did you add a 'K'ey specification? Note that a key of '*NONE' is a valid spec. This is used as a placeholder to satisfy the requirement of a 'K' line before any select/omit.
    32,320 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: