Previous Topic: Coding an Assembler Input ModuleNext Topic: How to Write Procedure Modules


Coding a PL/I Input Module

How to Implement SELECT/BYPASS Logic

Because the PL/I environment is different from CA Culprit (that is, Assembler), SELECT/BYPASS logic must be done with the SELECT/BYPASS BUFFER statement within the CA Culprit program.

Example

This is an example of a PL/I input module input that reads an 80-byte record.

Input 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*/;
 DCL SYS010 FILE INPUT RECORD;
 ON ENDFILE(SYS010) GO TO EOF;
 P1 = ADDR(BUF);
 P3 = ADDR(ARG2);
 IF FLAG = SW2 THEN DO;
   FLAG=SW1;
   OPEN FILE(SYS010);
   END;
 IF FLAG = SW1 THEN DO;
   READ FILE(SYS010) INTO (REC);
   GO TO GO_BACK;
   END;
 EOF:CLOSE FILE(SYS010);
   FLAG=SW2;
 GO_BACK:RETURN;
 END PLIPROG;