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 

How to pass a current date

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


Joined: 07 Jun 2003
Posts: 18
Topics: 7

PostPosted: Tue Dec 11, 2007 6:18 pm    Post subject: How to pass a current date Reply with quote

Hi all,

I tried searching for this in the forum, i could not get what i was looking for. If i miss anything, please let me know.

Okay. this is what i was looking for, I need to pass current date to the PARM parameter. So, that COBOL program can look into the PARM value and process.

I know, we can directly use the current date in the program and process instead of passing curent date through a PARM and process. We have lot of things in the down below of the JCL. So, we need current to be passed through PARM field in the JCL.

One restriction is that, this needs to be done in one job. That is, i have a solution where i can do this by a INTRDR submitting with current date, which we don't need. Do you guys have any idea..

Thanks for your help
_________________
Regards,
Mouli
Back to top
View user's profile Send private message
superk
Advanced


Joined: 19 Dec 2002
Posts: 684
Topics: 5

PostPosted: Tue Dec 11, 2007 6:25 pm    Post subject: Re: How to pass a current date Reply with quote

Mouli wrote:
Do you guys have any idea


No, not really. Where do you intend to get this date value from? An external dataset? The job scheduling system? Don't forget that a variable value passed via the PARM has to be resolved before the job can execute.
Back to top
View user's profile Send private message
sriramla
Beginner


Joined: 22 Feb 2003
Posts: 74
Topics: 1

PostPosted: Wed Dec 12, 2007 9:57 am    Post subject: Reply with quote

Your job scheduler will have variables that gives the current day,month, year etc. Consult the manual to get those variables and pass them in the PARM.
Back to top
View user's profile Send private message
Bill Dennis
Advanced


Joined: 03 Dec 2002
Posts: 579
Topics: 1
Location: Iowa, USA

PostPosted: Wed Dec 12, 2007 12:32 pm    Post subject: Reply with quote

You can also use SORT to build a control card containing current date (in one of various formats) and read it into the program in the next step from a file.
_________________
Regards,
Bill Dennis

Disclaimer: My comments on this foorum are my own and do not represent the opinions or suggestions of any other person or business entity.
Back to top
View user's profile Send private message
vivek1983
Intermediate


Joined: 20 Apr 2006
Posts: 222
Topics: 24

PostPosted: Thu Dec 13, 2007 12:34 am    Post subject: Reply with quote

Mouli,

I feel you can get the current date inside the pgm itself than resorting to tougher methods.

Quote:

I know, we can directly use the current date in the program and process instead of passing curent date through a PARM and process. We have lot of things in the down below of the JCL. So, we need current to be passed through PARM field in the JCL.


I am still wondering y to resort to difficult methods to get the current date.
_________________
Vivek G
--------------------------------------
A dream is just a dream. A goal is a dream with a plan and a deadline. (Harvey Mackay)
Back to top
View user's profile Send private message
Bill Dennis
Advanced


Joined: 03 Dec 2002
Posts: 579
Topics: 1
Location: Iowa, USA

PostPosted: Thu Dec 13, 2007 9:49 am    Post subject: Re: How to pass a current date Reply with quote

Mouli wrote:
We have lot of things in the down below of the JCL.
Perhaps the job runs several days and all the "down below" steps need to use the same date as the initial step?

It is our nature to find the best/easiest method to accomplish a goal but it is made more difficult when the requirement is not fully explained to us.
_________________
Regards,
Bill Dennis

Disclaimer: My comments on this foorum are my own and do not represent the opinions or suggestions of any other person or business entity.
Back to top
View user's profile Send private message
sriramla
Beginner


Joined: 22 Feb 2003
Posts: 74
Topics: 1

PostPosted: Thu Dec 13, 2007 10:02 am    Post subject: Reply with quote

vivek1983 wrote:
Mouli,

I feel you can get the current date inside the pgm itself than resorting to tougher methods.


Vivek, One good point in passing the date thru parm instead of getting in the program is for easy rerun. If you want to rerun the program for past dates, its easy to change the PARM and resubmit. Another issue in getting the date in the program is mid-night window issue. When the program is scheduled to run at 11:00pm but it got delayed by couple of hours, then program will use next day's date and may give incorrect results. Passing the date thru parm will prevent this. Note that, the Jobs will usually be loaded in the scheduler in the evening and all symbolics would be resolved by that time.
Back to top
View user's profile Send private message
jsharon1248
Intermediate


Joined: 08 Aug 2007
Posts: 291
Topics: 2
Location: Chicago

PostPosted: Thu Dec 13, 2007 10:34 am    Post subject: Reply with quote

As pointed out in previous replies, the PARM values on the JCL EXEC statements are resolved before the first program executes, so there really is no opportunity for a program in the JOB to generate the PARM values for JCL EXEC statements.

If you're running the programs using the RUN PROGRAM command in IKJEFT01 (or an alias of it), you could have a program generate a PARM statement and save it to a dataset and concat the dataset following the RUN PROGRAM. But I don't know of any way to generate a PARM value for a JCL EXEC statement.

Code:

//STEP1 EXEC PGM=IEBGENER
//SYSUT1 DD *
 PARMS('12/13/2007')
//SYSUT2 DD DSN=WORK.RUNDATE,DISP=(,CATLG,DELETE),
// UNIT=DISK,SPACE=(TRK,1),RECFM=FB,LRECL=80,BLKSIZE=0
...
...
//STEP2 EXEC PGM=IKJEFT01
...
//SYSTSIN DD *
  RUN PROGRAM(PGMB) -
//      DD DSN=WORK.RUNDATE,DISP=SHR
Back to top
View user's profile Send private message
Mouli
Beginner


Joined: 07 Jun 2003
Posts: 18
Topics: 7

PostPosted: Thu Dec 13, 2007 2:41 pm    Post subject: Reply with quote

Thanks a lot for all your views/ideas guys.. We ended up modifying the program to accept the current date and in the "down below process", as i mentioned earlier we used this date and processed.

Once again thanks for all your ideas.

Thanks
Mouli
_________________
Regards,
Mouli
Back to top
View user's profile Send private message
Terry_Heinze
Supermod


Joined: 31 May 2004
Posts: 391
Topics: 4
Location: Richfield, MN, USA

PostPosted: Thu Dec 13, 2007 2:45 pm    Post subject: Reply with quote

If executing past midnight is a possibility, you can check time of day and adjust current date if needed.
_________________
....Terry
Back to top
View user's profile Send private message Send e-mail
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