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 

Date in JCL.

 
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
Meg
Beginner


Joined: 08 Jul 2003
Posts: 44
Topics: 16

PostPosted: Tue Jul 08, 2003 3:06 am    Post subject: Date in JCL. Reply with quote

Hi people,

I need to find out if there is any method to determine the current date in a JCL on which the job is going to be run and pass that value as one the DSN qualifier.

Meg.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Tue Jul 08, 2003 6:17 am    Post subject: Reply with quote

Meg,

Does your shop has any job scheduling packages available? If so you will be able to achieve appending the date as a DSN qualifier.Another alternative is to create the file and rename the file with the current date using SORT/IKJEFT01

Hope this helps...

cheers

kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
ofer71
Intermediate


Joined: 12 Feb 2003
Posts: 358
Topics: 4
Location: Israel

PostPosted: Tue Jul 08, 2003 6:21 am    Post subject: Reply with quote

Meg -

I did something like this in two steps:
1 - Run REXX to generate a member that includes the desired DSN with current date.
2 - The second step uses the 'INCLUDE' statement, that includes the member generated in previous step.

O.
________
Free Wordpress Themes


Last edited by ofer71 on Thu Mar 17, 2011 10:33 am; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail
Meg
Beginner


Joined: 08 Jul 2003
Posts: 44
Topics: 16

PostPosted: Tue Jul 08, 2003 6:21 am    Post subject: Reply with quote

Hi Kolusu,

Yes, in our case the job is is scheduled by CA7 scheduler. Can you please let me know how this is done. Also I want to know about the alternative method too. I would like to know how can we get the current date sing SORT/IKJEFT01.

Regards,
Meg
Back to top
View user's profile Send private message
Cogito-Ergo-Sum
Advanced


Joined: 15 Dec 2002
Posts: 637
Topics: 43
Location: Bengaluru, INDIA

PostPosted: Tue Jul 08, 2003 8:14 am    Post subject: Reply with quote

Ofer,
I had similar ideas as yours. Only, I was thinking in terms of DFSORT. This is what I was using.

Code:

//X        JCLLIB ORDER=SOME.TEMP.PDS
//STEP1    EXEC PGM=ICETOOL
//TOOLIN   DD *
 COPY FROM(IN01) TO(T1)   USING(CPY1)
 COPY FROM(T1)   TO(OT01) USING(CPY2)
/*
//IN01     DD *

/*
//T1       DD DSN=&&TEMP0001,
//            DISP=(,PASS)
//OT01     DD DSN=SOME.TEMP.PDS(DATE),
//            DISP=OLD
//CPY1CNTL DD *
 OUTREC FIELDS=(DATE1,80:X)
/*
//CPY2CNTL DD *
 OUTREC FIELDS=(C'//DDNAME  DD DSN=HLQ.MLQ.D',3,6,C',',80:X)
/*
//TOOLMSG  DD SYSOUT=*
//DFSMSG   DD SYSOUT=*
//*
//STEP2    EXEC PGM=IEFBR14
//INC      INCLUDE MEMBER=DATE
//            DISP=(,CATLG,DELETE),
//            DCB=(LRECL=80,RECFM=FB,DSORG=PS,BLKSIZE=27920),
//            UNIT=SYSDA,
//            SPACE=(TRK,1)


In the above code, the first step will write a JCL record as
Code:

//DDNAME  DD DSN=HLQ.MLQ.Dyymmdd,


This will be included for the IEFBR14 step in the second step for allocation. Of course, step 2 can be anything.

I did not post for the following reasons.

    For a non-existing member DATE, it seems, a new member by the name of DATE is not being allocated. Hence, in IEFBR14 the INCLUDE is not getting expanded.

    For an existing member DATE, I get a message saying, expected continuation not recieved.


What am I missing?
_________________
ALL opinions are welcome.

Debugging tip:
When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
-- Sherlock Holmes.
Back to top
View user's profile Send private message
Alain Benveniste
Beginner


Joined: 04 May 2003
Posts: 92
Topics: 4
Location: Paris, France

PostPosted: Tue Jul 08, 2003 11:48 am    Post subject: Reply with quote

Cogito,

In fact it's quiet simple.
As you know the INCLUDE statement requires a member that must exist
in the JCLLIB. This library has to be catalogued.
When you submit the JCL, all the cards are interpreted before execution.
It means that the member must be found and what you have in must respond to the JCL requirements. That's why you have a JCL ERROR at the first submit. This abend is typically representative of an unresolved jCL statement. In other words, it means that unfortunally the DFSORT step
can't be executed, so the member is not found.
Now if you only submit the first step, then the second, it would work if you put all the step in the member. If not the JCL interpreter don't find the coma after DATE...
Even you do this you have to take care of one thing : the name of the file you will create with IEFBR14 is NOT the image of what you think there is in the member DATE.
Test this : submit the both steps, modify by hand the DSN you have created in the member. Re-submit the entire JCL; go and see what the interpreter has done. You will surprised.
The conclusion : you have to submit two jcl one after the other.

Alain Wink


Last edited by Alain Benveniste on Tue Jul 08, 2003 3:43 pm; edited 1 time in total
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Tue Jul 08, 2003 2:46 pm    Post subject: Reply with quote

Meg,
The following DFSORT/ICETOOL job will give you the desired results.If you have syncsort at your shop change the pgm name to SYNCTOOL.A brief explanation of the job.I am assumingng that your dsn name is "YOUR DSN NAME". Now this dataset will be created as
"YOUR DSN NAME.DMMDDYY". you cannot have a number as starting qualifier. so the for the date I used the alphapet D followed by 2 digit month followed by 2 digit day followed by 2 digit year.The first copy step takes in the system date in the format (MM/DD/CCYY) format and writes it to temp dataset. The second copy operator takes in the temp date file and creates rename cards as follows.

Code:

 REN 'YOUR DSN NAME' -               
     'YOUR DSN NAME.D070803'   


Now the above rename cards can be used as sysin cards for IKJEFT01. see step0200 for the jcl which will actually rename the dataset with current date.


Code:

//STEP0100 EXEC PGM=ICETOOL                                           
//*                                                                   
//TOOLMSG   DD SYSOUT=*                                               
//DFSMSG    DD SYSOUT=*                                               
//NULL      DD *                                                       
//DATE      DD DSN=&D,DISP=(,PASS),SPACE=(TRK,(1,1),RLSE)             
//OUT       DD DSN=&R,DISP=(,PASS),SPACE=(TRK,(1,1),RLSE),RECFM=FB     
//TOOLIN    DD *                                                       
 COPY FROM(NULL) USING(CTL1)                                           
 COPY FROM(DATE) USING(CTL2)                                           
//CTL1CNTL  DD *                                                       
 OUTFIL FNAMES=DATE,HEADER1=(DATE=(MD4/))                             
//CTL2CNTL  DD *                                                       
 OUTFIL FNAMES=OUT,                                                   
 OUTREC=(C' REN ',X'7D',C'YOUR DSN NAME',X'7D',C' -',/,         
         5X,X'7D',C'YOUR DSN NAME',C'.D',2,2,5,2,10,2,X'7D',80:X)
/*                                                                     
//STEP0200 EXEC PGM=IKJEFT01           
//*                                   
//SYSTSPRT DD SYSOUT=*                 
//SYSTSIN  DD DSN=&R,DISP=OLD         
//*                                   


Method:2

Another alternative is to create a job on the fly and submit to the intrdr which will create the dataset.

Code:

//STEP0100 EXEC PGM=ICETOOL                                           
//*                                                                   
//TOOLMSG   DD SYSOUT=*                                               
//DFSMSG    DD SYSOUT=*                                               
//NULL      DD *                                                       
//DATE      DD DSN=&D,DISP=(,PASS),SPACE=(TRK,(1,1),RLSE)             
//OUT       DD SYSOUT=(*,INTRDR),RECFM=FB                             
//TOOLIN    DD *                                                       
 COPY FROM(NULL) USING(CTL1)                                           
 COPY FROM(DATE) USING(CTL2)                                           
//CTL1CNTL  DD *                                                       
 OUTFIL FNAMES=DATE,HEADER1=(DATE=(MD4/))                             
//CTL2CNTL  DD *                                                       
 OUTFIL FNAMES=OUT,                                                   
 OUTREC=(C'//TXXXXXXZ JOB ',X'7D',C'CREATE DSN',X'7D',C',CLASS=A,',/, 
         C'//',13X,C'MSGCLASS=Y,MSGLEVEL=(1,1),',/,                   
         C'//',13X,C'NOTIFY=T-I-D',/,                                 
         C'//*',/,                                                     
         C'//STEP010  EXEC PGM=IEFBR14',/,                             
         C'//SYSPRINT DD SYSOUT=*',/,                                 
         C'//FILE1    DD DSN=YOUR DSN NAME',C'.D',2,2,5,2,10,2,C',',/,   
         C'//            DISP=(NEW,CATLG,DELETE),',/,                 
         C'//            UNIT=SYSDA,',/,                               
         C'//            SPACE=(CYL,(X,Y),RLSE),',/,                   
         C'//            DCB=(LRECL=ZZZ,RECFM=FB,BLKSIZE=0)',/,       
         C'//*',80:X)                                                 
/*   


The output from this job will be as follows:

Code:

//TXXXXXXZ JOB 'CREATE DSN',CLASS=A,                 
//             MSGCLASS=Y,MSGLEVEL=(1,1),             
//             NOTIFY=T-I-D                       
//*                                                   
//STEP010  EXEC PGM=IEFBR14                           
//SYSPRINT DD SYSOUT=*                               
//FILE1    DD DSN=YOUR DSN NAME.D070803,               
//            DISP=(NEW,CATLG,DELETE),               
//            UNIT=SYSDA,                             
//            SPACE=(CYL,(X,Y),RLSE),                 
//            DCB=(LRECL=ZZZ,RECFM=FB,BLKSIZE=0)     
//*                               


Hope this helps...

cheers

kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Tue Jul 08, 2003 4:33 pm    Post subject: Reply with quote

If you have DFSORT, you can use the following alternate versions of Kolusu's ICETOOL jobs. These jobs only use one COPY operator instead of two. They use DFSORT Symbols to make it easier to specify and change your data set name. The second job also uses DFSORT Symbols for the IEFBR14 JCL statements to make them easier to specify and change. TRAILER1 with DATENS=(MDY) is used instead of HEADER1 with DATE=(MDY/) so we don't have to generate and remove the /.

First DFSORT/ICETOOL job:

Code:

//STEP0100 EXEC PGM=ICETOOL
//SYMNAMES DD *
DSN,C'YOUR.DSN.NAME'
QT,C''''
QTD,C''' -'
//TOOLMSG   DD SYSOUT=*
//DFSMSG    DD SYSOUT=*
//NULL      DD *
//OUT       DD DSN=&R,DISP=(,PASS),SPACE=(TRK,(1,1),RLSE)
//TOOLIN    DD *
COPY FROM(NULL) USING(CTL1)
//CTL1CNTL  DD *
  OUTFIL FNAMES=OUT,
    REMOVECC,NODETAIL,
    TRAILER1=(C' REN ',QT,DSN,QTD,/,
         C'   ',QT,DSN,C'.D',DATENS=(MDY),QT)
/*
//STEP0200 EXEC PGM=IKJEFT01
//SYSTSPRT DD SYSOUT=*
//SYSTSIN  DD DSN=&R,DISP=OLD
//*


&R will contain:

Code:

 REN 'YOUR.DSN.NAME' -
   'YOUR.DSN.NAME.D070803'


To change the data set name, just change the DSN symbol in SYMNAMES.

Second DFSORT/ICETOOL job:

Code:

//STEP0100 EXEC PGM=ICETOOL
//SYMNAMES DD *
DSN,'YOUR.DSN.NAME'
J1,'//TXXXXXXZ JOB ''CREATE DSN'',CLASS=A,'
J2,'//  MSGCLASS=Y,MSGLEVEL=(1,1),'
J3,'//  NOTIFY=T-I-D'
J4,'//STEP010  EXEC PGM=IEFBR14'
J5,'//SYSPRINT DD SYSOUT=*'
J6,'//FILE1 DD DSN='
J7,'//  DISP=(NEW,CATLG,DELETE),'
J8,'//  UNIT=SYSDA,'
J9,'//  SPACE=(CYL,(X,Y),RLSE),'
J10,'//  LRECL=ZZZ,RECFM=FB,BLKSIZE=0'
J11,'//*'
QT,C''''
QTC,C''','
//TOOLMSG   DD SYSOUT=*
//DFSMSG    DD SYSOUT=*
//NULL      DD *
//OUT       DD SYSOUT=(*,INTRDR)
//TOOLIN    DD *
COPY FROM(NULL) USING(CTL1)
//CTL1CNTL  DD *
  OUTFIL FNAMES=OUT,
    REMOVECC,NODETAIL,
    TRAILER1=(J1,/,J2,/,J3,/,J4,/,J5,/,
      J6,QT,DSN,C'.D',DATENS=(MDY),QTC,/,
      J7,/,J8,/,J9,/,J10,/,J11)
/*


This will be passed to the internal reader:

Code:

//TXXXXXXZ JOB 'CREATE DSN',CLASS=A,
//  MSGCLASS=Y,MSGLEVEL=(1,1),
//  NOTIFY=T-I-D
//STEP010  EXEC PGM=IEFBR14
//SYSPRINT DD SYSOUT=*
//FILE1 DD DSN='YOUR.DSN.NAME.D070803',
//  DISP=(NEW,CATLG,DELETE),
//  UNIT=SYSDA,
//  SPACE=(CYL,(X,Y),RLSE),
//  LRECL=ZZZ,RECFM=FB,BLKSIZE=0
//*


To change the data set name, just change the DSN symbol in SYMNAMES.
To change any of the JCL statements, just change the corresponding Jx symbol in SYMNAMES.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Cogito-Ergo-Sum
Advanced


Joined: 15 Dec 2002
Posts: 637
Topics: 43
Location: Bengaluru, INDIA

PostPosted: Tue Jul 08, 2003 11:08 pm    Post subject: Reply with quote

Alain,
Thanks for the explanation. I was thinking that, ICETOOL will create the member in the first step and this would be used in expansion for the second step.

Do you mean to say that, after modification "by hand", the dataset name that is created will still have the date stamp on it? If yes, then I do agree. Because, in the first submission (of first step), the PDS member will be created. And, in the second run, (whole of the JCL can be submitted as the PDS member is already existing) the PDS member will have the date stamp created by ICETOOL. So, manual modificaiton will not be reflected.

Thanks Alain.
_________________
ALL opinions are welcome.

Debugging tip:
When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
-- Sherlock Holmes.
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 -> 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