ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Chaining to a subfile with RRN

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

  • Chaining to a subfile with RRN

    I want to chain to a subfile with the relative record number. But I am getting this compile error:

    Click image for larger version

Name:	image.png
Views:	87
Size:	4.2 KB
ID:	159038

    The expanded help text says that the 2nd parm of the chain has to be a file name. If so, how does the program know which subfile to retrieve the record from. The program has 3 sfiles

    note: I can't use READC in this application without a lot of logic change.​

  • #2
    I realize that it;is the %found operation that doesn't like the record format name not the chain operation. Guess I should just avoid seeing if the chain was successful

    Comment


    • #3
      %FOUND requires a file name, not a record format name.

      Comment


      • #4
        Just pass the file name instead of the record format name and it'll work fine. No need to change the logic.

        Comment


        • #5
          Or just omit the file name parameter, it is optional. From the RPG manual:

          If %FOUND is used without the optional file_name parameter, then it returns the value set for the most
          recent relevant operation. When a file_name is specified, then it applies to the most recent relevant
          operation on that file.​

          Comment

          Working...
          X