Copying data

By default, the DSC (Data Set Copy) function simply copies the contents of one data set to another (using DFSORT if available). The following excerpt from a batch job enhances the DSC function to:

⋮
//DDIN     DD DSN=HFMUSER.HFMAFDAT.SAMPMVS,DISP=SHR
//DDOUT    DD DSN=HFMUSER.HFMAFDAT.SAMP02,DISP=SHR
//OUT01    DD DSN=HFMUSER.HFMAFDAT.SAMP01,DISP=SHR
//SYSIN    DD *
$$FILEM DSC INPUT=DDIN,
$$FILEM     PROC=*
*FASTPROC
 INCLUDE COND=(1,2,CH,EQ,C'02',OR,1,2,CH,EQ,C'01')
 OUTFIL FNAMES=DDOUT,INCLUDE=(1,2,CH,EQ,C'02')
 OUTREC=(SEQNUM,6,ZD,1,74)
 OUTFIL FNAMES=OUT01,INCLUDE=(1,2,CH,EQ,C'01')
*REXXPROC
 outrec = change(outrec,'Grant Smith','Fred Bloggs')
 /* Print the first 10 output records in hex */
 if prtcount() < 10 then print(outrec,'hex')
 if fld(1,2) == '01' then do
   tally(27,4,'P','Salary Total')
   tally(31,4,'B','Total Month 1 Payment')
 end
/+
/*
⋮