Previous Topic: Coding an Assembler Output Module


Coding a PL/I Output Module

The following example writes an 80-byte record.

Output Module

 PLIPROG:PROC(BUF,ARG1,ARG2,ARG3,ARG4,ARG5,ARG6,ARG7,ARG8);
 DCL (BUF, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7, ARG8) FIXED(1);
 DCL REC CHAR(80) BASED(P1);
 DCL FLAG CHAR(1) BASED(P3);
 DCL (P1, P2, P3, P4, P5, P6, P7, P8) POINTER;
 DCL ADDR BUILTIN;
 DCL SW1 CHAR(1) INITIAL(' ');  /* HEX 00*/;
 DCL SW2 CHAR(1) INITIAL(' ');  /* HEX FF*/;
 P1 = ADDR(BUF);
 P3 = ADDR(ARG2);
 IF FLAG = SW2 THEN DO;
   FLAG=SW1;
   END;
 IF FLAG = SW1 THEN DO;
   PUT EDIT (REC) (COLUMN(2),A(80));
   GO TO GO_BACK;
   END;
 EOF:/* ALL OUTPUT WRITTEN */;
 GO_BACK:RETURN;
 END PLIPROG;