         TITLE 'SAMPLE ITPUIOX - USER CONTROLLED FILE I/O EXIT'
**********************************************************************
*                                                                    *
* WORKLOAD SIMULATOR, VERSION 1, RELEASE 1                           *
*                                                                    *
*                                                                    *
* COPYRIGHT:     LICENSED MATERIALS - PROPERTY OF IBM                *
*                                                                    *
*                'RESTRICTED MATERIALS OF IBM'                       *
*                                                                    *
*                5655-I39                                            *
*                                                                    *
*                COPYRIGHT IBM CORP. 2012                            *
*                                                                    *
*                US GOVERNMENT USERS RESTRICTED RIGHTS -             *
*                USE, DUPLICATION OR DISCLOSURE RESTRICTED BY        *
*                GSA ADP SCHEDULE CONTRACT WITH IBM CORP.            *
*                                                                    *
**********************************************************************
*                                                                    *
* THIS ROUTINE IS A SAMPLE USER FILE I/O EXIT. IT RECEIVES DATA      *
* FROM A SCRIPT AND PROCESSES THE FILE REQUESTS TO EITHER OPEN,      *
* CLOSE, READ OR WRITE A FILE.                                       *
*                                                                    *
* TO USE THIS EXIT A USER WILL NEED TO CODE THE APPROPRIATE PROGRAM  *
* CODE TO PROCESS THE ABOVE FILE REQUESTS.                           *
*                                                                    *
* INPUT:                                                             *
*                                                                    *
*        DATA SUPPLIED BY WSIM. IT WILL CONTAIN A FILE REQUEST CODE, *
*        RETURN CODE SAVE AREA AND SOMETIMES A DATA SAVE AREA.       *
*                                                                    *
* OUTPUT:                                                            *
*                                                                    *
*        DATA AND RETURN CODE SAVE AREAS WILL BE UPDATED WITH THE    *
*        APPROPRIATE INFORMATION                                     *
*                                                                    *
* IMPORTANT FIELDS USED                                              *
*                                                                    *
*    THE FOLLOWING FIELDS ARE USED FOR THE EXIT INTERFACE ROUTINE.   *
*    DETAILS ON THIS EXIT CAN BE FOUND IN THE USER EXIT GUIDE.       *
*                                                                    *
*    PLIST    - A LIST OF PARAMETERS PASSED TO THE EXIT INTERFACE    *
*               ROUTINE TO GET INFORMATION FROM WSIM.                *
*    REQCODE  - A 1 BYTE FIELD USED TO CONTROL WHAT INTERACTION IS   *
*               CARRIED OUT WITH WSIM.                               *
*    SAPARMS  - THE RESULT AREA CONTAINING ADDRESSES THAT POINT TO   *
*               A DATA SAVE AREA, THE LENGTH OF DATA IN IT AND THE   *
*               LENGTH OF THE DATA SAVE AREA ITSELF.                 *
*    SAADDR1  - ADDRESS OF SAVE AREA                                 *
*    SAADDR2  - ADDRESS OF 2 BYTE FIELD CONTAINING THE LENGTH OF     *
*               THE DATA                                             *
*    SAADDR3  - ADDRESS OF 2 BYTE FIELD CONTAINING THE LENGTH OF     *
*               THE DATA SAVE AREA                                   *
*                                                                    *
* REGISTER USAGE:                                                    *
*                                                                    *
*    R0  - UNUSED                                                    *
*    R1  - LENGTH VALUE FOR COPYING PARAMETERS VIA EX OPCODE         *
*    R2  - POINTER TO VALID POSITION IN STORAGE AREA.                *
*    R3  - ADDRESS OF USER SUPPLIED PARAMETERS                       *
*    R4  - USED IN EXECUTES TO POINT TO SUPPLIED PARMS FOR COPYING   *
*    R5  - CONTAINS THE RETURN ADDRESS FROM EXITIR                   *
*    R6  - SAVE AREA ID CONVERSION, POINTER TO EXIT INTERFACE        *
*          ROUTINE ADDRESS AND TO LOAD DUMMY DEV CB                  *
*    R7  - LENGTH VALUE FOR SAVE AREA ID/RECORD COPY VIA EX OPCODE   *
*          ALSO USED TO TMEPORARILY HOLD RETURN CODE ON EXIT         *
*    R8  - UNUSED                                                    *
*    R9  - UNUSED                                                    *
*    R10 - UNUSED                                                    *
*    R11 - UNUSED                                                    *
*    R12 - BASE REGISTER FOR THIS PROGRAM                            *
*    R13 - CURRENT SAVE AREA POINTER                                 *
*    R14 - RETURN ADDRESS REGISTER FOR CALL TO EXIT INTERFACE        *
*          ROUTINE                                                   *
*    R15 - RETURN CODE HOLDER AND POINTER TO EXIT INTERFACE ROUTINE  *
*                                                                    *
**********************************************************************
ITPUIOX AMODE 31
ITPUIOX RMODE 24
ITPUIOX CSECT
         STM   R14,R12,12(R13)       SAVE CALLER'S REGISTERS
         LR    R12,R15               ESTABLISH BASE REGISTER
         USING ITPUIOX,R12           ESTABLISH ADDRESSABILITY
         ST    R13,SAVEAREA+4
         LA    R14,SAVEAREA
         ST    R14,8(,R13)
         LR    R13,R14               LINKAGE
         LR    R3,R1                 SAVE PARAMETER LIST ADDRESS
**********************************************************************
*                                                                    *
* EXTRACT SUPPLIED PARAMETERS                                        *
*                                                                    *
* THERE CAN BE BETWEEN 2 AND 3 PARAMETERS DEPENDING ON THE WORK TO   *
* BE CARRIED OUT. THE FIRST PARAMETER IS THE FILE REQUEST TO BE DONE *
* IN RELATION TO THE DATASET - OPEN, CLOSE, READ OR WRITE. THE NEXT  *
* PARAMETER IS THE ID OF THE RETURN CODE SAVE AREA THIS CAN EITHER   *
* BE PREFIXED WITH DC FOR A DEVICE COUNTER OR NC FOR A NETWORK       *
* COUNTER. THE LAST PARAMETER IS A DATA SAVE AREA TO PASS            *
* INFORMATION TO AND FROM THIS PROGRAM                               *
*                                                                    *
**********************************************************************
*
* INIT PARAMETER SAVE AREAS TO STOP CARRY OVER FROM PRIOR REQUESTS
*
         MVC   SAREQST,BLANKVAL      CLEAR FILE REQUEST FIELD
         MVC   SARC,BLANKVAL         CLEAR RETURN CODE ID FIELD
         MVC   SADATAID,ZEROVAL      CLEAR SAVE AREA DATA ID FIELD
*
* EXTRACT FILE REQUEST VALUE
*
         L     R1,0(R1)              GET ADDRESS OF USER PARAMETERS
         LH    R7,0(R1)              LOAD LENGTH OF USER PARAMETERS
         LA    R4,2(R1)              POINT TO START POSITION IN PARM
         EX    R7,TRTEXEC            SEARCH FOR BLANK IN PARM
         SR    R1,R4                 CALCULATE LENGTH TO MOVE
         BNM   EXTACTRQ              BLANK FOUND THEN USE CALC LENGTH
         LR    R1,R7                 LAST PARM SO USE PARM LENGTH
EXTACTRQ DC    0H
         BCTR  R1,0                  SET LENGTH FOR MOVE
         EX    R1,COPYFREQ           SAVE FIRST PARAMETER FIELD
         LA    R1,2(R1)              COMPENSATE FOR BLANK
         SR    R7,R1                 DECREMENT LENGTH FIELD
         BM    PROCFRQ               IF CALCULATED LENGTH GT THAN EOP
         BZ    PROCFRQ               OR ZERO THEN GO TO PROCESS REQUEST
*
* EXTRACT RETURN CODE SAVE AREA ID
*
         AR    R4,R1                 SET NEXT START POSITION
         EX    R7,TRTEXEC            SEARCH FOR BLANK IN PARM
         SR    R1,R4                 CALCULATE LENGTH TO MOVE
         BNM   EXTRCTRC              BLANK FOUND THEN USE CALC LENGTH
         LR    R1,R7                 LAST PARM SO USE PARM LENGTH
EXTRCTRC DC    0H
         BCTR  R1,0                  SET LENGTH FOR MOVE
         EX    R1,COPYRCID           SAVE SECOND PARAMETER FIELD
         LA    R1,2(R1)              COMPENSATE FOR BLANK
         SR    R7,R1                 DECREMENT LENGTH FIELD
         BM    PROCFRQ               IF CALCULATED LENGTH GT THAN EOP
         BZ    PROCFRQ               OR ZERO THEN GO TO PROCESS REQUEST
*
* EXTRACT DATA SAVE AREA ID
*
         AR    R4,R1                 SET NEXT START POSITION
         BCTR  R7,0                  DECREMENT LENGTH
         LA    R2,SADATAID+2         POINT TO END OF DATA ID FIELD
         SR    R2,R7                 OFFSET TO ALLOW FOR PARM LENGTH
         EX    R7,COPYSAID           SAVE LAST PARAMETER FIELD
*
* GET DATA SAVE AREA ADDRESS
*
         CLC   SADATAID,DATAIDMX     IS SAVE AREA ID GT 255?
         BH    RETURN6               YES, THEN EXIT WITH A RC 6
         CLC   SADATAID,DATAIDMN     IS SAVE AREA ID LT 1?
         BL    RETURN6               YES, THEN EXIT WITH A RC 6
         MVC   REQCODE,REQDSA        SET REQUEST CODE FOR DATA SA
         BAL   R5,EXITIR             BRANCH TO EXIT INTERFACE CALL
         LTR   R15,R15               VALID RESULTS RETURNED?
         BNZ   RETURN                NO, THEN EXIT
*
* PROCESS FILE REQUEST AFTER CONFIRMING REQUIRED PARAMETER FIELDS EXIST
*
PROCFRQ  DC    0H
         CLC   SAREQST,BLANKVAL      IS THE FILE REQUEST FIELD EMPTY?
         BE    RETURN7               YES, THEN EXIT WITH RC OF 7
         CLC   SARC,BLANKVAL         IS THE RETURN CODE SA MISSING?
         BE    RETURN7               YES, THEN EXIT WITH RC OF 7
*
* CLOSE ONLY NEEDS THE FILE REQUEST AND A SAVE AREA TO OUTPUT A RETURN
* CODE TO. IF THE ADDITIONAL DATA SAVE AREA IS REQUIRED THEN MOVE THE
* ACTCLOSE TEST AFTER THE ZEROVAL TEST BLEOW.
*
         CLC   SAREQST(5),ACTCLOSE   IF A CLOSE REQUEST THEN
         BE    CLOSEDS                  BRANCH TO CLOSE ROUTINE
         CLC   SADATAID,ZEROVAL      IS THE DATA SAVE AREA MISSING?
         BE    RETURN7               YES, THEN EXIT WITH RC OF 7
*
* THE REMAINING FILE REQUESTS NEED ALL OF THE PARMS TO BE PRESENT.
* SO THESE FILE REQUESTS WILL NOT RUN IF ONE OF THE PARMS IS MISSING.
*
         CLC   SAREQST(4),ACTOPEN    IF AN OPEN REQUEST THEN
         BE    OPENDS                   BRANCH TO OPEN ROUTINE
         CLC   SAREQST(4),ACTREAD    IF A READ REQUEST THEN
         BE    READREC                  BRANCH TO READ ROUTINE
         CLC   SAREQST(5),ACTWRITE   IF A WRITE REQUEST THEN
         BE    WRITEREC                 BRANCH TO WRITE ROUTINE
         LA    R15,5                 SET RETURN CODE 5
         B     RETURN                UNKNOWN FILE REQUEST SO EXIT
**********************************************************************
* PROCESS OPEN REQUEST                                               *
**********************************************************************
OPENDS   DC    0H
*
* ACCESS SAVE AREA AND EXTRACT DSNAME/DDNAME FROM IT.
*
         L     R1,SAADDR2            GET DATA LENGTH FIELD ADDRESS
         MVC   SADATLEN,0(R1)        SAVE LENGTH VALUE
         L     R1,SAADDR3            GET DATA SAVE AREA LEN ADDRESS
         MVC   SADSALEN,0(R1)        SAVE LENGTH VALUE
         L     R4,SAADDR1            GET SAVE AREA ADDRESS
         LH    R1,SADATLEN           GET LENGTH OF DATA IN SAVE AREA
         BCTR  R1,0                  DECREMENT BY 1
         EX    R1,COPYDSN            COPY DSNAME/DDNAME FROM SAVE AREA
*
* DETERMINE IF A DDNAME HAS BEEN SUPPLIED
*
         CLC   SADSN(7),DDNKEY         IS THE OPEN VIA A DDNAME?
         BNE   RETURN                  NO, THEN EXIT
         MVC   VSAMFILE+40(8),SADSN+7  MOVE DDNAME TO VSAM ACB
         CLI   SAREQST+4,C'I'          OPEN FOR INPUT?
         BNE   OPENDS2                 NO, THEN OPEN FOR OUTPUT
         OPEN  (VSAMFILE,(INPUT))      OPEN VSAM FILE FOR INPUT
         B     RETURN                  BRANCH TO EXIT
OPENDS2  DS    0H
         OPEN  (VSAMFILE,(OUTPUT))     OPEN VSAM FILE FOR OUTPUT
         B     RETURN                  BRANCH TO EXIT
**********************************************************************
* PROCESS CLOSE REQUEST                                              *
**********************************************************************
CLOSEDS  DC    0H
         CLOSE VSAMFILE
         B     RETURN
**********************************************************************
* PROCESS READ REQUEST                                               *
**********************************************************************
READREC  DC    0H
         L     R4,SAADDR1            POINT TO SAVE AREA
         MVC   USERKEY(6),0(R4)      MOVE REQ KEY RPL KEY FIELD
         MVI   RECDAREA,C' '          PREPARE TO INIT RECORD AREA
         MVC   RECDAREA+1(79),RECDAREA INITIALIZE RECORD AREA
         LR    R8,R13
         LA    R13,SAVEARE2
         GET   RPL=SEQRET
         LR    R13,R8
         LTR   R15,R15               IS RETURN CODE = 0 ???
         BNZ   RETURN                IF NOT, THEN POST A MESSAGE
*
* CHECK LENGTH OF SAVE AREA AGAINST RECORD LENGTH. IF EQUAL OR GREATER
* THEN A COPY CAN PROCEED. IF NOT THEN THE SAVE AREA WILL NEED TO BE
* RESIZED.
*
         CLC   SADSALEN,READLEN      IS THE SAVE AREA LARGE ENOUGH?
         BNL   READSAVE              YES, THEN STORE RECORD IN SA
*
* SAVE AREA TOO SMALL SO REALLOCATE DATA SAVE AREA
*
         MVC   SAADDR1+1(2),READLEN  STORE REQUIRED SIZE IN BYTES 2&3
         MVC   REQCODE,REQDSASZ      SET REQUEST CODE FOR DSA RESIZE
         BAL   R5,EXITIR             BRANCH TO EXIT INTERFACE CALL
         LTR   R15,R15               DID THE RESIZE WORK?
         BNZ   RETURN                NO, THEN EXIT
*
* NEED TO SET LENGTH OF DATA BEING STORED IN SAVE AREA OTHERWISE
* WSIM COULD TRUNCATE RECORD OR INCORRECTLY PAD IT OUT.
* ONCE DATA LENGTH SET THEN COPY RECORD TO DATA SAVE AREA.
*
READSAVE DC    0H
         L     R2,SAADDR2            ADDRESS OF DATA LENGTH FIELD
         LH    R7,READLEN            LOAD LENGTH OF RECORD
         STH   R7,0(R2)              STORE LENGTH IN SAVE AREA
         L     R2,SAADDR1            POINT TO SAVE AREA
         EX    R7,COPYREC            MOVE RECORD TO SAVE AREA
         SR    R15,R15               SET RETURN CODE TO ZERO
         B     RETURN
**********************************************************************
* PROCESS WRITE REQUEST                                              *
**********************************************************************
WRITEREC DC    0H
         MVI   RECDAREA,C' '            START CLEAR OF RECORD AREA
         MVC   RECDAREA+1(79),RECDAREA  CLEAR RECORD AREA
         L     R4,SAADDR1               POINT TO SAVE AREA
         L     R7,SAADDR2               GET ADDRESS OF SAVE AREA
         LH    R7,0(R7)                 LOAD LENGTH OF DATA
         BCTR  R7,0                     DECREMENT FOR MVC
         EX    R7,COPYWRIT              MOVE SAVE AREA TO RECORD
         MVC   USERKEY(6),0(R4)         MOVE REQ KEY RPL KEY FIELD
         LR    R8,R13
         LA    R13,SAVEARE2
         PUT   RPL=SEQRET               WRITE RECORD TO VSAM FILE
         LR    R13,R8
         B     RETURN
**********************************************************************
* EXIT AND RETURN TO ITPFIOX                                         *
*                                                                    *
* FIND CORRECT INDEX COUNTER AND OUTPUT RETURN CODE                  *
**********************************************************************
RETURNV  DC    0H
         LA    R15,4                 SET VSAM EOF
         B     RETURN
RETURN6  DC    0H
         LA    R15,6                 SET OUTSIDE RANGE RETURN CODE
         B     RETURN
RETURN7  DC    0H
         LA    R15,7                 SET MISSING PARM RETURN CODE
RETURN   DC    0H
         LR    R7,R15                SAVE RETURN CODE
         MVC   REQCODE,REQDIC        SET CALL FOR DIC SAVE AREA
         CLC   SARCID,DICPFX         USING A DEVICE INDEX COUNTER?
         BE    RETURNA               YES, THEN CONTINUE
         MVC   REQCODE,REQNIC        NO, THEN SET FOR NIC SAVE AREA
         CLC   SARCID,NICPFX         USING A NETWORK INDEX COUNTER?
         BNE   RETURNB               NO, THEN UNKNOWN SO EXIT
RETURNA  DC    0H
         BAL   R5,EXITIR2            CALL EXIT INTERFACE ROUTINE
         LTR   R15,R15
         BNZ   RETURNB               IF NON-ZERO RC THEN EXIT
         LA    R4,SARCNUM            GET RETURN CODE FIELD ID
         LA    R1,L'SARCNUM          LOAD LENGTH OF SCAN FIELD
         EX    R1,TRTEXEC            SCAN FOR FIRST BLANK CHARACTER
         SR    R1,R4                 GET LENGTH OF FIELD
         BCTR  R1,0                     AND DECREMENT FOR PACK COMMAND
         O     R1,DWORKLEN           ADD IN LENGTH OF DWORK FIELD
         EX    R1,PACKSARC           EXECUTE PACK COMMAND
         CP    DWORK,RCMX            IS THE COUNTER GT 4095?
         BH    RETURNB               YES, THEN SKIP SAVE OF RC
         CP    DWORK,RCMN            IS THE COUNTER LT 1?
         BL    RETURNB               YES, THEN SKIP SAVE OF RC
         CVB   R6,DWORK              CONVERT ID TO BINARY VALUE
         BCTR  R6,0                  CONVERT TO WORD OFFSET
         SLA   R6,2                  MULTIPLY BY 4 FOR BYTE OFFSET
         L     R4,SAADDR1            POINT TO INDEX COUNTER GROUP
         AR    R4,R6                 POINT TO CORRECT INDEX COUNTER
         ST    R7,0(,R4)             SAVE RETURN CODE
*
RETURNB  DC    0H
         L     R13,4(,R13)           EXIT
         L     R14,12(,R13)
         LM    R0,R12,20(R13)
         BR    14                    LINKAGE
**********************************************************************
* SET EXIT INTERFACE ROUTINE PARMS, GET ADDRESS AND THEN CALL ROUTINE*
**********************************************************************
EXITIR   DC    0H
         PACK  DWORK,SADATAID        PACK SAVE AREA NUMBER
         CVB   R6,DWORK                 AND CONVERT TO BINARY
         STC   R6,SAADDR1            STORE SAVE AREA NUMBER
EXITIR2  DC    0H
         L     R6,8(,R3)             ADDRESS OF DUMMY DEV CB
         ST    R6,PLISTDEV           SET INTO PARAMETER LIST
         L     R6,4(,R3)             ADDR OF ADDRESS OF EXIT INTERFACE
         L     R15,0(,R6)            ADDR OF EXIT INTERFACE ROUTINE
         LA    R1,PLIST              ADDRESS OF PARAMETER LIST
         BALR  R14,R15               CALL EXIT INTERFACE ROUTINE
         BR    R5                    RETURN TO CALLING ROUTINE
*
*  EXECUTE COMMANDS
*
COPYFREQ MVC   SAREQST(0),0(R4)      COPY 1ST PARM TO FILE REQUEST
COPYRCID MVC   SARC(0),0(R4)         COPY 2ND PARM TO RETURN CODE ID
COPYSAID MVC   0(0,R2),0(R4)         COPY 3RD PARM TO SAVE AREA ID
COPYDSN  MVC   SADSN(0),0(R4)        COPY DSNAME/DDNAME FROM SAVE AREA
COPYREC  MVC   0(0,R2),RECDAREA      COPY RECORD INTO SAVE AREA.
COPYWRIT MVC   RECDAREA(0),0(R4)     COPY SAVE AREA INTO RECORD.
PACKSARC PACK  DWORK(0),SARCNUM(0)   PACK RETURN CODE FIELD ID
TRTEXEC  TRT   0(0,R4),FINDBLNK      FIND BLANK IN PASSED PARAMETERS
*
*  FIELD DEFINITIONS
*
*  COMPARISON FIELDS
*
ACTOPEN  DC    CL4'OPEN'
ACTCLOSE DC    CL5'CLOSE'
ACTREAD  DC    CL4'READ'
ACTWRITE DC    CL5'WRITE'
DDNKEY   DC    CL7'DDNAME='          DDNAME KEYWORD
DATAIDMN DC    CL3'001'              MINIMUM VALUE FOR DATA SAVE AREA
DATAIDMX DC    CL3'255'              MAXIMUM VALUE FOR DATA SAVE AREA
RCMN     DC    PL8'1'                MINIMUM VALUE FOR RC AREA
RCMX     DC    PL8'4095'             MAXIMUM VALUE FOR RC AREA
DICPFX   DC    CL2'DC'               DEVICE INDEX COUNTER PREFIX
NICPFX   DC    CL2'NC'               NETWORK INDEX COUNTER PREFIX
ZEROVAL  DC    CL3'0'                FOR COMPARE AND INIT OF SADATAID
BLANKVAL DC    CL5' '                FOR COMPARE AND INIT OF PARMS
         DS    0F
DWORKLEN DC    XL4'70'               LENGTH OF DWORK FIELD FOR PACK EX
*
* REQUEST CODES FOR ACCESSING WSIM INFORMATION AND SAVE AREAS
*
REQNIC   DC    X'52'                 GET THE NETWORK INDEX COUNTERS
REQDIC   DC    X'B2'                 GET THE DEVICE INDEX COUNTERS
REQDSA   DC    X'B5'                 GET THE REQUIRED DATA SAVE AREA
REQDSASZ DC    X'BF'                 RESIZE SPECIFIED DATA SAVE AREA
*
* USED TO PARSE USER PARAMETER STRING INTO INDIVIDUAL ENTRIES
*
FINDBLNK DC    XL64'00',C' ',XL191'00' TRANSLATE TABLE TO FIND BLANKS
*
* WORK AREAS COPIED TO AND FROM SAVE AREAS
*
SAREQST  DC    CL5' '                FILE REQUEST
SARC     DS    0CL7                  RETURN CODE SAVE AREA NAME
SARCID   DC    CL2' '                DC OR NC TO IDENTIFY COUNTER TYPE
SARCNUM  DC    CL5' '                RC FIELD ID + 1 BYTE FOR SCANNING
SADATAID DC    CL3'0'                DATA SAVE AREA ID
SADSN    DC    CL44' '               DATASET NAME
         DS    0F
SADATLEN DS    H                     LENGTH OF DATA IN SAVE AREA
SADSALEN DS    H                     LENGTH OF SAVE AREA
*
READLEN  DC    XL2'50'
RECDAREA DC    CL80' '
*
* EXIT INTERFACE ROUTINE PARAMETERS
*
PLIST    DS    0F                    EXIT INTERFACE ROUTINE PLIST
PLISTDEV DS    A                     ADDRESS OF DEV CB
         DC    A(REQCODE)            ADDRESS OF REQUEST CODE
         DC    A(SAPARMS)            ADDRESS OF RETURNED PARMS AREA
*
REQCODE  DC    X'B5'                 REQUEST DEVICE SAVE AREA
SAPARMS  DS    0F                    REQUEST SAVE AREA PARAMETERS
SAADDR1  DS    F'0'                  ADDRESS OF SAVE AREA
SAADDR2  DS    F'0'                  ADDRESS OF DATA LENGTH
SAADDR3  DS    F'0'                  ADDRESS OF DATA SAVE AREA LENGTH
*
*  REGISTER SAVE AREA AND NUMBER CONVERSION FIELD
*
SAVEAREA DS    18F                   REGISTER SAVE AREA
SAVEARE2 DS    18F                   REGISTER SAVE AREA
DWORK    DS    D                     BINARY WORK AREA
*
* RETURN CODES FROM EXIT INTERFACE ROUTINE
*
         DS    0F
RCINVRC  DC    XL4'4'                INVALID REQUEST CODE
RCINVCB  DC    XL4'8'                INVALID CONTROL BLOCK PASSED
RCINCDL  DC    XL4'C'                INCORRECT DATA LENGTH SPECIFIED
RCINSTOR DC    XL4'10'               INSUFFICIENT STORAGE
RCMISS   DC    XL4'14'               MISSING SAVE AREA
RCSAZERO DC    XL4'18'               SPECIFIED SAVE AREA NUMBER ZERO
RCNFND   DC    XL4'1C'               SPECIFIED AREA NOT FOUND
RCSTATIC DC    XL4'20'               STATIC SAVE AREA UNABLE TO CHANGE
RCINVSIZ DC    XL4'24'               INVALID SIZE SPECIFIED
RCNOSAST DC    XL4'40'               NO SAVE AREA STORAGE AVAILABLE
*
* REGISTER EQUATES
*
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
R15      EQU   15
*
* VSAM FILE REQUIREMENTS
*
VSAMFILE ACB   AM=VSAM,EXLST=MSTEXL,DDNAME=VKSD0080,                   X
               MACRF=(KEY,DIR,OUT)
MSTEXL   EXLST EODAD=RETURNV,SYNAD=RETURN
SEQRET   RPL   AM=VSAM,ACB=VSAMFILE,AREA=RECDAREA,AREALEN=80,          X
               OPTCD=(KEY,DIR),KEYLEN=6,ARG=USERKEY
*
         DS    0F
USERKEY  DC    CL6' '
         END
