*        PART 1 OF SORTP0
* CATALOG NO 704985-0    SIGMA 5/7 SORT           OVERLAY 0
*  VERSION C00
         SYSTEM   SIG7FDP
         SYSTEM   BPM
PGMSEG0  CSECT    0
*
         PAGE
*
         DEF      SCR0
         DEF      SETCD10,SETCD45,SIN145,SIN27A,SIN121
         DEF      SIN2R,CKDEC,ALLBL,GIL1,ER2,SCR2
         DEF      SIN24,SIN285,SIN295
         REF      FIT0,FIT1,FIT2,FIT3,FIT4,FIT5,FIT6,FIT7,BCT0
         REF      TRKSZ,TRKSB,STCAD,PMSRCD
         REF      CPER
         REF      OPINT
         REF      TBUFSW
         REF      ILT0,CNVRT,BNEBC,EBCBN,SC50,CALLSW
         REF      PRAMLOC
         REF      KTTL
         REF      ENDSNAP
         REF      KLNGC,STEP,STFP,STFP2
         REF      RLKCM,SINTMP,CRSF,SIN1R
         REF      DYNMEM
         REF      RSTOR
         REF      STRNGBRK
         REF      DUMPMEM
         SREF     SCR1X,SIN21X,SIN122X,SIN2X,SIN24X
         SREF     SIN28X,SIN29X,SIN22X
*
         PAGE
*
X0       EQU      0
X1       EQU      1
X2       EQU      2
X3       EQU      3
X4       EQU      4
X5       EQU      5
X6       EQU      6
X7       EQU      7
R0       EQU      8
R1       EQU      9
R2       EQU      10
R3       EQU      11
R4       EQU      12
R5       EQU      13
R6       EQU      14
R7       EQU      15
SR1      EQU      8
SR2      EQU      9
SR3      EQU      10
RA       EQU      10
RB       EQU      11
RC       EQU      12
RD       EQU      13
RE       EQU      14
RF       EQU      15
R13      EQU      13
R14      EQU      14
BINEBC   EQU      BNEBC
SETCD4   EQU      SETCD10
*
*
         PAGE
         BOUND    8
*
SKLIM    DATA,4   X'10000'
         DATA,4   X'1060000'
*
*
*                                                                /VALUES
KSRTC    DATA,4   51                KEY START
*
         PAGE
*
SCR1R    DATA     0
*
*
SIN2R    DATA     0
*
SCR0     STW,X5   SCR1R             SAVE RETURN ADDRESS
         LCI      3
         STM,5    SIN1R             SAVE REG 6,7  FOR LATER
         LI,5     ENDP0
         STW,5    ENDSNAP           DUMP IN CASE OF ERROR
         M:GP     1
         LW,5     CRSF               IS IT CO-RES
         BEZ      SCR1X             NO
SCR2     RES      0
         M:FP     1
         BAL,X5   SIN1              EDIT AND CONFIGURATION CHECKS
         LW,X5    CRSF             IS IT CO-RESIDENT
         BGZ      SCR1             YES.
         M:TRAP   (IGNORE,DEC)
SCR1     RES      0
         LW,X5    CPER
         BCS,X3   *SCR1R
         BAL,X5   SIN2              INITIALIZE TABLES
         B        *SCR1R
         PAGE
*
*  THIS ROUTINE EDITS THE INPUT PARAMETERS,PERFORMS LEGALITY AND
*        CONSISTENCY CHECKS, AND ANALYZES THE MACHINE CONFIGURATION
*        TO DETERMINE WHETHER OR NOT THE MINIMUM REQUIREMENTS FOR A
*        SORT TO RUN OBTAIN.
*
*  AT ENTRY TO SIN1:
*        REGISTER:  5=THE RETURN ADDRESS
*                   6=LOCATION IN COMMON MEMORY OF THE PARAMETER LIST
*
         PAGE
*
SIN1     RES      0
         STW,5    SIN1R             SAVE RETURN ADDR
*                                       OF INPUT FILE'S DCB
         PAGE
*
*  THIS REGION TESTS THE VALIDITY OF THE LOGICAL RECORD LENGTH
*                 PARAMETER (USER FORMATTED FILES ONLY).
         BAL,R1   GILRL             GO GET INPUT LOGICAL RECORD LENGTH
         LI,X5    4                 CHARACTER COUNT
         BAL,R1   CKDEC             CHECK LEGAL DIGITS:  NO ZONE BITS
         BCR,0    SETCD3            INVALID DIGIT IN INPUT LRL
SINE2    CI,X6    X'1'                                     /SIG7-1044/*C4986
         BCS,X1   SETCD10           NOT MIN VALU (1 CHAR)  /SIG7-1044/*C4986
*
         LW,X6    CRSF             IS IT CO-RESIDENT
         BEZ      SIN21X           NO.
         PAGE                                                          R
* THIS CHECKS COL 40 , IF INUM CAUGHT ERROR IT PUT 17 IN FIT5,BCT0+27,1 AND ILT0
SIN121   LI,6     39
         LB,5     *PRAMLOC,6
         CI,5     X'40'             BLANK
         BE       SIN122
         CI,5     X'C1'
         BL       SETCDH
         CI,5     X'C9'
         BL       SIN122
         CI,5     X'F6'             MUST BE AT LEAST 6
         BL       SETCDH
         CI,5     X'F9'
         BG       SETCDH
SIN122   RES      0
         LI,5     13                INDEX
         LB,5     *PRAMLOC,5           SEE POS 14 IN C. PAGE
         CI,5     X'F2'             VALID ARE 1, OR 2,0,X'40'
         BG       SETCDC            ERRROR
         CI,5     X'F0'
         BGE      SIN123              OK
         CI,5     X'40'
         BNE      SETCDC            ERROR
SIN123   RES      0
         CI,5     X'F1'
         BNE      SIN124
         MTW,1    TBUFSW            SET SW TO 1, FOR 1 TBUF
SIN124   RES      0
         LW,X5    CRSF             IS IS CO-RESIDENT
         BEZ      SIN122X          NO.
         PAGE
*
* THIS ROUTINE CHECKS COL 41-43 FOR CORE SIZE SPECIFIED
* IF OK, IT STORES IT IN FPT OF M:GP, AND ASKS FOR AMOUNT USER WANTS
SIN145   LI,5     40                    FOR COL 41-43
         LI,7     3                 3 COLS TO CHECK
         BAL,9    ALLBL             IF BLANK USE 512
         BCR,0    SIN15             YES BYPASS TEST
         LI,5     10
         LW,6     *PRAMLOC,5          COL 41-44
         LI,5     3
         BAL,9    CKDEC             CHECK FOR VALID DIGITS
         BCR,0    SETCDB            INVALID DIGIT
         OR,6     =X'F0F0F0F0'
         SLS,6    -8                EBCBN NEED RIGHT JUST
         CW,6     =X'00F0F0F0'           ZERO BYPASS
         BE       SIN15              YES
         STW,6    CNVRT
         BAL,9    EBCBN             GET IT BINARY
         LW,6     CNVRT+1           BINARY CORE REQUEST
         OR,6     =X'08000000'      STE UP M:GP FPT
         STW,6    GETPG             CHANGE M:GP CORE REQUEST
         PAGE
*
*  THIS REGION TESTS THE VALIDITY OF NUMBER OF SORT KEYS PARAMETER.
*                 THIS IS A REQUIRED PARAMETER.  IT MUST BE IN THE
*                  RANGE 1<NUMBER OF KEYS<16.
SIN15    BAL,R1   GNSKY             GET NUMBER OF SORT KEYS
         LI,X5    2
         BAL,R1   CKDEC             CHECK FOR VALID DIGITS
         BCR,0    SETCD9            INVALID DIGIT IN NUMBER OF KEYS
         CLM,X6   SKLIM             IS NUBER:  1<NUMBER<16
         BCS,R1   SETCDA            NO:  ERROR
         SCS,6    16
         STW,X6   CNVRT
         BAL,R1   EBCBN
         LW,X6    CNVRT+1
SINE61   STW,X6   SINTMP+2          SAVE NUMBER
         LI,X5    0
         STW,X5   SINTMP+3          COUNT KEYS
SIN16    MTW,15   SINTMP+2
         BCS,X1   *SIN1R            ALL DONE
         MTW,1    SINTMP+3          COUNT KEY
         LW,R1    SINTMP+3
         STW,R1   CNVRT+1
         BAL,X5   BINEBC
         LW,R1    CNVRT+1
         STH,R1   EOE+1
         STH,R1   EOF+1
         LW,X5    KSRTC
         BAL,R1   KSTRT             CHECK STARTING POSITION OF KEY 1
*
         LW,X5    KLNGC
         BAL,R1   KBLNG             CHECK BYTE LENGTH OF KEY 1
*
         LI,X5    10                INCREMENT LOCATION
         AWM,X5   KSRTC                      FOR
         AWM,X5   KLNGC                               NEXT
         BCR,0    SIN16                                  KEY
*
         PAGE
*
*  THIS ROUTINE INITIALIZES TABLES, SETS SIZE AND ADDRESS LIMITATIONS
*        FOR THE REMAINDER OF THE SORT, AND PERFORMS ALL SIZE AND
*        CONFIGURATION CHECKS.
*
         PAGE
*
SIN2     STW,X5   SIN2R
         LW,X6    CRSF             IS IT CO-RESIDENT
         BEZ      SIN2X            NO.
*
         PAGE
*
*  THIS REGION SETS ALL LOGICAL RECORD LENGTHS INTO BCT0.
*
SIN24    RES      0
         BAL,9    GILRL             GET IN LOG REC LEN
         STW,X6   CNVRT
         BAL,R1   EBCBN             GO:  CONVERTEBCDIC TO BINARY
         LW,X6    CNVRT+1
         LI,X7    0
         STW,X6   RLKCM             SAVE RECORD LENGTH FOR KEY ERROR
         STW,6    BCT0+23           INPUT REC LEN IN BYTES
         SLD,X6   -2                CONVERT TO WORDS
         SLS,X7   -30                   AND BYTE INCREMENT
         STH,6    BCT0+24           REC LEN KEY ERR
         STH,7    BCT0+25           INPUT BYTE INCR
         STH,6    BCT0+24,1         OUT LOG REC LEN
         STH,7    BCT0+25,1         OUT BYTE INCR
         SLS,6    2                 TO BYTES
         MTW,0    7                 ANY BYTE INCR
         BEZ      %+2
         AI,6     4                 ROUND UP TO NEXT WORD
         AI,6     8                 UP FOR 2 CTL WORDS
         STW,6    BCT0+9            SORT INTERNAL REC LEN IN BYTES
         LW,R1    CRSF             IS IT CO-RESIDENTT
         BEZ      SIN24X           NO.
*
SIN27A   BAL,9    GNSKY             GET NUMBER OF SORT KEYS
         SLS,X6   -16               RIGT JUSTIFIED
         STW,X6   CNVRT                 INTO CNVRT
         BAL,R1   EBCBN             GO:  CONVERT EBCDIC TO BINARY
         LW,X6    CNVRT+1           SET THE NUMBER OF SORT KEYS
         STW,6    BCT0              NUM OF KEYS
         LW,X6    CRSF             IS IT CO-RESIDENT
         BEZ      SIN28X           NO.
         PAGE
*
*  THIS REGION COMPUTES SORT/MERGE BUFFER LENGTHS AND TESTS FOR
*       MINIMUM CORE REQUIREMENTS.
*
SIN285   RES      0
,GETPG   M:GP     512               CHANGED IF COL 41-43 SPECIFIED
         OR,8     =X'9000000'      SET FOR M:FP IN ROOT
         STW,8    STFP             M:FP FOR NORM EXIT
         STW,8    STEP             M:FP FOR ABNORM EXIT
         STW,8    STFP2            M:FP FOR XCON EXIT
         SAS,8    9                     MEMORY TO BCT0+10
         MTW,0    DUMPMEM           HAS USER SPEC DUMP
         BEZ      SIN2855           NO
         LW,7     8                 NUMBER OF WORDS REC
         AW,7     9                 ADD BEGIN ADDR TO GET END
         AI,7     -1
         STW,7    DUMPMEM           SAVE END VALUE
SIN2855  RES      0
         STW,9    DYNMEM
         LW,X7    CRSF             IS IT CO-RESIDENT
         BEZ      SIN29X           NO.
         STW,8    BCT0+11
         STW,9    BCT0+10
         SLD,8    -32
SIN295   RES      0
         LW,7     FIT5              NUMBER OF INTERMEDIATED DCB'S
         SAS,7    1                 TIMES 2
         DW,8     7                 TRIAL BUFFER LENGTH ROUNDED DOWN
         AND,9    =X'7FFFFF00'          TO K TIMES WORDS/SECTOR
         CI,9     1536              COMPARE TO TRACK SIZE IN WORDS
         BLE      PHS100
         CI,9     8192              COMPARE WITH UPPER LIMIT I/O SIZE
         BL       %+2
         LI,9     7936              SET TO MAX SIZE-1 SECTOR
PHS50    RES      0
         MTW,0    9                 DONT WANT A ZERO VALUE
         BEZ      SETCD45           YES MEMORY OVERFLOW
         STW,9    TRKSZ             SET SIZES TO MAXIMUM
         SAS,9    2
         STW,9    TRKSB
         B        PHS150
*
PHS100   RES      0
         LI,8     0
         LW,9     BCT0+11           NUMBER OF WORDS AVAILABLE
         LW,7     FIT5
         AI,7     1
         DW,8     7
         AND,9    =X'7FFFFF00'
         CI,9     1536              IS LESS OR EQUAL TO TRACK SIZE
         BLE      PHS50             YES:  GO SET TO TRKSZ AND TRKSB
         CI,9     8192              IS < MAX I/O SIZE
         BL       PHS50             YES:  GO SET TO TRKSZ AND TRKSB
         B        PHS50-1           NO:  GO-SET TO MAX-1 SECTOR
*
PHS150   RES      0
         LI,8     0
         LW,9     BCT0+11           WORDS OF DYNAMIC MEMORY AVAILABLE
* FOR STAND ALONE THIS IS DYN MEM LESS IN/OUT BUFF SIZES
         DW,8     TRKSZ             DIVIDED BY BUFFER SIZE
         LW,10    FIT5              NUMBER OF DCB'S
         AI,10    1                     PLUS 1 = NUMBER OF BUFFERS
         CW,9     10                ARE THERE ENOUGH
         BGE      PHS200            YES:
         LW,9     TRKSB             NO REDUCE BUFFER SIZE CONSTANTS
         AI,9     -1024                 BY 1 SECTOR AND RETRY THE
         STW,9    TRKSB                 CALCULATION.
         LW,9     TRKSZ
         AI,9     -256
         STW,9    TRKSZ
         CI,9     256               SIZE MUST BE AT LEAST 1 SECTOR
         BGE      PHS150                FOR SORT/MERGE TO EXECUTE
         B        SETCD45           PRINT MEMORY OVERFLOW MESSAGE
*
PHS200   RES      0
         LW,8     TRKSB
         STW,8    FIT0              SET BUFFER BYTE LENGTH TO FIT0
         STW,8    FIT2                  AND TO FIT2
         STW,8    FIT0+5
         STW,9    FIT4              NUMBER OF BUFFERS AVAILABLE
         LW,5     FIT5
         STW,8    FIT2,5            SET BYTE LIMITS TO FIT2
         BDR,5    %-1
         LW,8     BCT0+9             SORT INTER REC LEN
         STW,8    FIT3
         LW,8     BCT0+10           BEGINNING OF DYNAMIC MEMORY
* FOR STAND ALONE THIS IS DYN MEM ADDR PAST IN/OUT BUF
         STW,9    ILT0              NUMBER OF BUFFERS
         LW,5     FIT5
         STW,8    FIT1,5            SET FIT1 = BUFFER ADDRESSES OF
         AW,8     TRKSZ                 PRIMARY BUFFERS
         BDR,5    %-2
         LW,5     FIT4
         LW,9     FIT5              NUM OF INTER DCBS
         STW,9    FIT4
         SW,5     FIT5
         CW,5     FIT5
         BLE      %+2
         LW,5     FIT5              SET FIT6 = BUFFER ADDRESSES OF
PHS2000  RES      0
         MTW,1    FIT4              UP FOR ALTERNATE BUF (FIT6)
         STW,8    FIT6,5                ALTERNATE BUFFERS.
         AW,8     TRKSZ             ONE ALTERNATE IS GUARANTEED
         BDR,5    PHS2000
         LI,8     4
         LW,5     FIT5
         STW,8    FIT3,5            SET BUFFER BYTE DISPLACEMENTS TO 4
         BDR,5    %-1
         STW,8    FIT0+4            SET OUTPUT DISPLACEMENT TO 4
         LW,8     BCT0+10
         STW,8    FIT0+2            SET OUTPUT BUFFER ADDRESSES TO FIT6
         AW,8     TRKSZ
         MTW,0    TBUFSW            USE 1 TOURN BUFFER ?
         BNEZ     PHS2001           YES USE JUST 1
         STW,8    FIT0+3
         AW,8     TRKSZ
PHS2001  RES      0
         STW,8    STCAD             SET TO BEGINNING OF STC TABLES
         LW,9     BCT0+11           NUMBER OF WORDS AVAILABLE
* FOR STAND ALONE THIS IS DYN MEM LESS IN/OUT BUFF SIZES
         SW,9     TRKSZ                 MINUS BUFFER AREAS
         MTW,0    TBUFSW            SHOULD WE USE JUST 1 TOURN BUF
         BNEZ     PHS2002           YES USE JUST 1
         SW,9     TRKSZ
PHS2002  RES      0
         SLS,9    2                  TO BYTES
         LI,8     0
         LW,10    BCT0+9
         AI,10    12
         DW,8     10
         AND,9    =X'FFFE'
         STW,9    BCT0+5            TOURNAMENT SIZE
         SAS,9    2                 MUL BY 4
         STW,9    STRNGBRK           FORCE STRING BREAK
         SAS,9    -1                BACK TO POWER OF 2
         AW,9     BCT0+5
         AW,9     STCAD
         STW,9    PMSRCD            BEGINNING OF MASS RECORD STORAGE
         LI,6     0
         LW,7     FIT2              INTER BUF BYTE LEN
         DW,6     =X'800'           800 HEX BYTES PER BLK/GRANULE
         MTW,0    6                  ANY REMAINDER
         BEZ      %+2
         MTW,1    7                 YES: UP QUOTIENT
         STH,7    BCT0+29           L HALF HAS NUM OF GRANLS PER IO
         LH,6     BCT0+27,1         NUM OF INTER DCBS
         AND,7    =X'FFFF'           MASK
PHS201   LH,9     RSTOR,6           GET NUM OF GRAN PER DCB
         AND,9    =X'FFFF'           MASK OUT SIGN EXTENT
         CW,7     9                 AT LEAST ENOUGH GRAN FOR 1 IO
         BLE      PHS202            YES
         LI,7     11
         B        SC50
PHS202   RES      0
         LI,8     0
         DW,8     7                 GET IO'S PER RSTORE
         MW,9     7                 MAKE RSTORE AN EVEN MULT OF IO'S
         STH,9    RSTOR,6            CHANGE USERS REQUEST
         BDR,6    PHS201
         LW,4     FIT5               NUM OF INTER DCBS
         BAL,11   OPINT             GO OPEN WITH ADJUSTED RSTORE
         LW,X6    CRSF             IS IT CO-RESIDENT
         BEZ      SIN22X           NO.
         B        *SIN2R           EXIT
         PAGE
GILRL    LW,X6    *PRAMLOC          GET INPUT FILE'S RECORD LENGTH
         LI,X5    1                     INTO X6
GIL1     LW,X7    *PRAMLOC,X5
         SLD,X6   8
         BCR,0    *R1
*
*
*
GKSTR    LW,X6    PRAMLOC
         SLS,X6   2
         AW,X6    X5                SOURCE
         LW,X7    =X'4000000'       COUNT
         AI,X7    BA(SINTMP+4)      DESTINATION
GKST1    LI,RC    0
         STW,RC   SINTMP+4
         MBS,X6   0
         LW,X6    SINTMP+4
         BCR,0    *R1
*
GNSKY    LI,X5    24
         LH,X6    *PRAMLOC,X5       NUMBER OF SORT KEYS
         SLS,X6   16                LEFT JUSTUFIED IN X6
         BCR,0    *R1
*
GKLNG    LW,X6    PRAMLOC
         SLS,X6   2
         AW,X6    X5                SOURCE  ADDRESS
         LW,X7    =X'3000000'       COUNT
         AI,X7    BA(SINTMP+4)      DESTINATION
         BCR,0    GKST1
*
         PAGE
*
KSTRTR   DATA     0
*
KSTRT    STW,R1   KSTRTR
         BAL,R1   GKSTR             GO GET KEY 1 STARTING BYTE
         LI,X5    4                 COUNT
         BAL,R1   CKDEC             GO CHECK FOR LEGAL DIGITS
         BAL,R1   SETCDE            INVALID DIGIT IN STARTING BYTE
         CI,X6    X'1'
         BCS,X1   SETCD4            LESS THAN 1
         BCR,0    *KSTRTR
*
KBLNGR   DATA     0
*
KBLNG    STW,R1   KBLNGR            SAVE RETURN
         BAL,R1   GKLNG             GO GET KEY LENGTH
         LI,X5    3
         BAL,R1   CKDEC            CHECK FOR VALID DIGITS
         BAL,R1   SETCDF            ILLEGAL DECIMAL DIGIT IN KEY LENGTH
         CI,X6    X'1'
         BCS,X1   SETCD4            LESS THAN 1
         SLS,6    -8                                       /SIG7-4137/*E4985
         STW,6    CNVRT                                    /SIG7-4137/*E4985
         BAL,R1   EBCBN                                    /SIG7-4137/*E4985
         LW,6     CNVRT+1                                  /SIG7-4137/*E4985
         AWM,6    KTTL                                     /SIG7-4137/*E4985
         SLS,6    -2                                       /SIG7-4137/*E4985
         AWM,6    KTTL                                     /SIG7-4137/*E4985
         BCR,0    *KBLNGR
*
*
         PAGE
*
* THIS ROUTINE CKECKS FOR ILLEGAL DIGITS IN SORT CTL CARD  /SIG7-6227/*F4985
* THE ONLY VALID ARE F0-F9 EXCEPT C0-C9 ON UNIT OUT BLK    /SIG7-6227/*F4985
* 5 IS INDEX REG, 7=FF OUT BLK ,6 WORD TO BE CHECKED       /SIG7-6227/*F4985
* 9=ERROR ,9+1 NORMAL RETURN                               /SIG7-6227/*F4985
CKDEC    STW,6    SINTMP+4                                 /SIG7-6227/*F4985
         MTW,15   5                  DECREMENT BY 1        /SIG7-6227/*F4985
         CI,7     X'FF'              OUT BLK FACTOR COBOL  /SIG7-6227/*F4985
         BE       CKDEC4             IS SIGNED             /SIG7-6227/*F4985
         LI,7     X'F0'                BLANK TO ZERO       /SIG7-6227/*F4985
CKDEC1   LB,6     SINTMP+4,5         BYTE TO BE CHECKED    /SIG7-6227/*F4985
         CI,6     X'40'                                    /SIG7-6227/*F4985
         BNE      %+3                                      /SIG7-6227/*F4985
         STB,7    SINTMP+4,5         PUT  F0 IN PLACE OF 40/SIG7-6227/*F4985
         B        CKDEC2                                   /SIG7-6227/*F4985
         CI,6     X'F0'                                    /SIG7-6227/*F4985
         BL       *9                 ERROR                 /SIG7-6227/*F4985
         CI,6     X'F9'                                    /SIG7-6227/*F4985
         BG       *9                 ERROR                 /SIG7-6227/*F4985
CKDEC2   MTW,15   5                  DECREMENT BY 1        /SIG7-6227/*F4985
         CI,5     -1                 END?                  /SIG7-6227/*F4985
         BE       CKDEC3             YES                   /SIG7-6227/*F4985
         B        CKDEC1             GO DO NEXT BYTE       /SIG7-6227/*F4985
CKDEC3   AI,9     1                  RETURN PLUS 1, ALL OK /SIG7-6227/*F4985
         LW,6     SINTMP+4          RET 6 WITH DATA NO ZONE/SIG7-6227/*F4985
         AND,6    =X'F0F0F0F'                              /SIG7-6227/*F4985
         B        *9                                       /SIG7-6227/*F4985
* ONLY HERE FOR RIGHT (UNITS) BYTE OF OUTPUT BLK FACTOR.   /SIG7-6227/*F4985
CKDEC4   LB,6     SINTMP+4,5         BYTE TO BE EXAMINED   /SIG7-6227/*F4985
         LI,7     X'F0'                                    /SIG7-6227/*F4985
         CI,6     X'40'                                    /SIG7-6227/*F4985
         BNE      CKDEC5                                   /SIG7-6227/*F4985
         STB,7    SINTMP+4,5           MAKE ZERO           /SIG7-6227/*F4985
         B        CKDEC2                                   /SIG7-6227/*F4985
CKDEC5   CI,6     X'C0'                                    /SIG7-6227/*F4985
         BL       *9                                       /SIG7-6227/*F4985
         CI,6     X'CA'                     C0-C9 OK       /SIG7-6227/*F4985
         BL       CKDEC2                    C0-C9 OK       /SIG7-6227/*F4985
         CI,6     X'F0'                                    /SIG7-6227/*F4985
         BL       *9                  ERROR                /SIG7-6227/*F4985
         CI,6     X'FA'                                    /SIG7-6227/*F4985
         BL       CKDEC2              F0-F9 OK             /SIG7-6227/*F4985
         B        *9                         ERROR         /SIG7-6227/*F4985
*
         PAGE                                                          R
*     THIS REGION TESTS TO SEE IF AN ARGUMENT IS ALL BLANKS            R
*                 IF IT IS ALL BLANK   -  NORMAL RETURN                R
*                 IF IT IS NON-BLANK  -  NORMAL RETURN PLUS ONE        R
*                 UPON ENTRY:  X5  BYTE DISPLACEMENT WITHIN PRAMLOC    R
*                              X7  NO OF BYTES IN ITEM                 R
ALLBL    AI,R1    1                                                    R
ALLBL1   LB,X6    *PRAMLOC,X5       GET BYTE                           R
         CI,X6    C' '              COMPARE WITH BLANK                 R
         BCS,3    *R1               IF NON BLANK                       R
         AI,X5    1                 SET UP FOR NEXT BYTE               R
         BDR,X7   ALLBL1            EXAMINED ENTIRE ITEM               R
         MTW,15   R1                                                   R
         BCR,0    *R1                                                  R
         PAGE
*
         PAGE
*                 FILE IS NOT MONITOR OR USER FORMAT
*                 ILLEGAL DECIMAL DIGIT IN INPUT RECORD LRL
SETCD3   LI,RF    X'3'
         BAL,R2   ER2
         AI,R1    1
         BCR,0    SINE2
*                 ILLEGAL DECIMAL DIGIT IN NUMBER OF KEYS
SETCD9   LI,RF    X'9'
         BAL,R2   ER2
         LI,X7    17                SPEC ERR               /SIG7-1162/*C4986
         BCR,0    SC50              GO ABORT               /SIG7-1162/*C4986
*
SETCDA   LI,RF    X'A'
         BAL,R2   ER2
         LI,X6    16
         BCR,0    SINE61
SETCDB   LI,15    X'B'               CORE SIZE SPEC ERROR
         BAL,10   ER2               PRINT MSG
         BCR,0    SIN15             CONT CARD SCAN
SETCDC   RES      0
         LI,15    X'C'              INDEX FOR ERROR MESG
         BAL,10   ER2               PROCESS ERROR
         B        SIN124            CONTINUE SCAN
*
SETCDE   LI,RF    X'E'
         BAL,R2   ER2
         AI,R1    2
         BCR,0    *R1
*
SETCDF   LI,RF    X'F'              ILLEGAL DECIMAL DIGIT IN KEY
         BAL,R2   ER2                   LENGTH
         AI,R1    2
         BCR,0    *R1
SETCDH   LI,15    1
         BAL,10   ER2
         B        SIN122
SETCD10  LI,RF    X'10'             PARAMETER LESS THAN THE MINIMUM VALUE
         BAL,R2   ER2
         AI,R1    2
         BCR,0    *R1
*                                                                      R
SETCD45  LI,X7    4                 MEMORY OVERFLOW        /SIG7-1162/*C4986
         BCR,0    SC50              GO AOBORT              /SIG7-1162/*C4986
*
*
EO1      TEXTC    'DCBS PARAMETER NOT VALID'
EO3      TEXTC    'INPUT RECORD LENGTH'
EO5      TEXTC    'IN/OUT BLOCKING'
EO6      TEXTC    'FORWARD SP FILE'
EO8      TEXTC    'OUTPUT RECORD LENGTH'
EO9      TEXTC    'NUMBER OF KEYS INVALID'
EOA      TEXTC    'NOT 1--16 KEYS'
EOB      TEXTC    'INVALID CORE SIZE'
EOC      TEXTC    'INVALID TBUF VALUE'
EOE      TEXTC    'KEYXX:  START'
EOF      TEXTC    'KEYXX:  LENGTH'
EO13     TEXTC    'SLICE SIZE'                                         R
EO10     TEXTC    'PARAMETER VALUE LESS THAN THE LEGAL MINIMUM VALUE'
ERTBL    DATA,4   0,EO1,0,EO3,0,EO5,EO6,0,EO8,EO9
         DATA,4   EOA,EOB,EOC,,EOE,EOF
         DATA,4   EO10,0,0,EO13
*
         PAGE
*
ER2R     DO1      9
         DATA     0
*
ER2      STW,R2   ER2R              SAVE RETURN ADDRESS
         LCI      7
         STM,X6   ER2R+1
         LI,X6    X'11'             SPECIFICATION ERROR
         STW,X6   CPER              CAUSE ABORT AFTER THIS PHASE
         XW,RF    X7
         LW,R1    ERTBL,X7
         STW,R1   ER2R+8
         M:PRINT  (MESS,*ER2R+8)    PRINT MESSAGE
         LCI      7
         LM,X6    ER2R+1
ENDP0    RES      0
         BCR,0    *ER2R             RETURN
         PAGE
*
         END

