Coding Conventions for the Output Writing Routine

In order for your output writing routine to work in the external writer, it must observe the following conventions:
  • If you put your routine in LPA so that you only use one copy for all external writers, then it must be reentrant. If you use a STEPLIB and each writer can have its own copy, then the code need not be reentrant.
  • The routine must use standard entry and exit linkage, saving and restoring its caller's registers.

    At entry, register 1 points to the parameter list and register 13 points to an 18-word save area.

  • The routine must issue an OPEN-J macro to open the desired input data set. The data set to which the output writing routine will write records is opened before the routine is loaded.
  • The routine must use the GETMAIN and FREEMAIN macros, or the STORAGE macro, to acquire and release any necessary storage.
  • The routine must return control to its caller through the RETURN macro, in the same addressing mode it was called in. It must put a return code in register 15:
    • A return code of 0 indicates that the data set was processed successfully to the output device.
    • A return code of 8 indicates that the routine was unable to process the data set because of an output error.