pass timestamp from jcl to cobol



JES, JES2, JCL utilities, IDCAMS, Compile & Run JCLs, PROCs etc...

pass timestamp from jcl to cobol

Postby iaccbond » Wed Dec 30, 2015 12:59 am

hi guys
i have a requirment where i have to pass jcl job start timestamp to cobol program (step p050) and inserted it in the output file of that program
could you please help me out

basically i need to pass timestamp (26 size) from jcl to cobol pgm.
iaccbond
 
Posts: 10
Joined: Wed Dec 30, 2015 12:56 am
Has thanked: 0 time
Been thanked: 0 time

Re: pass timestamp from jcl to cobol

 

Re: pass timestamp from jcl to cobol

Postby Robert Sample » Wed Dec 30, 2015 2:46 am

Where is the timestamp coming from?
Robert Sample
Global moderator
 
Posts: 3367
Joined: Sat Dec 19, 2009 8:32 pm
Location: East Dubuque, Illinois
Has thanked: 1 time
Been thanked: 222 times

Re: pass timestamp from jcl to cobol

Postby iaccbond » Wed Dec 30, 2015 11:26 am

we want current timestamp in the pgm ; the timestamp at which the job started.
iaccbond
 
Posts: 10
Joined: Wed Dec 30, 2015 12:56 am
Has thanked: 0 time
Been thanked: 0 time

Re: pass timestamp from jcl to cobol

Postby Akatsukami » Wed Dec 30, 2015 5:13 pm

iaccbond wrote:we want current timestamp in the pgm ; the timestamp at which the job started.

Which completely fails to answer Mr. Sample's question, viz.,
Where is the timestamp coming from?

You get it by chasing control blocks; the start date is in the job control table extension (JCTX) and the start time in the job control table (JCT) itself, which also contains a scheduler work area virtual address (SVA) to the JCTX.

The job step control block (JSCB) contains a SVA to the JCT; the task control block (TCB) contains the address of the JSCB; and the TCB is always at (decimal) address 540. Further details are in the MVS Data Areas manuals.

Although I have not verified it, the start date and time appear to be BCD; you'll need to format them into the DB2-style timestamp that you want.
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1053
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

Re: pass timestamp from jcl to cobol

Postby iaccbond » Thu Dec 31, 2015 11:00 am

well i did not get it ..
i just need to pass current timestamp from jcl to cobol as input.
my pgm required job start timestamp ..
any help will be helpfull.
iaccbond
 
Posts: 10
Joined: Wed Dec 30, 2015 12:56 am
Has thanked: 0 time
Been thanked: 0 time

Re: pass timestamp from jcl to cobol

Postby NicC » Thu Dec 31, 2015 4:30 pm

Why do you need the job start time? Why not the program start time? You can get the program start time by ACCEPT TIME but to get the job start time is not easy - you have to follow the steps noted by Akatsukami and you will have to do this in a program - either a stand-alone program and pass the derived time via a dataset to your cobol program or within your program itself.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 2690
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisys (almost)
Has thanked: 4 times
Been thanked: 105 times

Re: pass timestamp from jcl to cobol

Postby Akatsukami » Thu Dec 31, 2015 5:11 pm

iaccbond wrote:i just need to pass current timestamp from jcl to cobol as input.
my pgm required job start timestamp ..

But you see, my dear child, you cannot. When the JCL is interpreted -- which may be well before the job actually starts -- it is then frozen. As NicC says, you can easily get the program start time, but the actual job start time can only be gotten by chasing control blocks.

NicC also asks an important question: why do you need the job start time? If you can explain that, we may be able to show you a solution to your problem that does not require doing the impossible.
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1053
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

Re: pass timestamp from jcl to cobol

Postby prino » Thu Dec 31, 2015 5:55 pm

Akatsukami wrote:
iaccbond wrote:NicC also asks an important question: why do you need the job start time? If you can explain that, we may be able to show you a solution to your problem that does not require doing the impossible.

Dear Akatsukami-san, why don't you realize that "it is the requirement" set by Image...
Robert AH Prins
robert.ah.prins @ the.17+Gb.Google thingy
User avatar
prino
 
Posts: 536
Joined: Wed Mar 11, 2009 12:22 am
Location: Oostende, Belgium
Has thanked: 3 times
Been thanked: 21 times

Re: pass timestamp from jcl to cobol

Postby iaccbond » Thu Dec 31, 2015 6:05 pm

well guys i got and @prino u r 100% correct.
i have put below in sort card , had first step for sort , move the timestamp in a particular file and nailed it.
SORT FIELDS=COPY
OUTREC BUILD=(1:DATE5)
iaccbond
 
Posts: 10
Joined: Wed Dec 30, 2015 12:56 am
Has thanked: 0 time
Been thanked: 0 time

Re: pass timestamp from jcl to cobol

Postby Akatsukami » Thu Dec 31, 2015 6:11 pm

iaccbond wrote:well guys i got and @prino u r 100% correct.
i have put below in sort card , had first step for sort , move the timestamp in a particular file and nailed it.
SORT FIELDS=COPY
OUTREC BUILD=(1:DATE5)

See? You didn't really want the job start date and time; you wanted an easily-gotten approximation of the job start date and time. If you'd said that two days ago, we could have told you how to do it.
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1053
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

Next

Return to JCL

 


  • Related topics
    Replies
    Views
    Last post