Previous Topic: How Information Is PassedNext Topic: Coding an Assembler Input Module


Coding a COBOL Input Module

How to Implement SELECT/BYPASS Logic

CA supplies a COBOL subroutine (CULLCBSL) to select input records for processing. When SELECT/BYPASS parameters are entered in CA Culprit code for any run that calls the input module, the CA routines must be called from the module to implement the selection logic.

To implement SELECT/BYPASS logic:

Example

This is an example of a COBOL input module that reads an 80-byte record.

Input Module

 IDENTIFICATION DIVISION.
 PROGRAM-ID. CULLUS98.
 INSTALLATION. COMPUTER ASSOCIATES
 DATE-WRITTEN. MONTH YYYY.
 REMARKS. THIS IS A TEST OF A COBOL USER INPUT MODULE
          FOR A CULPRIT JOB.
 ENVIRONMENT DIVISION.
 CONFIGURATION SECTION.
 SOURCE-COMPUTER. IBM-370.
 OBJECT-COMPUTER. IBM-370.
 INPUT-OUTPUT SECTION.
 FILE-CONTROL.
     SELECT INPUT-FILE ASSIGN TO UT-S-SYS010.
*CHANGE FILE ASSIGNMENT FOR VSE/ESA TO: SYS010-UT-S.
 
DATA DIVISION.
 FILE SECTION.
 FD  INPUT-FILE
     RECORDING MODE IS F
     LABEL RECORDS ARE STANDARD
     RECORD CONTAINS 80 CHARACTERS
     BLOCK CONTAINS 0 RECORDS
     DATA RECORD IS RECORD-IN.
 01  RECORD-IN               PIC X(80).
 WORKING-STORAGE SECTION.
 77  SEL-BYP-SW              PIC X.
 77  CLOSE-STATUS            PIC X  VALUE ' '.
 77  OPEN-STATUS             PIC X  VALUE ' '.
*   CLOSE-STATUS = HEX 'FF'  OPEN-STATUS = HEX '00'
 LINKAGE SECTION.
 01  CULARG-INPUT            PIC X(80).
 01  CULARG-2                PIC X.
 01  CULARG-SW               PIC X.
 01  CULARG-3                PIC XX.
 01  CULARG-4   COMP         PIC 99.
 01  CULARG-5   COMP         PIC 99.
 01  CULARG-6                PIC X(8).
 01  CULARG-7                PIC X.
 01  CULARG-8                PIC X.
 
 PROCEDURE DIVISION USING CULARG-INPUT
                          CULARG-2
                          CULARG-SW
                          CULARG-3
                          CULARG-4
                          CULARG-5
                          CULARG-6
                          CULARG-7
                          CULARG-8.
0010-CONTROL.
    MOVE ' ' TO SEL-BYP-SW.
    IF CULARG-SW = CLOSE-STATUS
        PERFORM 0020-OPEN THRU 0020-EXIT
    ELSE
        IF CULARG-SW = OPEN-STATUS
            PERFORM 0030-READ THRU 0030-EXIT
                UNTIL SEL-BYP-SW = 'Y'
        ELSE
            PERFORM 0040-CLOSE THRU 0040-EXIT.
    GOBACK.
0020-OPEN.
    OPEN INPUT INPUT-FILE.
    MOVE OPEN-STATUS TO CULARG-SW.
    PERFORM 0030-READ THRU 0030-EXIT
        UNTIL SEL-BYP-SW = 'Y'.
0020-EXIT.
    EXIT.
0030-READ.
    READ INPUT-FILE INTO CULARG-INPUT
        AT END PERFORM 0040-CLOSE THRU 0040-EXIT
               MOVE CLOSE-STATUS TO CULARG-SW
               MOVE 'Y' TO SEL-BYP-SW
               GO TO 0030-EXIT.
   MOVE 'Y' TO SEL-BYP-SW.
   CALL 'CULLCBSL' USING CULARG-INPUT
                         SEL-SYP-SW.
0030-EXIT.
    EXIT.
0040-CLOSE.
    CLOSE INPUT-FILE.
0040-EXIT.
    EXIT.