Posted: Thu Apr 25, 2024 1:09 pm Post subject: Dataset name with a workday.
Hello,
I'm trying to append current day to the end of some datasets, need to do that daily.
Extracting the current day with this DFSORT job, but cannot pass the output further down to either a Proc or to next job steps, getting a jcl error.
Would appreciate a solution by using either DFSORT or any other means.
Thank you kolusu for the link, I did searched but what I've found had limited options. For ex. I've already done dataset rename using internal reader, but this time it's a large number of files and if something goes wrong in a middle, there's no way restarting it, unless I do rename and intrdr submission separately for each dataset, which is messy. So I was hoping for a more "flexible" approach where each function has its own step, and I'd determine a current day at the beginning and then pass it, possible through a symbolic, to all subsequent steps.
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
Posted: Fri Apr 26, 2024 7:09 pm Post subject:
ramy2016 wrote:
Thank you kolusu for the link, I did searched but what I've found had limited options. For ex. I've already done dataset rename using internal reader, but this time it's a large number of files and if something goes wrong in a middle, there's no way restarting it, unless I do rename and intrdr submission separately for each dataset, which is messy. So I was hoping for a more "flexible" approach where each function has its own step, and I'd determine a current day at the beginning and then pass it, possible through a symbolic, to all subsequent steps.
ramy2016,
Not sure why you think is messy? The above link is translating the symbols using System symbol translator. It will WORK all the time.
if you still insist , then create a PDS member with WDAY symbol and then use that as INCLUDE Member which sets it as a symbol. Look in the JCL reference manual about INCLUDE which shows the use of the SET statement to assign values _________________ Kolusu
www.linkedin.com/in/kolusu
kolusu, I created this job which sets WDAY symbol to a DSN, and then updates PDS member from it and sets a
symbolic for a Proc. But something is off, let's say I ran it on Friday last time, so my PDS member = //WKLD SET WKDAY=FRI
and today is Monday. As I ran it on Monday, Step1 and Step2 ran, setting WDAY to MON, but the Proc in STEP3 still used FRI for dataset rename.
Could you, please, suggest what needs to be changed?
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
Posted: Mon Apr 29, 2024 5:06 pm Post subject:
ramy2016 wrote:
But something is off, let's say I ran it on Friday last time, so my PDS member = //WKLD SET WKDAY=FRI
and today is Monday. As I ran it on Monday, Step1 and Step2 ran, setting WDAY to MON, but the Proc in STEP3 still used FRI for dataset rename.
Could you, please, suggest what needs to be changed?
ramy2016,
You need to realize that JES resolves the INCLUDE members when you submit it, So it is picking up the last value that catalog shows and it does NOT pick the new updated member after the job is run.
Why are you running this step along with your regular job? Moreover why do you need 2 steps to create the symbol? You just need a single step.
1. Run this as a stand alone job once every day before your batch window starts.
Code:
//GENSYM JOB MSGCLASS=H,MSGLEVEL=(1,1),CLASS=A,NOTIFY=&SYSUID
//***************************************************************
//* Create a symbol to set the weekday *
//***************************************************************
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SYMNAMES DD *
WKD,S'&LWDAY'
//SORTIN DD *
//SORTOUT DD DISP=OLD,DSN=Your.PDS.inlcude(WKDAY1)
//SYSIN DD *
OPTION COPY
OUTFIL REMOVECC,NODETAIL,BUILD=(80X),
HEADER1=('//DAYOFWK SET WKDAY=''',WKD,'''')
//*
Now that symbol is available for ALL of your batch jobs which run after this
JOB1 thru n
Code:
//JOB1 JOB MSGCLASS=H,MSGLEVEL=(1,1),CLASS=A,NOTIFY=&SYSUID
// JCLLIB ORDER=(your.proclib, << expands your proc
// Your.PDS.inlcude) << includes the weekday
//*
// INCLUDE MEMBER=WKDAY1
//*
//SUB001 EXEC MYPROC
If you want to test out , you can manually edit the PDS member WKDAY1 and change it to a different value and then submit the job1 with TYPRUN=SCAN so that you can see how the symbols are translated and the job is not executed. _________________ Kolusu
www.linkedin.com/in/kolusu
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum