MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Dataset name with a workday.

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
ramy2016
Beginner


Joined: 18 Apr 2016
Posts: 46
Topics: 14

PostPosted: Thu Apr 25, 2024 1:09 pm    Post subject: Dataset name with a workday. Reply with quote

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.

Code:
//STEPZ    EXEC PGM=ICEMAN 
//SYSOUT   DD SYSOUT=*     
//SYMNAMES DD *             
WKD,S'&LWDAY'               
//SORTIN   DD *             
SMPL                       
//SORTOUT  DD SYSOUT=*     
//SYSIN    DD *             
  SORT FIELDS=COPY         
  INREC BUILD=(WKD)         
//*                         
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12367
Topics: 75
Location: San Jose

PostPosted: Fri Apr 26, 2024 12:34 am    Post subject: Reply with quote

ramy2016,

You have been member for a long time and yet you cannot follow simple rules of searching before posting.

Check this link which shows you how to created a dataset with current date.

https://www.mvsforums.com/helpboards/viewtopic.php?t=2101
_________________
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
ramy2016
Beginner


Joined: 18 Apr 2016
Posts: 46
Topics: 14

PostPosted: Fri Apr 26, 2024 12:22 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12367
Topics: 75
Location: San Jose

PostPosted: Fri Apr 26, 2024 7:09 pm    Post subject: Reply with quote

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 - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
ramy2016
Beginner


Joined: 18 Apr 2016
Posts: 46
Topics: 14

PostPosted: Mon Apr 29, 2024 12:31 pm    Post subject: Reply with quote

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?

Code:
//STEP1    EXEC PGM=ICEMAN
//SYSOUT   DD SYSOUT=*     
//SYMNAMES DD *             
WKD,S'&LWDAY'               
//SORTIN   DD *             
SMPL                       
//SORTOUT  DD DSN=MY.WDAY.SYMBOL,DISP=(NEW,CATLG,CATLG),DCB=(RECFM=FB,LRECL=20,...     
//SYSIN    DD *             
  SORT FIELDS=COPY         
  INREC BUILD=(C'//WKLD SET WKDAY=',WKD)         
//* 
//STEP2    EXEC  PGM=ICEMAN                             
//SYSOUT   DD  SYSOUT=*                                 
//SORTIN DD DSN=MY.WDAY.SYMBOL,DISP=SHR           
//SORTOUT DD DSN=PDS.MEMBER(WKDAY1),       
//           DISP=(OLD,CATLG,DELETE),                   
//           SPACE=(TRK,(1,1,1)),UNIT=SYSDA             
//SYSIN DD *                                           
  OPTION COPY                                           
  OUTREC FIELDS=(1,20,60X)                             
//*                                                     
//STEP3    EXEC PROC1
.....................

//PROC1 PROC
// INCLUDE MEMBER=WKDAY1         
//*---------------------------------
//SYSUT1   DD DSN=DATA.NAME
//SYSUT2   DD DSN=DATA.NAME&WKDAY
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12367
Topics: 75
Location: San Jose

PostPosted: Mon Apr 29, 2024 5:06 pm    Post subject: Reply with quote

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 - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
ramy2016
Beginner


Joined: 18 Apr 2016
Posts: 46
Topics: 14

PostPosted: Tue Apr 30, 2024 7:57 am    Post subject: Reply with quote

Thank you kolusu, I've been thinking the same - run PDS member update first, followed by a Proc logic. And thanks for combining my two steps into one.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
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


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group