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 

Parameterize Dataset Name

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL)
View previous topic :: View next topic  
Author Message
jayram99
Beginner


Joined: 16 Aug 2004
Posts: 52
Topics: 21
Location: falls church.va,usa

PostPosted: Tue Sep 23, 2014 7:06 am    Post subject: Parameterize Dataset Name Reply with quote

Hi All,

We recive SAS Dataset every month and need to copy the SAS file to a GDG.

Every Month we recieve similar file with Dataset Name at the End with MYYYYMM.

Ex :
Code:

XXX.YYY.ABC00840.SASFILE.M201407
XXX.YYY.ABC00840.SASFILE.M201408
XXX.YYY.ABC00840.SASFILE.M201409

Please advise how to parameterize the Hardcoded YYYYMM Dataset Name.

Below is IEBGENER Utility to copy SAS Dataset stored in Tape to copy to GDG to store in SYSDA.

Code:

//JS10    EXEC IEBGENER,
//            ENV=&ENV
//SYSUT1   DD DSN=XXX.YYY.ABC00840.SASFILE.M201407,
//            DISP=(SHR,KEEP,KEEP)
//SYSUT2   DD DSN=&ENV.XXX.XYZA5560.SASFILE.GDGCOPY(+1),
//            UNIT=SYSDA,
//*           DCB=(RECFM=FS,BLKSIZE=FB,DSORG=PS),
//            SPACE=(TRK,(12000,1250),RLSE),
//            DISP=(NEW,CATLG,DELETE)




Appreciate your Kind Help.

We have SYNCSORT Utility not DFSORT and tried different options advised by
Kolusu but somehow getting JCL Errors.
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
kolusu
Site Admin
Site Admin


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

PostPosted: Tue Sep 23, 2014 10:46 am    Post subject: Reply with quote

jayram99,

Please SEARCH before posting. Check this link which explains about having current date in the dataset name

http://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
jayram99
Beginner


Joined: 16 Aug 2004
Posts: 52
Topics: 21
Location: falls church.va,usa

PostPosted: Mon Oct 13, 2014 3:20 pm    Post subject: Reply with quote

I am posting again the question, so that it will help someone who is looking for the original question.

Hi Kolusu,

Need your Help.

We will receive Trigger File (ENV.TRIGGER.FILE) and This Trigger file(ENV.TRIGGER.FILE) has a value which will a file name like(ABC.PROD.INPUT.FILE.M201410).
This file(ABC.PROD.INPUT.FILE.M201410) changes every 1/2 months. How to read Dataset(ABC.PROD.INPUT.FILE.M201410) as an input
in our JCL?

The JCL will call COBOL/SAS Program to proces the Dataset(ABC.PROD.INPUT.FILE.M201410)

Appreciate your Help.

----------------------------------------------------------------------------

The file name inside the ENV.TRIGGER.FILE will be changing every time.
Code:

ABC.PROD.INPUT.FILE.M201410
ABC.PROD.INPUT.FILE.M201411
ABC.PROD.INPUT.FILE
ABC.PROD.INPUT.FILE.CURMON


I need to read the Input file automatically which is inside the ENV.TRIGGER.FILE.

I tried with IDCAMS UTILITY with REPRO option, It didn't work.

I don't know how to pass the read value from one step to the other step using JCL.

Thanks for your Help.
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
jayram99
Beginner


Joined: 16 Aug 2004
Posts: 52
Topics: 21
Location: falls church.va,usa

PostPosted: Mon Oct 13, 2014 10:00 pm    Post subject: Reply with quote

Hi Kolusu,

I tried with the below JCL(Taken one of your examples) and tried to pass the value in instream as an input to IEBGENER. Getting JCL Error.


Code:

000001 //SUBJOBA JOB  (8456000000,CW),
000002 //            'LQA RISK',
000003 //            CLASS=A,
000004 //            MSGCLASS=T,
000005 //            USER=WIDJXC,
000006 //            NOTIFY=WIDJXC
000007 //*
000008 //MYPROCS  JCLLIB ORDER=(EN19.WIDJXC.CNTL)
000009 //         INCLUDE MEMBER=SETVAL
000010 //JS20     EXEC PROC1
==MSG> IEFC642-F EXCESSIVE PARAMETER LENGTH IN THE SYMBOLIC PARAMETER 
=NOTE= \/SYSUT1    DD    DSN=&IN,
=NOTE= \/ DISP=(SHR,KEEP,KEEP)
==MSG> JED20200I DSN=&& ASSUMED                                       
==MSG> JED20368F TEMPORARY DATASET DOES NOT EXIST                     
000011 /*
000012 //JS10     EXEC PGM=SORT
000013 //SYSOUT   DD SYSOUT=*
000014 //SYMNAMES DD *
000015 //SORTIN   DD *
000016 RMK.CRA.PRA00840.SASFILE.M201409
000017 //SORTOUT  DD DSN=EN19.WIDJXC.CNTL(SETVAL),
000018 //            DISP=OLD
000019 //SYSIN    DD *
000020   SORT FIELDS=COPY
000021   OUTREC FIELDS=(C'//  SET IN=',1,32,80:X)
000022 /*

The Dataset EN19.WIDJXC.CNTL(SETVAL) value has
// SET IN=RMK.CRA.PRA00840.SASFILE.M201409


The Dataset EN19.WIDJXC.CNTL(PROC1) is as below
Code:

//PROC1   PROC
//*
//JS10    EXEC IEBGENER,
//            ENV='EN19.'
//SYSUT1   DD DSN=&IN,
//            DISP=(SHR,KEEP,KEEP)
//SYSUT2   DD DSN=EN19.WIDJXC.TEST.NEWFIL8,
//            DISP=(NEW,CATLG,DELETE),
//            UNIT=SYSDA,
//            SPACE=(TRK,(12000,1250),RLSE)

Appreciate your Help.

Thank you,
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
kolusu
Site Admin
Site Admin


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

PostPosted: Tue Oct 14, 2014 10:24 am    Post subject: Reply with quote

Jayaram99,

You need to learn to use code tags so that code is readable. Check this link which explains in detail about using code tags with example

http://www.mvsforums.com/helpboards/viewtopic.php?p=19031#19031

Coming to the requirement it is quite simple. If you understoood the problem, then it is already more than once here. All you need is to pick a file name from another file and submit the jcl.

Assuming that you want the first file listed in the trigger file as input file, use the following jcl

Code:

//STEP0100 EXEC PGM=SORT                                   
//SYSOUT   DD SYSOUT=*                                     
//SORTIN   DD DISP=SHR,DSN=ENV.TRIGGER.FILE                                 
//SORTOUT  DD SYSOUT=*                                     
//SYSIN    DD *                                             
  OPTION COPY,STOPAFT=1                                     
  OUTFIL REMOVECC,NODETAIL,BUILD=(80X),                     
  HEADER1=('//SUBJOBA JOB  (8456000000,CW),',/,             
           '//            ''','LQA RISK''',','/,           
           '//            CLASS=A,',/,                     
           '//            MSGCLASS=T,',/,                   
           '//            USER=WIDJXC,',/,                 
           '//            NOTIFY=WIDJXC',/,                 
           '//*',/,                                         
           '//JS10    EXEC IEBGENER',/,                     
           '//SYSUT1  DD DISP=SHR,DSN=',1,44,/,             
           '//SYSUT2  DD DSN=EN19.WIDJXC.TEST.NEWFIL8,',/, 
           '//           DISP=(NEW,CATLG,DELETE),',/,       
           '//           UNIT=SYSDA,',/,                   
           '//           SPACE=(TRK,(12000,1250),RLSE)',/, 
           '//*')                                           
//*


This will generate a JCL like this
Code:

//SUBJOBA JOB  (8456000000,CW),                         
//            'LQA RISK',                               
//            CLASS=A,                                 
//            MSGCLASS=T,                               
//            USER=WIDJXC,                             
//            NOTIFY=WIDJXC                             
//*                                                     
//JS10    EXEC IEBGENER                                 
//SYSUT1  DD DISP=SHR,DSN=ABC.PROD.INPUT.FILE.M201410   
//SYSUT2  DD DSN=EN19.WIDJXC.TEST.NEWFIL8,             
//           DISP=(NEW,CATLG,DELETE),                   
//           UNIT=SYSDA,                               
//           SPACE=(TRK,(12000,1250),RLSE)             
//*                                                     


Now if everything looks good, then change the sortout to point to INTRDR. It is as simple as that.
_________________
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
jayram99
Beginner


Joined: 16 Aug 2004
Posts: 52
Topics: 21
Location: falls church.va,usa

PostPosted: Sun Dec 08, 2019 11:01 pm    Post subject: Parameterize Dataset Name Reply with quote

Hi Kolusu,

We receive Files as below every week and The job should automatically pick the latest Dataset and copy to new Dataset.

The below Files are in TAPE.

Code:
ABC.DEF.D1191130
ABC.DEF.D1191207
ABC.DEF.D1191214
ABC.DEF.D1191221
ABC.DEF.D1191228
ABC.DEF.D1200104


The File ABC.DEF.D1 is appended with YYMMDD ----> DD is weekend(Sat) date. We are planning to run
on Monday by function DATE1 -2 to pick the previous Saturday.

With the Below command , we receive output with CCYY.

Code:

INREC IFTHEN=(WHEN=(1,8,CH,EQ,C'//SYSUT1'),OVERLAY=(29:DATE1-2,
                                C','))


The output of SYSUT1 is coming as below.

ABC.DEF.D120191107 and need to re-name the Dataset name by removing CC as below.
ABC.DEF.D1CCYYMMDD to ABC.DEF.D1YYMMDD

OR

Please advise if there is any function to capture previous weekend date if job is run Next Week( Sunday or Monday)


JCL is as below.

Code:

//JOBA51XX JOB  (2131000000,AB),
//            'PROC DATA',
//            CLASS=2,
//            MSGCLASS=T,
//            USER=CB1BTCH
//*
//*
//JS10    EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SYMNAMES DD *
//SORTIN   DD DATA,DLM=@@
//*
//JOBA51XX JOB  (2131000000,AB),
//            'PROC DATA',
//            CLASS=2,
//            MSGCLASS=T,
//            USER=CB1BTCH
//*
//JS20    EXEC IEBGENER
//SYSUT1   DD DSN=ABC.DEF.D1,
//            DISP=(SHR,KEEP,KEEP)
//SYSUT2   DD DSN=ABC.DEF.NEWFIL7,
//            DISP=(NEW,CATLG,DELETE),
//            UNIT=CART,
//            SPACE=(TRK,(12000,1250),RLSE)
@@
//SORTOUT  DD SYSOUT=(*,INTRDR),RECFM=FB
//SYSIN    DD *
  OPTION COPY
  INREC IFTHEN=(WHEN=(1,8,CH,EQ,C'//SYSUT1'),OVERLAY=(29:DATE1-2,
                                C','))
//*



OUTREC FIELDS=(1:1,28,29:31,7) - This didn't work as it does overlay entire subprogram JCL .

Please advise me .

Thanks for your help.
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Mon Dec 09, 2019 4:25 am    Post subject: Reply with quote

Is this JCL question or a sort question? The two things are not the same. And why is it tagged onto a 5 year old topic?
_________________
Utility and Program control cards are NOT, repeat NOT, JCL.
Back to top
View user's profile Send private message
jayram99
Beginner


Joined: 16 Aug 2004
Posts: 52
Topics: 21
Location: falls church.va,usa

PostPosted: Mon Dec 09, 2019 8:22 am    Post subject: Reply with quote

This topic was initiated by me 5 years ago and both are related. Thought of continuing .

Please let me know if you want to start new topic and it is not JCL Question and it should be part of UTILITIES Section.

Since it was already in JCL Section, I continued.

Thank you,
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
kolusu
Site Admin
Site Admin


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

PostPosted: Mon Dec 09, 2019 9:24 am    Post subject: Re: Parameterize Dataset Name Reply with quote

jayram99 wrote:

The File ABC.DEF.D1 is appended with YYMMDD ----> DD is weekend(Sat) date. We are planning to run
on Monday by function DATE1 -2 to pick the previous Saturday.

With the Below command , we receive output with CCYY.

Code:

INREC IFTHEN=(WHEN=(1,8,CH,EQ,C'//SYSUT1'),OVERLAY=(29:DATE1-2,
                                C','))


The output of SYSUT1 is coming as below.

ABC.DEF.D120191107 and need to re-name the Dataset name by removing CC as below.
ABC.DEF.D1CCYYMMDD to ABC.DEF.D1YYMMDD



Jayaram,

If your intention is to have to a 6 digit then you need to use the following control cards
Code:

//SYSIN    DD *                                 
  OPTION COPY                                   
  INREC IFOUTLEN=80,                           
        IFTHEN=(WHEN=(1,8,CH,EQ,C'//SYSUT1'),   
              OVERLAY=(81:DATE1-2,             
                       29:83,6,                 
                          C','))               
/*                                           


jayram99 wrote:

Please advise if there is any function to capture previous weekend date if job is run Next Week( Sunday or Monday)


DFSORT has PREVDday function which can be used to calculate the previous specified day for a date field. As a simple example, you could use the following to calculate the previous Saturday for a P'CCYYMMDD' date as a C'YYMMDD' date:

Code:

81,8,Y4T,PREVDSAT,TOGREG=Y2T 


The above will pick the prior Saturday date when this job runs on Mon - Sat. For example today is Monday December 9th and you can run this job from today till December 14th(Saturday( and it will show the date as 191207 which is a prior Saturday(December 7th). But if you run it on Sunday December 15th then it will show the date as 191214.

So the equivalent control cards are as follows
Code:

//SYSIN    DD *                                         
  OPTION COPY                                           
  INREC IFOUTLEN=80,                                   
        IFTHEN=(WHEN=(1,8,CH,EQ,C'//SYSUT1'),           
              OVERLAY=(81:DATE1,                       
                       29:81,8,Y4T,PREVDSAT,TOGREG=Y2T,
                          C','))                       
/*


PS: Why do you need a SPACE statement when you are writing to a CART aka tape?
_________________
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
jayram99
Beginner


Joined: 16 Aug 2004
Posts: 52
Topics: 21
Location: falls church.va,usa

PostPosted: Tue Dec 10, 2019 1:34 pm    Post subject: Reply with quote

Thanks Kolusu for all your help.

Jayaram
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL) 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