问题
I need to run a job on the first work day of the month with accounting data for the month-end close(previous month) to be used in some year end jobs. I would like to run the same job each month, with no operator intervention and have the closing month and year in the dataset name so it will be easily identifiable for what closing period the dataset was ceated. Currently run 8 separate jobs to accomplish this task. Please provide specific JCL samples.
回答1:
It's not clear why you are running 8 separate job to accomplish this task, what does each job do?
Are you using any scheduler to run the job at a specific time?
You can use EZACFSM1 to use system symbolic paramters to add date/time information to dataset names.
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IEA1E241/2.2.2
回答2:
The best solution for this is to use the features of your job scheduler. Having said that...
Here is a more recent reference for EZACFSM1. OS/390 2.10 hasn't been current for over a decade.
However, you cannot just use this utility to create a dataset with date/time information in its name. EZACFSM1 simply reads from SYSIN and writes to SYSOUT, interpreting the system symbols it reads.
You could use EZACFSM1 to write an ALTER statement for IDCAMS, renaming a statically named dataset (one without the year and month in it) to one that has those attributes. It does require two additional steps, and a caveat.
//CATLG EXEC PGM=IEFBR14
//DD01 DD DISP=(NEW,CATLG),
// DSN=STUFF,
// AVGREC=U,
// LRECL=80,
// RECFM=FB,
// SPACE=(80,(1000,100))
//*
//MKALTER EXEC PGM=EZACFSM1
//SYSOUT DD DISP=(NEW,PASS),
// AVGREC=U,
// LRECL=80,
// RECFM=FB,
// SPACE=(80,(1000,100))
//SYSIN DD *
ALTER STUFF NEWNAME(STUFF.Y&YR4&MON)
//*
//RENAME EXEC PGM=IDCAMS
//SYSIN DD DISP=(OLD,PASS),DSN=*.MKALTER.SYSOUT
//SYSPRINT DD SYSOUT=*
//*
The caveat has to do with job scheduling. Let's say your job runs late on the last day of the month. If it sits in the input queue long enough, it will run on the first day of the next month, making the ALTER incorrect.
来源:https://stackoverflow.com/questions/13297788/jcl-for-previous-month-year-in-dataset-name