Make your own free website on Tripod.com
DocBag

Back Issue

Symbol Substitution for batch jobs with DFSORT

With new functions added via PTF in April 2006, support has been added to DFSORT to support substitution of system symbols into output files created by SORT.

One possible use is to create JCL containing system symbols. This is an example reworked from an early Stupid JCL trick:

//S1 EXEC SORT //SYMNAMES DD * sysname,S'&SYSNAME' jobname,S'&JOBNAME' yymmdd,S'&LYYMMDD' //SORTIN DD DATA,DLM=## //ALLOCDD JOB (accting),USER,.... //S1 EXEC PGM=IEFBR14 //DD1 DD DISP=(,CATLG),UNIT=DISK,SPACE=(TRK,(5,2)), // DSN=# ## //SORTOUT DD SYSOUT=(A,INTRDR),RECFM=F,BLKSIZE=80,BUFNO=1,LRECL=80 //SYSIN DD * SORT FIELDS=COPY INREC IFTHEN=(WHEN=(4,5,CH,EQ,C'DSN=#'), OVERLAY=(8:C'&SYSUID..',jobname,C'.D',yymmdd,C'.DATA')) // The generated dataset name will contain the system name, job name of the submitting job and the current local date. Note that &SYSUID will only be substituted when job ALLOCDD executes.

Other uses

The same DFSORT feature could be used to create log file entries containing jobname, date and time for the current job. For example, //S1 EXEC SORT //SYMNAMES DD * jobname,S'&JOBNAME' yymmdd,S'&LYYMMDD' hhmmss,S'&LHHMMSS' //SORTIN DD * Log entry //SORTOUT DD DISP=MOD,DSN=log.dataset //SYSIN DD * SORT FIELDS=COPY OUTREC=(1,10,jobname,X,yymmdd,X,hhmmss) The entry appended to the log dataset will contain the job name, date and time for the executing batch job.

For more information on this and other new features introduced at the same time, see User Guide for DFSORT PTFs UK90007 and UK90006 (SORTPEUG).

Feedback

Comments or suggestions can be sent to the author.

Last Month's Issue

Big Iron