ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Multiple files in a CL program

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Multiple files in a CL program

    I am attempting to add a 2nd file to a CLLE program that already had one file in it and compiled successfully until I attempted to add a 2nd file. I have declared the 2nd file as folllows:
    Code:
     DCLF       FILE(PRTLSTL1) RCDFMT(*ALL) OPNID(FILE01)
    When I reference any of the fields from this file in my program I get Variable X is referred to but not declared. I am reading records from the file with this:
    Code:
    RCVF       OPNID(FILE01)
    The file I have added has record format name the same as the file name, so I don't know if that has anything to do with it (that is another story that I won't go into). Any ideas what I doing wrong.

  • #2
    I should mention that original file that was (and still is) in the program is a DSPF and not a PF, I just noticed that

    Comment


    • #3
      When you reference the fields for a file that you have defined with an open ID, you have to prefix the field names with the open ID, for example FIELD1 would be referenced as &FILE01_FIELD1.

      Comment


      • #4
        Something new every day! I was wondering whether the limit of 11 characters for a CL field name would make this feature difficult to use, but it looks like the opnid names can have a length up to 22 counting the & and _. I was able to get a field name of &file123456_custname12.

        Cool!

        Comment

        Working...
        X