Some day I designed a large ASSEMBLER program which needed to read some QSAM
files, and I soon discovered that the out-of-line branches imposed by the EODAD
processing violated the clean structure of the program, because the input logic
of the many files which were read in parallel was somehow complicated. If, for
example, you deal with VSAM instead of QSAM, you have very natural return code
handling after each GET macro call, which allows structured programming, using
SP (structured programming) macros, for example.
To solve this problem, I ended up with a GET routine for every QSAM dataset,
where the EODAD address is part of the routine. The GET routine looked like this
(from memory, I don't have the sources at hand):
GET1 PSTART (R10,R14) start macro for local procedure
GET DATASET1 get record from dataset
XR R15,R15 set eof rc to zero
LR R5,R1 move record address to reg 5
LEAVE , success, leave proc (comma VERY important!!)
EOF1 DS 0H = EODAD address of DATASET1
LA R15,8 end of file, set eof rc to 8
GET1Z PSTOP (R10,R14) end macro for local procedure
so the EODAD branch is hidden in the GET-ROUTINE.
In our shop, we tell the developer to write ASSEMBLER modules without B or J
instructions. All control flow is done using SP macros, which have been
developed or at least improved inhouse in the past 35 years (I don't know the
beginning of the history, because I'm with this company since 1988 "only").
Kind regards
Bernd
|