** CBL.CTL(SSIN1) *** L=003 --- 2016/03/04 10:49:37 (L05) * * Routine to execute sequential input on dataset containing keys. * SSCHKEQU and SSIN1EQU equates are a pre-requisite. * ==INKEYS== * Read input sequential data set. * * If this is the first time INKEYS is called following an XRST restart * then the position within the input data set at the time of the * checkpoint is recovered. This is done using the input record count * in the work area buffer which was restored following the checkpoint * restart. * * Otherwise, the next input record is read and the input record count * field is incremented. if pos chkpf ones chk_xrst_on * If a restart. then @xxi1 = in1rn_L at in1rn type=b * Set #recs at CHKP. else @xxi1 = 1 * Otherwise #recs = 1. pos in1rn = x'0000,0000' stopaft=1 * Init record count once. ==INKEYS_loop== * Loop sequential read of input data set. read IN1 into in1ra nordw * Read next input record. ** On restart, verify end-of-file hasn't occurred before #recs = 1. if eof IN1 * If end-of-file... and @xxi1 > 1 * ...and more recs reqd. then pos chker, chker+chker_L-1 = \ ' CHKP/XRST ERR901: Restart IN1 unexpected end-of-file.' then print from chker, chker+54 type=s * Print error text. then space * Blank line. then goto eoj * Force end-of-job. add 1 to in1rn_L at in1rn type=b * Increment record count. if @xxi1 > 1 * Target #recs read? then @xxi1 = @xxi1-1 * Reduce #recs by 1. then goto INKEYS_loop * Get next record. *INKEYS_loop_end* ** On restart, verify the input key matches that saved before the CHKP. if pos chkpf ones chk_xrst_on * If a restart... and pos chkky <> in1ky_L at in1ra+in1ky * ...and keys don't match. then pos chker, chker+chker_L-1 = \ ' CHKP/XRST ERR902: Restart IN1 key changed since CHKP.' then print from chker, chker+54 type=s * Print error text. then pos chker, chker+chker_L-1 = \ ' Expected key: "' then @pr = chker+21 then pos @pr = chkky_L at chkky !then @pr = @pr+chkky_L then pos @pr = '"' !then @pr = @pr+01 then print from chker, @pr-01 type=s * Print error text. then pos chker, chker+chker_L-1 = \ ' Actual key: "' then @pr = chker+21 then pos @pr = in1ky_L at in1ra+in1ky !then @pr = @pr+in1ky_L then pos @pr = '"' !then @pr = @pr+01 then print from chker, @pr-01 type=s * Print error text. then space * Blank line. then goto eoj * Force end-of-job. else pos chkky = in1ky_L at in1ra+in1ky * Save current key. *INKEYS_end* return