                                 
                                                             Print transactions program
                                                             by Roberto Sancho Nov 2020
                                 
                                                             tapes input:
                                                                           09 program
                                                                           01 transactions tape created in Run 02/03/04/05
                                                                   output
                                                                           02 tansactions to print on ctc
                                                                   on line print:
                                                                              (only 4 words filled with data)
                                                                              label of input tape(s) 
                                                                              66 0..0 NNN | A 0..0 predecessor code | sucesor code
                                                                              55                                    | pred code    | successor code   
                                 
                                                                              NNN=number of transaction
                                                                              A=card code
                                 
                                                             stops: IC: 01693 (00 61 0000 0000 1696) -> unrecoverable read error
                                                                    IC: 01718 (00 61 1721 0000 1727) -> unrecoverable write error
                                 
                                                                    IC: 00001 (00 61 0000 0000 0000) -> finished ok. 
                                 
                                                             Switch 74 set to off      -> output is printed on online printer 1
                                                                              transfer -> output is written in tape 2
                                 
                                                             Input tape tape transaction record (as written by Run02) for tape 02 successors
                                 
                                                             w1 = A RS PR 0 PPPPPPPPP 0      A=card code PPP=predecessor code, RS=Res.Rate, PR=Pref.Rate
                                                             w2 = TE
                                                             w3 = SIGMA
                                                             w4 = 55 00 00 SSSSSSSSS R       R=report code
                                                             w5 
                                                             w6 
                                                             w7 = SCHEDL 000000 TSTS         TSTS=Schedulled completition time, SCHEDL=Schedulled date (format mm dd yy)
                                 
                                                             Input tape transaction record (as written by Run02) for tape 03 predecessors
                                 
                                                             w1 = A RS PR 0 PPPPPPPPP 0      A=card code PPP=predecessor code, RS=Res.Rate, PR=Pref.Rate
                                                             w2 
                                                             w3 
                                                             w4 = 66 xx xx SSSSSSSSS R       R=report code
                                                             w5 = TE
                                                             w6 = SIGMA
                                                             w7 = SCHEDL xx xxxx TSTS        TSTS=Schedulled completition time, SCHEDL=Schedulled date (format mm dd yy)
                                 
                                                             in input tape transaction are grouped in blocks. Max 28 transaction (7 words each)
                                                             per block -> max block size = 7*28=196 words
                                  
                                 
                                 
                                                                                          init
                                 
0008 00 57 0000 0000 0000   0008        57                                           Clear M4 M6 M8
0009 09 98 0000 0000 0000            09 98                                           rewind tape 09 program
0010 00 60 1217 1206 0000               TR       ZERO        TRCOUNT
0011 01 94 1215 1215 0000            01 94       TEMP1       TEMP1       0000        read tape 01 label
0012 00 68 0012 0000 1991               68       *                       REREAD      if tape check Call Re-read
0013 00 80 1215 0001 0000               80       TEMP1       0001                    print label for tape 1
0014 00 80 1217 0002 0000               80       ZERO        0002
0015 00 80 0000 0003 0000               80                   0003
0016 00 80 0000 0004 0000               80                   0004
0017 00 80 0000 0005 0000               80                   0005
0018 00 80 0000 0006 0000               80                   0006
0019 00 81 1217 0007 0000               81       ZERO        0007                    print
                                 
                                                                                          read block from input tape
                                 
0020 01 94 1001 0000 0000   RB-INBUF 01 94       INBUF       0000                    read input block buffer  
0021 00 68 0021 0000 1991               68       *                       REREAD      if tape check Call Re-read
0022 00 67 0000 0000 0075               67                               END         if end of file transfer to end of input transactions       
0023 00 60 0000 1215 0000               TR                   TEMP1                   Temp1=start of block xx xx aaaa bbbb xxxx
0024 04 42 0000 1224 1216            04 MASK                 FIELD-S     TEMP2       Temp2=bbbb=02 90 aaaa bbbb nnnn maked with 0000 0000 1111 0000 -> 0000 0000 bbbb 0000, then shift 4 right to get 0..0 bbbb
0025 08 42 1215 1223 0000            08 MASK     TEMP1       FIELD-R                 REG1=02 90 aaaa bbbb nnnn maked with 0000 1111 0000 0000 -> 0000 aaaa 0000 0000, then shift 8 right to get 0..0 aaaa 
0026 00 41 1216 0000 0000               SUB      TEMP2             
0027 00 40 0000 1218 1201               ADD                  ONE         BL-INBUF    BL-INBUF=Block Len from Input Transaction=bbbb-aaaa+1
0028 00 41 1220 0000 0000               SUB      N196                                check Block Len from Input Transaction
0029 00 63 0031 0031 0000               TR SGN   LSPL3       LSPL3                   transfer if 196 or less
0030 00 61 0000 0000 0000               STOP                                         stop because input transaction in tape 02 or 03 too big (max 196w, that holds 28 transactions of 7w
0031 00 60 1217 1202 0000   LSPL3       TR       ZERO        NW-INBUF                NW-INBUF=Number of words already processed from Input Transaction block
0032 00 60 0000 0000 0033               TR                               RR-INBUF    goto process first transaction record in block
                                                                                          end of split phase
                                 
                                                                                          read transaction record from from input tape block 
                                 
0033 00 41 1201 1202 0000   RR-INBUF    SUB      BL-INBUF    NW-INBUF                REG1=words left to be read in input transact block. 
0034 00 63 0036 0020 0000               TR SGN   LRR1        RB-INBUF                If no words left, go to read next block
0035 00 61 0000 0000 0000               STOP                                         Safety: stop because overflowing block rec
0036 96 60 1202 0000 0000   LRR1     96 TR       NW-INBUF                            Shift num words read into field S
0037 00 40 1229 0000 0038               ADD      SETM-OP                 LRR2        set instr to ...
0038 00 00 0000 0000 0000   LRR2        00       0000        0000        0000        ... clear modif and set M6=NW-INBUF, M8=NW-OUTBUF
0039 00 60 7001 5208 0000   LRR3        TR       INBUF   +M6 W1      +M4             copy from input tranasction block to rec w1..w7
0040 00 50 0000 0001 0000               50       0000        0001        0000        ... incr M6
0041 00 58 0001 0007 0039               58       0001        0007        LRR3        ... incr M4, loop
0042 00 40 1202 1219 1202               ADD      NW-INBUF    N7          NW-INBUF    Number of words read from block += 7
                                 
                                                                                          get transaction successor/predecessor code to print
                                             
0043 00 40 1206 1218 1206               ADD      TRCOUNT     ONE         TRCOUNT     incr total count of transactions 
0044 00 60 1217 1204 0000               TR       ZERO        CODE1
0045 00 60 1217 1205 0000               TR       ZERO        CODE2
0046 00 42 1211 1222 1215               MASK     W4          E55         TEMP1
0047 00 40 0000 1206 1207               ADD                  TRCOUNT     TRSSPP
0048 00 70 1215 1222 0052               TR EQ    TEMP1       E55         LSSCODE   
0049 00 42 1208 1227 1204   LPPCODE     MASK     W1          TR-FIELD    CODE1       
0050 00 42 1211 1227 1203               MASK     W4          TR-FIELD    CODE        predecessor transasc: code to sort
0051 00 60 0000 0000 0054               TR                               LPPQQ0
0052 00 42 1208 1227 1203   LSSCODE     MASK     W1          TR-FIELD    CODE        successor transasc: code to sort
0053 00 42 1211 1227 1205               MASK     W4          TR-FIELD    CODE2   
0054 00 42 1208 1221 0000   LPPQQ0      MASK     W1          E10                     get card code
0055 00 40 1204 0000 1204               ADD      CODE1                   CODE1       put card code in code1
0056 00 72 1203 1217 0058   LPPQQ1      TR NEQ   CODE        ZERO        LPPQQ2
0057 00 60 1221 1203 0000               TR       E10         CODE 
0058 00 72 1205 1217 0060   LPPQQ2      TR NEQ   CODE2       ZERO        LPPQQ3
0059 00 60 1221 1205 0000               TR       E10         CODE2 
0060 00 60 0000 0000 0061   LPPQQ3      TR                               PRT-TR
                                             
                                                                                          print transaction 
                                 
0061 00 80 1207 0001 0000   PRT-TR      80       TRSSPP      0001
0062 00 80 1204 0002 0000               80       CODE1       0002
0063 00 80 1203 0003 0000               80       CODE        0003
0064 00 80 1205 0004 0000               80       CODE2       0004  
0065 00 80 1217 0005 0000               80       ZERO        0005
0066 00 74 0000 0000 0069               74                               SAVE-TAP    if switch 74 set to transfer, goto save to output tape
0067 00 81 1217 0006 0000               81       ZERO        0006
0068 00 60 0000 0000 0033               TR                               RR-INBUF
                                 
0069 02 91 0001 0004 0000   SAVE-TAP 02 91       0001        0004                    write to tape
0070 08 60 0070 0000 1992            08 60       *                       CHKWRT      Call check Write
0071 00 60 0000 0000 0033               TR                               RR-INBUF
                                 
0072 02 91 0000 0000 0000   END-TAP  02 91       0000        0000                    write end of tape   
0073 08 60 0073 0000 1992            08 60       *                       CHKWRT      Call check Write
0074 00 60 1228 0001 0001               TR       STOP-OP     0001        0001        set stop in 0001, transfer to 0001: sucessfull program end                             
                                 
0075 00 74 0000 0000 0072   END         74                               END-TAP     if switch 74 set to transfer, goto save to output tape
0076 00 60 1228 0001 0001               TR       STOP-OP     0001        0001        set stop in 0001, transfer to 0001: sucessfull program end                             
                                 
                                 
1000 00 00 0000 0000 0000   1000                                                     variables
                                 
                                 
1001 00 00 0000 0000 0000   INBUF       RES      200                                 block read from input tape 02 or 03
                                 
1201 00 00 0000 0000 0000   BL-INBUF                                                 block length
1202 00 00 0000 0000 0000   NW-INBUF                                                 Number of words read from block
                                 
1203 00 00 0000 0000 0000   CODE                                                     predecessor/succesor code as control word for sort
1204 00 00 0000 0000 0000   CODE1
1205 00 00 0000 0000 0000   CODE2
                                 
1206 00 00 0000 0000 0000   TRCOUNT                                                  count of transactions to sort
1207 00 00 0000 0000 0000   TRSSPP
                                 
1208 00 00 0000 0000 0000   W1                                                       input transaction record                                                   
1209 00 00 0000 0000 0000   W2
1210 00 00 0000 0000 0000   W3
1211 00 00 0000 0000 0000   W4
1212 00 00 0000 0000 0000   W5
1213 00 00 0000 0000 0000   W6
1214 00 00 0000 0000 0000   W7
                                 
1215 00 00 0000 0000 0000   TEMP1
1216 00 00 0000 0000 0000   TEMP2
                                 
1217 00 00 0000 0000 0000   ZERO     00 00       0000        0000        0000
1218 00 00 0000 0000 0001   ONE      00 00       0000        0000        0001
1219 00 00 0000 0000 0007   N7       00 00       0000        0000        0007
1220 00 00 0000 0000 0196   N196     00 00       0000        0000        0196
                                 
1221 10 00 0000 0000 0000   E10      10 00       0000        0000        0000
1222 55 00 0000 0000 0000   E55      55 00       0000        0000        0000
                                 
1223 00 00 1111 0000 0000   FIELD-R  00 00       1111        0000        0000
1224 00 00 0000 1111 0000   FIELD-S  00 00       0000        1111        0000  
1225 00 00 0000 0000 1111   FIELD-T  00 00       0000        0000        1111
1226 00 00 0000 0001 0000   ONE-S    00 00       0000        0001        0000
1227 00 00 0011 1111 1110   TR-FIELD 00 00       0011        1111        1110               
                                 
1228 00 61 0000 0000 0000   STOP-OP  00 61       0000        0000        0000        stop opcode
1229 00 57 0000 0000 0000   SETM-OP  00 57       0000        0000        0000        clear M468 and set M468 opcode
1230 00 60 0000 0000 0000   NOP-OP   00 60       0000        0000        0000        
                                 
1990 00 00 0000 0000 0000   1990                                                     Library
                                 
                                                                                          Re-read routine. if error persist then stop 
                                                               
1991 00 61 0000 0000 1991   REREAD      STOP                             REREAD      if read error, stop    
                                 
                                                                                          Check write routine. 
                                 
1992 00 40 1996 0000 1994   CHKWRT      ADD      MK-TR60                 LCHKEX      set and save exit transfer
1993 00 68 0000 0000 1995               68                               LCHK1       if tape check goto lchk1
1994 00 00 0000 0000 0000   LCHKEX      00                                           if no tape chek, return to caller
1995 00 61 0000 0000 1995   LCHK1       STOP                             LCHK1       if write error, stop 
1996 00 59 9999 9140 0001   MK-TR60  00 59       9999        9140        0001   
                                      
