WRITE ROUTINE

Override the COBOL WRITE statement and execute your own routine.
Restriction: This topic applies only when the AppMaster Builder AddPack has been installed, and applies only to Windows platforms.

Syntax:

WRITE ROUTINE [IS] paragraphname

Parameters:

Paragraph-name Name of WRITE ROUTINE paragraph

Comments:

  • If you code WRITE ROUTINE, you can define your report record as a group-level record in the File Section and reference it in your WRITE ROUTINE paragraph.
  • AMB generates a single-field 01-level report record when you code REPORT IS in the FD statement. You can replace REPORT IS with a definition of a group-level record--that is, an 01-level record with elementary data items. AMB generates a 248-byte 01-level report record in Working-Storage, for the largest possible report; it generates a 250-byte record if the RED keyword CODE clause is coded.
  • If FDs are not included in your program, as when accessing GSAM files, you can still create a WRITE routine by defining an 01-level user file record. Report Writer uses this record to generate an 01-level report file record in Working-Storage that stores the report records.

Examples:

FD    INPUT-FILE
       LABEL RECORDS ARE STANDARD
       BLOCK CONTAINS 0 RECORDS.
 01    PART-STOCK-REC                 PIC X(80).
 FD    REPORT-OUTPUT-FILE
       LABEL RECORDS ARE STANDARD
 01    USER-REPORT-RECORD.
       03  USER-REPORT-APS-PART       PIC X(248).
       03  USER-REPORT-USER-PART      PIC X(7).
          .
          .
 RED   STOCK-REPORT
          .
          .
       WRITE ROUTINE IS USER-DEFINED-PARA
          .
          .
 NTRY
          .
          .
 PARA  USER-DEFINED-PARA
          .
          .
       MOVE STOCK REPORT RECORD TO 
       ...USER-REPORT-APS-PART