Previous Topic: Coding a COBOL Input ModuleNext Topic: Coding a PL/I Input Module


Coding an Assembler Input Module

How to Implement SELECT/BYPASS Logic

SELECT/BYPASS logic can be implemented in an Assembler input module by using the CA-supplied CULSINIT and CULSLCT macros in the source library from the install. CULSINIT establishes an environment that allows CA Culprit SELECT/BYPASS logic to function. CULSLCT implements the CA Culprit SELECT/BYPASS logic.

To implement SELECT/BYPASS logic:

  1. Code CULSINIT immediately after the initial register and save area housekeeping functions in the input module source code.
  2. Code CULSLCT in the input module logic.

    Register 1 points to the input record to which SELECT/BYPASS logic is applied. Use these two positional operands:

Example

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

Input Module

  CULLUS95 CSECT
  R0       EQU   0
  R1       EQU   1
  R2       EQU   2
  R3       EQU   3
  R4       EQU   4
  R5       EQU   5
  R6       EQU   6
  R7       EQU   7
  R8       EQU   8
  R9       EQU   9
  R10      EQU   10
  R11      EQU   11
  R12      EQU   12
  
  R13      EQU   13
  R14      EQU   14
           STM   14,12,12(13)        SAVE CALLER'S REGISTERS
           BALR  R3,0                ESTABLISH BASE REGISTER
           USING *,R3
           ST    R13,SAVEAREA+4
           LA    R13,SAVEAREA
           ST    13,SAVEAREA+8
           CULSINIT                  ESTABLISHES CULPRIT ENVIRONMENT
*                                    FOR SELECT/BYPSS CALLS
           L     R4,0(R1)            R4 POINTS TO INPUT BUFFER
           L     R5,8(R1)            R5 POINTS TO OPEN/CLOSE SW
           CLI   0(R5),X'FF'         IS FILE CLOSED?
           BE    OPEN                YES
           CLI   0(R5),X'00'         IS FILE OPEN?
           BE    READ                YES
           B     CLOSE
  
  RETURN   EQU    *
           L     R13,SAVEAREA+4      RESTORE REGISTERS
           LM    R14,R12,12(R13)
           BR    R14
  SAVEAREA DS    18F                 SAVE REGISTER AREA
  OPEN     EQU   *
           OPEN  (INPUTFI,INPUT)     OPEN INPUT FILE
           MVI   0(R5),X'00'         SET OPEN/CLOSE SW TO OPEN
  READ     EQU   *
           GET   INPUTFI             GET FIRST RECORD
           MVC   0(80,R4),0(R1)      MOVE FIRST RECORD INTO BUFFER
           CULSLCT RETURN,READ       SEL/BYP MACRO
           B     RETURN
  EOF      EQU   *
           MVI   0(R5),X'FF'         SET OPEN/CLOSE SW TO CLOSE
  CLOSE    EQU   *
           CLOSE INPUTFI             CLOSE INPUT FILE
           B     RETURN
  INPUTFI  DCB   DSORG=PS,MACRF=GL,DDNAME=SYS010,EODAD=EOF    CHANGE FOR VSE/ESA
           END   CULLUS95