* CATALOG NO 704985-1  SIGMA 5/7 SORT             OVERLAY 1
*  VERSION C00
         SYSTEM   SIG7FDP
         SYSTEM   BPM
PGMSEG1  CSECT    0
*
         PAGE
*
         DEF      SIN315X,SIN33X,SIN35X,VGENX
         DEF      ZDCT,PDCT,ALFT,BNAV
         REF      F:SORTIN,F:SORTOUT
         REF      BCT0,FCT0
         REF      SPECRD,INPORD                            /SIG7-2254/*D4985
         REF      MASAD,WORK
         REF      KTT0,STT0
         REF      CNVRT,SEQLNG,SEQRCD
         REF      IN1,ID1,SD1
         REF      KRDSC
         REF       ZTRANA,ZTRAND,PTRANA,PTRAND
         REF      ATRANA,ATRAND,BNABSA,BNABSD
         REF      BNEBC,EBCBN
         REF      SLICE,SLICEFL                                        R
         REF      SC5
         REF      SINTMP,RLKCM,CALLSW
         REF      SIN1R
         REF      ENDSORT
         REF      KLNGC,RIT
         REF      KEYLOC
         REF      AX5M,BDACPR,BFACPR,BHACPR,BHCOM,ER2,KCOM,KSTRTC
         REF      MSREC,RLTMP,SCR3,SEQEND,SIN3R,SIN33,SIN33B
         REF      SREC,STORSAM,TOURN,TRAPEN,TRNIST,VGN03,VGN07,VGN09
         REF      VGN10,BMCOM
*
         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
PRAMLOC  EQU      SIN1R+1
BINEBC   EQU      BNEBC
*
         PAGE
*                                                                /VALUES
SKPFIL   DATA,4   0
KTMK     GEN,8,24 64,BA(KTT0)-1
*
         PAGE
*
KTRANI   DATA     0                 TRANS PARM 0 NO CARDS
SIN315X  RES      0
         AI,X7    9
         LI,6     ENDP11
         STW,6    ENDSORT           IN CASE OF ERROR
         LB,X6    *PRAMLOC,X7       TRANSLATION PARAMETER
         CI,X6    C'T'
         BE        SIN37             IT IS 'T'
         CI,X6    C'A'              NOT 'C'
         BNE      SIN33             NOT 'A'
         CI,X2    3
         BE       SIN32             BINARY IS LEGAL
         LI,RF    X'D'              ABSVAL MESSAGE
         BAL,R2   ER2
SIN32    AI,X2    4                 IT IS 'A'
         B        SIN33                RETURN TO P1
SIN33X   RES      0
         MTW,0    KEYLOC            1ST TIME THRU,WILL BE 0,INITLZE
         BNEZ     SIN33A
         STW,6    KEYLOC            IST KEY HIGH LOC
         B        SIN33B
SIN33A   CW,6     KEYLOC            CURR KEY VERSES PREV
         BLE      SIN33B
         STW,6    KEYLOC            HIGHER KEY, SO SAVE
         B        SIN33B               RETURN TO P1
SIN35X   RES      0
         LI,X5    0
         LW,R1    KTRANI            ARE TRANSLATION PARAMETERS REQUIRD
         BE       *SIN3R             NO:  EXIT
         LH,9     CALLSW,1          HAS TRANS TABLE BEEN BUILT
         BNEZ     *SIN3R           YES
          LW,R1    MASAD             PAGE MEMORY
         STW,R1   WORK
SIN35    BAL,R1    SPECRD
         LW,R1     *MASAD            HAVE ALL TRANSLATION PARAMETERS
         CW,R1    =C'!EOD'
         BE       *SIN3R
         LI,X5    16                NO:   CONTINUE
          LW,X6    *MASAD,X5         KTT0RELATIVE LOCATION
         SLS,X6    -8                RIGHT JUSTIFIED
         STW,X6   CNVRT
         BAL,R1   EBCBN             CONVERT TO BINARY
         LW,X7    CNVRT+1
         CI,X7    193
         BLE      SIN36
         LI,X7    7                 TRANS TABLE LOC ERR    /SIG7-1162/*C4986
         B        SC5               GO ABORT               /SIG7-1162/*C4986
*
SIN36    AW,X7    KTMK
         LW,X6    MASAD
         SLS,X6   2                 CONVERT SOURCE TO BYTE ADDRESS
         MBS,X6   0
         B        SIN35
*
*
SIN37    STW,X6   KTRANI
         CI,X2    3
         BL       SIN32
         LI,RF    X'C'              TRANSLATION ERROR MESSAGE
         BAL,R2   ER2
         B         SIN32
         PAGE
*
*
VGENX    RES      0
         LI,X1    1
         LH,X6    BCT0,X1
         AND,6    =X'FFFF'                                 /SIG7-4980/*F4985
         STW,6    FCT0+17
         LH,X6    BCT0+4            SORT MERGE RECORD LENGTH
         LH,2     BCT0+15           INPUT BYTE INCR
         CI,2     0
         BE       VGN0000
         AI,6     4
         B        %+2
VGN0000  RES      0
         AI,6     3                  PLUS 3                /SIG7-2254/*D4985
         STW,X6   SREC
         LW,X6    MASAD             MASS RECORD STORAGE ADDRESS
         STW,X6   MSREC
         LH,X6    BCT0+1,X1         NUMBER OF RECORDS IN TOURNAMENT
         STW,X6   TOURN
         STW,X6   RIT
         LI,X2    0                 STT0 INDEX
         LW,X7    BCT0+19           INPUT FILE'S DESCRIPTOR WORD
         LI,6     17                FCT ORDINATE
         BAL,X5   IN1               GO:  OPEN INPUT FILE
         B        VGN000                                               R
         LI,X7    13                FILE ALREADY OPEN      /SIG7-1162/*C4986
         B        SC5               GO ABORT               /SIG7-1162/*C4986
VGN000   RES      0
         LI,X6    3                                                    R
         LW,X7    *PRAMLOC,X6                                          R
         AND,X7   =X'FFFF'          CONVERT THE SIX DIGIT SLICE SIZE   R
         STW,X7   CNVRT                TO BINARY                       R
         BAL,R1   EBCBN                                                R
         LW,X7    CNVRT+1                                              R
         MI,X7    10000                                                R
         STW,X7   SLICE                                                R
         LI,X6    4                 GET LAST FOUR DIGITS               R
         LW,X7    *PRAMLOC,X6                                          R
         STW,X7   CNVRT                                                R
         BAL,R1   EBCBN                                                R
         LW,X7    CNVRT+1                                              R
         AWM,X7   SLICE                                                R
         BE       VGN00             NO SLICING                         R
         MTW,1    SLICEFL           SET SLICE FLAG                     R
VGN00    LI,X6    6
         LW,X7    *PRAMLOC,X6
         AND,X7   =X'FFFFFF'        CONVERT THE SIX DIGIT SKIP COUNT
         STW,X7   CNVRT                 TO BINARY
         BAL,R1   EBCBN             GO:  CONVERT EBCDIC TO BINARY
         LW,X7    CNVRT+1
         MI,X7    1000
         STW,X7   SKPFIL
         LI,X6    7
         LW,X7    *PRAMLOC,X6
         SLS,X7   -8
         STW,X7   CNVRT
         BAL,R1   EBCBN             GO:  CONVERT EBCDIC TO BINARY
         LW,X7    CNVRT+1
         AWM,X7   SKPFIL
         BE       VGN01             NO RECORDS TO SKIP
         LW,X6    SKPFIL            INCREMENT SLICE SIZE TO INCLUDE    R
         AWM,X6   SLICE             PASSED RECORDS                     R
VGN001   LI,6     17                FCT ORDINATE
         LI,X7    0                 SKIP THE REQUESTED NUMBER OF
         BAL,X5   ID1                   RECORDS
         MTW,15   SKPFIL
         BG       VGN001
*
         PAGE
*
VGN01    LI,6     17                FCT ORDINATE
         LW,X7    MSREC             RECORD'S ADDRESS IN MASS STORAGE
         SLS,X7   2                     AS A BYTE ADDRESS
         AI,7     8                  PLUS 2 WORDS          /SIG7-2254/*D4985
         LW,8     INPORD             CREATE LOW ORDER KEY  /SIG7-2254/*D4985
         STW,8    *MSREC,1                                 /SIG7-2254/*D4985
         BAL,X5   ID1               GO:  READ FIRST RECORD OF PAIR
         BAL,R1   VGN10
         STH,R0   RLTMP
         LI,X7    0
         STH,X2   X7                FIRST ENTRY ORDINATE AND
         SLS,X7   1                     RECORD'S MASS MEMORY ADDRESS
         AW,X7    MSREC                 INTO ONE WORD AND THEN
         STW,X7   *STT0,X2              INTO STT0
         AW,X7    SREC              ADDRESS OF SECOND RECORD OF THE
         STW,X7   *MSREC                PAIR INTO FIRST RECORD
         LC       FCT0+17
         BCR,R0   VGN07
         LW,X7    SREC              NO:  SET NEXT RECORD'S ADDRESS
         AWM,X7   MSREC                 INTO MSREC FOR SECOND READ
         LW,X7    MSREC
         SLS,X7   2
         AI,7     8                  PLUS 2 WORDS          /SIG7-2254/*D4985
         LW,8     INPORD            CREATE LOW ORDER KEY   /SIG7-2254/*D4985
         STW,8    *MSREC,1                                 /SIG7-2254/*D4985
         BAL,X5   ID1
         BAL,R1   VGN10
         STH,R0   RLTMP,X1
         LW,R0    RLTMP
         STW,R0   *MSREC            STORE RECORD LENGTH IS OF BOTH RECRD
         LW,X7    SREC
         AWM,X7   MSREC
         LC       FCT0+17
         BCR,R0   VGN09
         LW,X4    *STT0,X2          NO:  PREDICTED WINNER'S ADDRESS
         LW,X5    *X4                    PREDICTED LOSER'S ADDRESS
         BAL,R1   *KRDSC            GO,COMP REC ON KEYS    /SIG7-4137/*E4985
         BGE      VGN02             GO PREPARE FOR NEXT COMPARISON
         LW,X4    *STT0,X2          EXCHANGE RECORD ENTRIES
         LW,X5    0,X4              LOSER ADD--REALLY WINNER
         LW,X6    0,X5
         SCS,X6   16
         STW,X6   0,X4
         STW,X4   0,X5
         STW,X5   *STT0,X2
VGN02    MTW,1    X2
         MTW,14   TOURN             IS TOURNAMENT FULL
         BNE      VGN01             NO:   GO PROCESS NEXT PAIR
         LI,X3    0
         B        VGN03                RETURN TO P1
         PAGE
*
*
*  THIS REGION GENERATES THE CODE FOR ZONED DECIMAL KEYS
*       REQUIRING TRANSLATION.
*
ZDCTR    DATA     0
*
ZDCT     STW,X5   ZDCTR             SAVE RETURN ADDRES
         LI,X5    0
         BAL,R0   TRNIST           *LI,X6    0    LI,RA    0
         LD,RA    ZTRAN            *BAL,R0   ZTRANA/BAL,R0   ZTRAND
         BAL,R1   TRAPEN
         BAL,R0   AX5M              END OFF ROUTINE
         B        *ZDCTR            EXIT
*
*  THIS REGION GENERATES THE CODE FOR PACKED DECIMAL KEYS
*       REQUIRING TRANSLATION.
*
PDCTR    DATA     0
*
PDCT     STW,X5   PDCTR             SAVE RETURN ADDRESS
         LI,X5    0
         BAL,R0   TRNIST           *LI,X6    0    LI,RA     0
         LD,RA    PTRAN            *BAL,R0   PTRANA/BAL,R0   PTRAND
         BAL,R1   TRAPEN
         BAL,R0   AX5M
         B        *PDCTR
*
         PAGE
*
*  THIS REGION GENERATES THE CODE FOR ALPHANUMERIC KEYS
*       REQUIRING TRANSLATION
*
ALFTR    DATA     0
*
ALFT     STW,X5   ALFTR
         LI,X5    0
         BAL,R0   TRNIST           *LI,X6    0     LI,RA    0
         LD,RA    ATRAN            *BAL,R0   ATRANA/BAL,R0   ATRAND
         BAL,R1   TRAPEN
         BAL,R0   AX5M
         B        *ALFTR
*
         PAGE
*
*  THIS REGION GENERATES THE CODE FOR BINARY KEYS
*       TO BE SORTED ON THEIR ABSOLUTE VALUES.
*
BNAVR    DATA     0
*
BNAV     STW,X5   BNAVR             SAVE RETURN ADDRESS
         LI,X5    0                 INITIALIZE WORD COUNTER
         LW,X6    KSTRTC
         SLS,X6   -2                RELATIVE WORD POSITION
         STW,X6   SINTMP+2
         LI,X7    1
         AND,X7   KSTRTC            DOES KEY START ON A HALF/FULL WORD
         BNE      BNAV2             NO:  BYPASS SEQUENCE TEST/BOUNDARY
         LI,X7    1                 YES:  SEE IF THE KEY CONTAINS AN
         AND,X7   KLNGC                   EVEN NUMBER OF BYTES.
         BNE      BNAV2             NOT AN EVEN NUMBER OF BYTES
         LW,X7    KLNGC             AN EVEN NUMBER
         LI,X6    2
         AND,X6   KSTRTC            IS KEY ON A WORD BOUNDARY
         BNE      BNAV1             NO:  HALF WORD
         CI,X7    8                 IS KEY A DOUBLE-WORD KEY
         BE       BNAV4             YES:  DOUBLE-WORD
         CI,X7    4                 IS KEY A FULL-WORD KEY
         BE       BNAV5             YES:  FULL-WORD
BNAV1    CI,X7    2                 IS KEY A HALF-WORD KEY
         BE       BNAV6             YES:  HALF-WORD
*
         PAGE
*
*  THIS REGION GENERATES THE CODE FOR THOSE KEYS NOT MEETING THE
*       CRITERIA FOR A NATURAL HARDWARE SEQUENCE.
*
BNAV2    BAL,R0   TRNIST           *LI,X6    0      LI,RA      0
         LD,RA    BMACOM           *BAL,R0   BNABSA/BAL,R0     BNABSD
         BAL,R1   TRAPEN
         BAL,R0   AX5M
         B        *BNAVR
*
*  THIS REGION GENERATES CODE FOR DOUBLE-WORD KEYS.
*
BNAV4    LW,X6    BMCOM            *LCI     2
         BAL,R1   STORSAM
         LW,X6    SINTMP+2
         OR,X6    BDACOM           *LM,RC   0,X4
         BAL,R1   STORSAM
         LW,X6    BDACOM+1         *LM,RE   0,X5
         OR,X6    SINTMP+2          RELATIVE WORD POSITION
         BAL,R1   STORSAM
         LW,X6    BDACOM+2         *LAD,RA   RC
         BAL,R1   STORSAM
         LW,X6    BDACOM+3         *LAD,RC   RE
         BAL,R1   STORSAM
         LD,RA    BDACPR
         BAL,R1   TRAPEN
BNAV3    BAL,R0   SEQEND
         B        *BNAVR
*
*  THIS REGION GENERATES CODE FOR FULL-WORD KEYS.
*
BNAV5    LW,X6    BFACOM           *LAW,RA   0,X4
         OR,X6    SINTMP+2
         BAL,R1   STORSAM
         LW,X6    BFACOM+1         *LAW,RC   0,X5
         OR,X6    SINTMP+2
         BAL,R1   STORSAM
         LD,RA    BFACPR           CW,10    12   CW,12    10
         BAL,R1   TRAPEN
         B        BNAV3
*
*  THIS REGION GENERATES CODE FOR HALF WORD KEYS.
*
BNAV6    LW,X6    KSTRTC
         SLS,X6   -1
         STW,X6   SINTMP+2          HALF-WORD RELATIVE STARTING POSITION
         OR,X6    KCOM             *LI,X6    0
         BAL,R1   STORSAM
         LW,X6    BHACOM           *LAH,RA   *X4,X6
         BAL,R1   STORSAM
         LW,X6    BHACOM+1         *LAH,RC   *X5,X6
         BAL,R1   STORSAM
         LD,RA    BHACPR           *CH,RA     RC /CH,RC     RA
         BAL,R1   TRAPEN
         B        BNAV3
*
         PAGE
*
*
*
*
*
*
*  THE FOLLOWING PAGES CONTAIN THE SKELETON KEY COMPARISON SEQUENCES
*       GENERATED BY SIN3 AND THE TABLES FROM WHICH THEY ARE CREATED.
*
*  ALL THE SEQUENCES ASSUME THAT ENTRY IS MADE VIA A BAL,R1     AF(1)
*       WITH THE FOLLOWING REGISTERS SET AS:
*        REGISTER:  4=THE WORD ADDRESS OF THE PREDICTED WINNER
*                   5=THE WORD ADDRESS OF THE PREDICTED LOSER
*
*  ON EXIT FROM THIS SEQUENCE:
*        REGISTER:  4 IS UNCHANGED
*                   5 IS UNCHANGED
*                   CONDITION CODE 4=1 IF AN EXCHANGE IS NECESSARY
*                                   =0 IF AN EXCHANGE IS NOT NECESSARY
*  THE SPECIFIC SEQUENCES FOLLOW:
*
         PAGE
*
*
*  THIS IS THE SKELETON COMPARISON SEQUENCE GENERATED FOR ZONED
*       DECIMAL KEYS.REQUIRING NO TRANSLATION.
*
* ODD
*   ASCENDING SEQUENCE   DESCENDING SEQUENCE
*
*        LI,X6    0           LI,X6    0      AF(1)=REL BYTE LOC OF KEY
*        PACK,0   *X4,X6      PACK,0   *X5,X6 CF(2)=KEY LENGTH IN BYTES
*        BCS,8    DECTRP      BCS,8    DECTRP
*        DST,0    DECSAV      DST,0    DECSAV CF(2)=KEY LENGTH IN BYTES
*        PACK,0   *X5,X6      PACK,0   *X4,X6 CF(2)=KEY LENGTH IN BYTES
*        BCS,8    DTRPN       BCS,8    DTRPE  SEE NOTE BELOW
*        DC,0     DECSPV      DC,0     DECSAV CF(2)=KEY LENGTH IN BYTES
*        BCS,8    DTRPE       BCS,8    DTRPN
*        DC,0     DECSAV      DEC,0    DECSAVE  CF(2)=KEY LENGTH IN BYTES
*        BE       %+2         BCR,X3   %+2    GO TO NEXT SEQUENCE
*        BNE      *R1         BCS,X3   *R1    EXIT IF NOT EQUAL
* EVEN
*
*
*        LI,6     0          LI,6     0   (LENGTH)
*        LI,7     0          LI,7     0   (LENGTH)
*        BAL,8    DEVSTP     BAL,8    DEVSTP
*        BAL,8    EVDEA (ASC)BAL,8    EVDED (DESC)
*        BCR,3    %+2        BCR,3    %+2
*        BCS,3    *9         BCS,3    *9
*
*  THIS IS THE SKELETON COMPARISON SEQUENCE GENERATED FOR PACKED
*       DECIMAL KEYS REQUIRING NO TRANSLATION.
*
*   ASCENDING SEQUENCE   DESCENDING SEQUENCE
*
*        LI,X6    0           LI,X6    0      AF(1)=REL BYTE LOC OF KEY
*        DL,0     *X5,X6      DL,0     *X4,X6 CF(2)=KEY LENGTH IN BYTES
*        BCS,8    DTRPN       BCS,8    DTRPE
*        DC,0     *X4,X6      DC,0     *X5,X6 CF(2)=KEY LENGTH IN BYTES
*        BCS,8    DTRPE       BCS,8    DTRPN
*        BE       %+2         BCR,X3   %+2    GO TO NEXT SEQUENCE
*        BNE      *R1         BCS,X3   *R1    EXIT IF NOT EQUAL
*
         PAGE
*
*  THIS IS THE SKELETON COMPARISON SEQUENCE GENERATED FOR ZONED
*       DECIMAL KEYS REQUIRING KEY TRANSLATION.
*
*   ASCENDING SEQUENCE   DESCENDING SEQUENCE
*
*        LI,X6    0           LI,X6    0      AF(1)=KEY LENGTH
*        LI,RA    0           LI,RA    0      AF(1)=KEY DISPLACEMENT
*        BAL,R0   ZTRANA      BAL,R0   ZTRAND
*                                             RETURN HERE IF KEYS ARE
*                                             EQUAL--OTHERWISE EXIT.
*
*
*  THIS IS THE SKELETON COMPARISON SEQUENCE GENERATED FOR PACKED
*       DECIMAL KEYS REQUIRING KEY TRANSLATION.
*
*   ASCENDING SEQUENCE   DESCENDING SEQUENCE
*
*        LI,X6    0           LI,X6    0      AF(1)=KEY DISPLACEMENT
*        LI,10    0           LI,10    0      AF(1)=KEY DISPLACEMENT
*        BAL,R0   PTRANA      BAL,R0   PTRAND
*                                             RETURN HERE IF KEYS ARE
*                                             EQUAL--OTHERWISE EXIT.
*
*
         PAGE
*
*  THIS IS THE SKELETON COMPARISON SEQUENCE GENERATED FOR ALPHANUMERIC
*       KEYS REQUIRING NO TRANSLATION
*
*   ASCENDING SEQUENCE   DESCENDING SEQUENCE         PARTIAL WORD KEYS
*
*        LI,X7    0           LI,X7    0      PART WORD MASK
*        LW,X6    0,X5        LW,X6    0,X4   AF(1)=REL WORD LOC OF KEY
*        CS,X6    0,X4        CS,X6    0,X5   AF(1)=REL WORD LOC OF KEY
*        BE       %+2         BCR,X3   %+2    GO TO NEXT SEQUENCE
*        BNE      *R1         BCS,X3   *R1    EXIT IF NOT EQUAL
*
*
*  THIS IS THE SKELETON COMPARISON SEQUENCE GENERATED FOR ALPHANUMERIC
*       KEYS REQUIRING KEY TRANSLATION.
*
*   ASCENDING SEQUENCE   DESCENDING SEQUENCE
*
*        LI,X6    0           LI,X6    0      AF(1)=KEY LENGTH
*        LI,RA    0           LI,RA    0      AF(1)=KEY DISPLACEMENT
*        BAL,R0   ATRANA      BAL,R0   ATRAND
*                                             RETRUN HERE IF KEYS ARE
*                                             EQUAL--OTHERWISE EXIT
*
         PAGE
*
*  THIS IS THE SKELETON COMPARISON SEQUENCE GENERATED FOR BINARY
*       KEYS TO BE SORTED IN ALGEBRAIC SEQUENCE.  EACH BINARY KEY
*       IS EXAMINED TO DETERMINE WHETHER OR NOT IT FULLFILLS THE
*       REQUIREMENTS FOR USE OF NATURAL HARDWARE COMMANDS IN ITS
*       COMPARISON.  THESE REQUIREMENTS ARE:
*                1.  THE BEGINNING BYTE OF THE KEY MUST FALL ON A  HALF-
*                    HALF-WORD OR ON A WORD BOUNDARY AND THE KEY   WORD
*                    MUST BE EXACTLY 2 BYTES IN LENGTH, OR,        CRI-
*                                                                  TERIA
*                2.  THE BEGINNING BYTE MUST FALL ON A WORD BOUND- FULL-
*                    ARY AND THE KEY MUST BE EXACTLY 4 BYTES IN    WORD
*                    LENGTH, OR                                    CRI-
*                                                                  TERIH
*                3.  THE BEGINNING BYTE MUST FALL ON A WORD BOUND- DOUB-
*                    ARY AND THE KEY MUST BE EXACTLY 8 BYTES IN    LE-
*                    LENGTH--THE SEQUENCE CANNOT ASSUME THAT THE   WORD
*                    KEY BEGINS ON A DOUBLE-WORD BOUNDARY.         CRI-
*                                                                  TERIA
         PAGE
*
*  THIS IS THE SKELETON COMPARISON SEQUENCE GENERATED FOR BINARY
*       KEYS MEETING THE HALF WORD CRITERIA
*
*   ASCENDING SEQUENCE   DESCENDING SEQUENCE         HALF-WORD KEYS
*
*        LI,X6    0           LI,X6    0      AF(1)=REL H-W LOC OF KEY
*        LH,RA    *X5,X6      LH,RA    *X4,X6 LOAD PREDICTED LOSER
*        CH,RA    *X4,X6      CH,RA    *X5,X6 COMPARE WITH PARTMER
*        BCR,3    %+2         BCR,3    %+2    GO TO NEXT SEQUENCE
*        BNE      *R1         BCS,X3   *R1    EXIT IF NOT EQUAL
*
*   ASCENDING SEQUENCE   DESCENDING SEQUENCE         FULL-WORD KEYS
*
*        LW,RA    0,X5        LW,RA    0,X4   AF(1)=REL WORD LOC OF KEY
*        CW,RA    0,X4        CW,RA    0,X5   AF(1)=REL WORD LOC OF KEY
*        BCR,3    %+2         BCR,3    %+2    GO TO NEXT SEQUENCE
*        BNE      *R1         BCS,X3   *R1    EXIT IF NOT EQUAL
*
*   ASCENDING SEQUENCE   DESCENDING SEQUENCE         DOUBLE-WORD KEYS
*
*        LCI      2           LCI      2      SET CONDITIONS FOR LM
*        LM,RA    0,X5        LM,RA    0,X5   LOAD PREDICTED LOSER
*        LM,RC    0,X4        LM,RC    0,X4   LOAD PREDICTED WINNER
*        CD,RA    RC          CD,RC    RA     COMPARE KEYS
*        BCR,3    %+2         BCR,3    %+2    GO TO NEXT SEQUENCE
*        BNE      *R1         BCS,X3   *R1    EXIT IF NOT EQUAL
*
*  ALL ALGEBRAIC BINARY KEYS NOT MEETING THE CRITERIA (1--3  ABOVE)
*       FOR DIRECT HARDWARE SEQUENCES WILL BE COMPARED AS SHOWN
*       BELOW.
*
*   ASCENDING SEQUENCE   DESCENDING SEQUENCE         MISCELLANEOUS SIZES
*        LI,X6    0           LI,X6    0      BYTE COUNT
*        LI,RA    0           LI,RA    0      SOURCE BYTE DISPLACEMENT
*        BAL,R0   BNCMPA      BAL,R0   BNCMPD GO COMPARE KEYS
*                                             RETURN HERE IF KEYS ARE
*                                             EQUAL--OTHERWISE EXIT
*
*       NOTE:  BYTE COUNT OCCUPIES THE LOW ORDER 8 BITS OF REGIS-
*              TER 6 AND SOURCE BYTE DISPLACEMENT OCCUPIES THE LOW
*              ORDER 19 BITS OF REGISTER RA (10).
*
         PAGE
*
*  THIS IS THE SKELETON COMPARISON SEQUENCE GENERATED FOR BINARY
*       KEYS TO BE SORTED ON THEIR ABSOLUTE VALUES.  KEYS IN THIS
*       CATEGORY ARE GROUPED ACCORDING TO THE SAME CRITERIA AS
*       THEIR ALGEBRAIC COUNTERPARTS.
*
*
*   ASCENDING SEQUENCE   DESCENDING SEQUENCE         HALF-WORD KEYS
*
*        LI,X6    0           LI,X6    0      AF(1)=REL H-W LOC OF KEY
*        LAH,RA   *X4,X6      LAH,RA   *X4,X6
*        LAH,RC   *X5,X6      LAH,RC   *X5,X6
*        CH,RC    RA          CH,RA    RC
*        BE       %+2         BCR,X3   %+2
*        BNE      *R1         BCS,X3   *R1
*
*   ASCENDING SEQUENCE   DESCENDING SEQUENCE         FULL-WORD KEYS
*
*        LAW,RA   0,X4        LAW,RA   0,X4    AF(1)=REL WORD LOC OF KEY
*        LAW,RC   0,X5        LAW,RC   0,X5    AF(1)=REL WORD LOC OF KEY
*        CW,RC    RA          CW,RA    RC
*        BE       %+2         BCR,X3   %+2
*        BNE      *R1         BCS,X3   *R1
*
*   ASCENDING SEQUENCE   DESCENDING SEQUENCE         DOUBLE WORD KEYS
*
*        LCI      2           LCI      2
*        LM,RC    0,X4        LM,RC    0,X4    AF(1)=REL WORD LOC OF KEY
*        LM,RE    0,X5        LM,RE    0,X5    AF(1)=REL WORD LOC OF KEY
*        LAD,RA   RC          LAD,RA   RC
*        LAD,RC   RE          LAD,RC   RE
*        CD,RC    RA          CD,RA    RC
*        BE       %+2         BCR,X3   %+2
*        BNE      *R1        BCS,X3   *R1
*
*  THOSE BINARY KEYS NOT FITTING INTO ONE OF THE PREVIOUS CATEGORIES
*     WILL BE COMPARED AS SHOWN BELOW.
*
*   ASCENDING SEQUENCE   DESCENDING SEQUENCE         MISCELLANEOUS SIZES
*
*        LI,X6    0           LI,X6    0       AF(1)=KEY LENGTH
*        LI,RA    0           LI,RA    0       AF(1)=REL BYTE LOC OF KEY
*        BAL,R0   BNABSA      BAL,R0   BNABSD
*                                              RETURN HERE IF KEYS ARE
*                                              EQUAL --OTHERWISE EXIT
*
         PAGE
*
         BOUND    8
ZTRAN    BAL,R0   ZTRANA
         BAL,R0   ZTRAND
*
PTRAN    BAL,R0   PTRANA
         BAL,R0   PTRAND
*
*
ATRAN    BAL,R0   ATRANA
         BAL,R0   ATRAND
*
*
BHACOM   LAH,RA   *X4,X6
         LAH,RC   *X5,X6
*
BFACOM   LAW,RA   0,X4
         LAW,RC   0,X5
*
BDACOM   LM,RC    0,X4
         LM,RE    0,X5
         LAD,RA   RC
         LAD,RC   RE
*
BMACOM   BAL,R0   BNABSA
ENDP11   RES      0
         BAL,R0   BNABSD
*
         PAGE
*
         END

