         PAGE
R0       EQU      0
R1       EQU      1
R2       EQU      2
R3       EQU      3
R4       EQU      4
R5       EQU      5
R6       EQU      6
R7       EQU      7
SR1      EQU      8
SR2      EQU      9
SR3      EQU      10
SR4      EQU      11
D1       EQU       12
D2       EQU      13
D3       EQU      14
D4       EQU      15
         PAGE
COMBINE  DSECT    1
         TITLE    'COMBINE'
         SYSTEM   SIG7
*
* COMBINE         PARAMETER COMBINATION EDITOR
*
* INPUT
*        D1       CURRENT ACTION CODE
*        ARGTBL   TABLE OF TRANSLATED ARGUMENTS FOR DEVICE/FILE
*                 (DEVICE,FILE,CODE,MODE,SEQUENCE,SELECT)
* OUTPUT
*        FLAGGED ERROR CODES (IF ANY)
*
         REF      ERROR
         REF      DEVICE,FILE,CODE,MODE,SEQUENCE,SELECT
         REF      PRTBUF
*
         LCI      7                 SAVE REGISTERS
         PSM,R5   *R7
*
         LW,R6    DEVICE,R7         GET DEVICE CODE
         BEZ      RETURN
         CI,D1    2                 TEST IF TO OR OVER COMMAND
         BE       DEVICE2           NO - COPY COMMAND
         AI,R6    6                 INCREMENT OUTPUT DEVICE CODES
*
         CI,R6    9                 TEST FOR OUTPUT DEVICE
         BGE      REELNO1
ERR21    LI,R1    21                ERROR 21
         BAL,SR4  ERROR
         B        RETURN
*
DEVICE2  CI,R6    8                 TEST FOR INPUT DEVICE
         BLE      REELNO1
         LI,R1    19                ERROR-ILLEGAL INPUT DEVICE
         B        ERR21+1
*
REELNO1  LI,R1    DEVICE+1          EDIT DEVICE/REEL NO. COMBINATION
         LI,R2    1
         BAL,SR3  TESTARG
*
         LI,R1    FILE              EDIT DEVICE/FILE COMBINATION
         LI,R2    2
         BAL,SR3  TESTARG
*
         LI,R1    CODE              EDIT DEVICE/CODE COMBINATION
         LW,R2    CODE,R7
         AI,R2    2
         BAL,SR3  TESTARG
*
         LI,R3    16
         LI,R4    MODE+MODE+MODE+MODE  BYTE DISP OF MODE TABLE
MODE3    LB,R2    *R7,R4
         LI,R1    PRTBUF
         STW,R2   *R7,R1            SET CODE IN FULL WORD FOR TESTARG
         AI,R2    8
         BAL,SR3  TESTARG
         AI,R4    1
         BDR,R3   MODE3
*
         LI,R1    SEQUENCE          EDIT DEVICE/SEQUENCE COMBINATION
         LW,R2    SEQUENCE,R7
         CI,R2    3                 CS OR LN
         BL       MODE2             NO
         MTW,0    SEQUENCE+3,R7     WAS INCREMENT SPECIFIED
         BEZ      ERR47             NO - ERROR
MODE2    AI,R2    25
         BAL,SR3  TESTARG
*
         LI,R1    SELECT            EDIT DEVICE/SELECT COMBINATION
         LI,R2    30
         BAL,SR3  TESTARG
*
         LW,R2    MODE+2,R7         EDIT PK/BIN/7T COMBINATION
         CI,R2    5
         BE       SET%BIN
         CI,R2    6
         BNE      RETURN       NOT PACKED OR UNPACKED.
SET%BIN  EQU      %
         LW,R2    =X'02000000'
         STW,R2   MODE,R7
         LW,R2    MODE+1,R7
         CI,R2    3
         BANZ     RETURN
ERR28    LI,R1    28                ERROR 28
         BAL,SR4  ERROR
         B        RETURN
ERR47    LI,R1    47                ZERO INCREMENT ON CS OR LN OPTION
         B        ERR28+1
*
TESTARG  LW,R1    *R7,R1            GET ID CODE OF ARGUMENT
         BEZ      *SR3
         LW,R1    EDITBL-1,R2       LOCATE DEFINING BIT FOR COMBINATION
         SLS,R1   -1,R6
         CI,R1    0                 TEST FOR LEGAL COMBINATION
         BL       *SR3
         LI,R1    X'FF'             GET ERROR CODE FOR COMBINATION
         AND,R1   EDITBL-1,R2
         BAL,SR4  ERROR
         B        *SR3
*
RETURN   LCI      7                 RESTORE REGISTERS
         PLM,R5   *R7
         B        *SR4
*
*                                                          E
EDITBL   DATA     X'1E780016',X'3AE80017',X'F8E00018',X'FFFF8018'
*                      C           H           A           X
         DATA     X'FEF98018',X'BEF90018',X'7EF88018',X'00060018'
*                     BCD         BIN          7T          9T
         DATA     X'86190019',X'96590019',X'16580019',X'16580019'
*                      PK         UPK         SSP         DSP
         DATA     X'16580019',X'06180019',X'00060019',X'00060019'
*                     VFC          NC          FA         NFA
         DATA     X'00060019',X'00FF8019',X'00E00019',X'00E00019'
*                      TX         DEOD         K           CR
         DATA     X'00FF8019',X'04000019',X'00060019',X'00FF8019'
*                     EXP
         DATA     X'00E00019'
*                     NCS         NLN
         DATA     X'00FF801A',X'00E0001A'
*                      CS          LN         R.S.    RD/WR/EX/UN
         DATA     X'00FF801A',X'00E0001A',X'FE00001B',X'00E00019'
*                     BLK         REC         FMT         CAT
         DATA     X'00080019',X'00080019',X'00080019',X'02000019'
*                     DEN
         DATA     X'16580019'
         END

