|
SELCOPY
Examples Menu
A file of JCL statements, OLDJCL, needs modification to numerous DSN
fields, all of which are on the first line of the DD card. The file REPJCL
contains just DD cards which are in any sequence, and any match of any DD
name in OLDJCL must be substituted with the appropriate record from REPJCL.
Other records are to remain unchanged, and the file NEWJCL is to be
created.
SELCOPY treats lower case as upper case unless in 'quotes', the Exclamation
Mark is a Line End Character, and the following abbreviations are used:
w worklen p pos l lrecl t then fr from wr write
//SELC5BLD JOB (0414OSVBT00),CLASS=A,
// MSGCLASS=X,MSGLEVEL=(1,1)
//ALTER EXEC PGM=SELCOPY
//SYSPRINT DD SYSOUT=*
//OLDJCL DD DSN=SELC5.OS.JCL(P7077),DISP=SHR
//REPJCL DD DSN=SELC5.DSN.JCL3,DISP=SHR
//NEWJCL DD DSN=SELC5.OS.JCL(P7077A),DISP=SHR
//SYSIN DD *
option w=80000 * Large workarea.
equ ARRAY 4001 * Store area for REPJCL recs.
equ ARRAYEND 79900 * End of array.
@ = ARRAY * Set @ ptr to start of array.
==LOOP1== * Once only * Read whole of Base Data Set into an array.
read REPJCL into @ * Read into array elem.
if eof REPJCL
then @END = @ * Save ptr to end of array.
then goto LOOP1E * Go read 2nd file.
@ = @+80 * Add 80 to @ ptr.
if @ > ARRAYEND * If array is full.
then goto cancel
goto LOOP1
=LOOP1E= * LOOP1 end *
==LOOP2== *(Main Loop)*
read OLDJCL * Read 2nd input file.
if eof OLDJCL !t eoj * Go to successfull End-of-Job.
* Match this OLDJCL record against all REPJCL records
* using substitute record for output where appropriate.
if p ARRAY+2,@END = 8 at 3 step=80 * Scan for DDNAME match.
then wr NEWJCL fr @-2 * If same DD, use Substitute.
else wr NEWJCL fr 1 * Write out orig record.
goto LOOP2 * To read next record.
=LOOP2E= * LOOP2 end * (Unreferenced label.)
In the above SELCOPY control cards, use is made of both the standard
@ pointer and a user @ pointer which for convenience we have chosen to call
@END.
The @ ptr is invaluable in giving a fixed reference point to a previously
undefined position in your work area. It can be set either explictly by the
assignment @ = 20 for instance, or implicitly by a successful range test.
e.g. IF P 20 30 = ABC STEP=1 where STEP indicates the increment over the
range for each subsequent compare. (STEP=1 is actually the default and
needn't be coded)
Offsets may be obtained by coding @+n or @-n, where n is the offset
required.
|