Sharing data in recursive programs

If your program has the RECURSIVE attribute, data that is defined in the LINKAGE SECTION is not accessible on subsequent invocations of the program.

About this task

To address a record in the LINKAGE SECTION, use either of these techniques:

  • Pass an argument to the program and specify the record in an appropriate position in the USING phrase in the program.
  • Use the format-5 SET statement.

If your program has the RECURSIVE attribute, the address of the record is valid for a particular instance of the program invocation. The address of the record in another execution instance of the same program must be reestablished for that execution instance. Unpredictable results will occur if you refer to a data item for which the address has not been established.

Related tasks  
Making recursive calls

Related references  
  
SET statement (COBOL for Linux® on x86 Language Reference)