View previous topic :: View next topic |
Author |
Message |
anchala Beginner
Joined: 22 Jan 2004 Posts: 1 Topics: 1
|
Posted: Thu Jan 22, 2004 2:24 pm Post subject: Cobol Program to identify which Job(JCL) triggered |
|
|
Please advise on how a Cobol Program can identify the Job(JCL) that triggered it. There could be more than 1 job that triggeres the program. |
|
Back to top |
|
|
superk Advanced
Joined: 19 Dec 2002 Posts: 684 Topics: 5
|
Posted: Thu Jan 22, 2004 2:51 pm Post subject: |
|
|
Look down a few lines from your post to the one titled "Userkey of user who submitted job". |
|
Back to top |
|
|
haatvedt Beginner
Joined: 14 Nov 2003 Posts: 66 Topics: 0 Location: St Cloud, Minnesota USA
|
Posted: Tue Feb 10, 2004 1:55 am Post subject: |
|
|
go to Gilbert Saint-Flour's homepage and look in his tools section for a cobol program which retrieves jobname / step name and other information..
http://mywebpages.comcast.net/gsf/tools/index.html
have fun. _________________ Chuck Haatvedt
email --> clastnameatcharterdotnet
(replace lastname, at, dot with appropriate
characters) |
|
Back to top |
|
|
Phantom Data Mgmt Moderator
Joined: 07 Jan 2003 Posts: 1056 Topics: 91 Location: The Blue Planet
|
Posted: Fri Jul 30, 2004 6:17 am Post subject: |
|
|
Hi,
The link is really great. Thanks haatvedt. I addition to the ones listed in the link, I would like to retrieve the following information from a job.
For a given DD name can I get the actual file which is allocated ?
for example if I have a job as the one shown below
Code: |
//JOBCARD....
//*
//*
//R010 EXEC PGM=COBOL123
//STEPLIB DD DSN=XXX.YYY.LOAD,DISP=SHR
//INPUT DD DSN=MY.INPUT.FILE,DISP=SHR
//*
...
|
In the above code, for the DD Name INPUT, the file "MY.INPUT.FILE" is allocated. Can I get this info. from inside the cobol program ?
Thanks a lot,
Phantom |
|
Back to top |
|
|
Phantom Data Mgmt Moderator
Joined: 07 Jan 2003 Posts: 1056 Topics: 91 Location: The Blue Planet
|
Posted: Fri Jul 30, 2004 6:18 am Post subject: |
|
|
In addition to the file details, I would also like to have the PS parameters (Volume, LRECL, Blksize, etc.....)
Thanks,
Phantom |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
|
Back to top |
|
|
Phantom Data Mgmt Moderator
Joined: 07 Jan 2003 Posts: 1056 Topics: 91 Location: The Blue Planet
|
Posted: Tue Aug 03, 2004 4:04 am Post subject: |
|
|
Thanks a lot kolusu,
This is what I wanted. The link is wonderful !!!. Also, Is there a way to get these info directly from COBOL (COBOL - ASSEMBLER directly) without invoking an intermediate REXX routine ? I don't want to do this way (COBOL - REXX - ASSEMBLER).
(Just to learn )
Regards,
Phantom |
|
Back to top |
|
|
bauer Intermediate
Joined: 10 Oct 2003 Posts: 315 Topics: 49 Location: Germany
|
Posted: Tue Aug 03, 2004 11:55 pm Post subject: |
|
|
Hi Phantom,
do you need assembler code and / or PL1 Code (should not be difficult to transfer to cobol) to get the job name which invoked an cobol program? Ist this your request.
Pls let me know, i will send you some lines code.
regards,
bauer |
|
Back to top |
|
|
Phantom Data Mgmt Moderator
Joined: 07 Jan 2003 Posts: 1056 Topics: 91 Location: The Blue Planet
|
Posted: Wed Aug 04, 2004 1:35 am Post subject: |
|
|
Bauer,
I just wanted to reduce the three step process to 2 steps. I have my cobol program ready (which does some other process). I want to know what file is allocated to its input DDNAME. If this could be done via an assembler or PL1 and if that can be invoked directly by my cobol program that would be fine.
I don't mind if its is an assember routine or PL1. Could you please post your code here. I will learn something new.
Thanks for your guidance,
Phantom |
|
Back to top |
|
|
bauer Intermediate
Joined: 10 Oct 2003 Posts: 315 Topics: 49 Location: Germany
|
Posted: Wed Aug 04, 2004 2:15 am Post subject: |
|
|
Phantom,
sorry, i have only code to find out jobname etc., but not any code to find out allocated datasets (at the moment).
I think reading the mvs controlblocks could solve the problem, Jobstep controlblock, my be ..... ?! I will check the documentatin the nexts days .......
Solution to find out jobname
Code: |
DCL CVT_ADDR_INIT BIN FIXED(31) INIT(16),
CVT_ADDR PTR BASED(ADDR(CVT_ADDR_INIT)),
CVT_PTR PTR BASED(CVT_ADDR) ;
DCL 1 CVT BASED(CVT_PTR),
2 LIST_PTR PTR ;
DCL 1 TCB_LIST BASED(LIST_PTR),
2 NEXT_TCB PTR,
2 CURR_TCB PTR;
DCL 1 TCB BASED(CURR_TCB),
2 FILLER CHAR(12),
2 TIOT_PTR PTR;
DCL 1 TIOT BASED(TIOT_PTR),
2 JOBNAME CHAR(8) ,
2 STEPNAME CHAR(8) ;
|
|
|
Back to top |
|
|
Phantom Data Mgmt Moderator
Joined: 07 Jan 2003 Posts: 1056 Topics: 91 Location: The Blue Planet
|
Posted: Wed Aug 04, 2004 11:10 pm Post subject: |
|
|
Thanks a lot bauer, I will try this and let u know.
Thanks
Phantom |
|
Back to top |
|
|
Phantom Data Mgmt Moderator
Joined: 07 Jan 2003 Posts: 1056 Topics: 91 Location: The Blue Planet
|
Posted: Tue Sep 07, 2004 12:16 pm Post subject: |
|
|
The code below is a clone of BATCHPDF. I am trying to extract the DCB parameters of all the DDNAMEs allocated in a particular step.
I went through the Data Area manuals Vol 4 (JFCB) and found that the offsets for LRECL, RECFM, Primary, Secondary and Dir quantity.
Code: |
get_allocations: Procedure Expose ddname. dsname. volume. lrecl.
Numeric digits 10 /* Allow up to 7fffffff */
Drop ddname. dsname. volume. lrecl. blksz. primq. secq. dir. recfm.
tiotptr=24+ptr(12+ptr(ptr(ptr(16)))) /* Get ddname array */
tioelngh=c2d(stg(tiotptr,1)) /* Nength of 1st entry */
a=0
ddname=' '
Do Until tioelngh=0 /* Scan until dd found */
tioeddnm=strip(stg(tiotptr+4,8)) /* Get ddname from tiot */
If substr(tioeddnm,1,1) <>'00'x Then
Do
If substr(tioeddnm,1,1) <>" " Then
ddname=tioeddnm
If ddname=Arg(1) THEN
Do
a=a+1
ddname.a=ddname
tioelngh=c2d(stg(tiotptr,1)) /* Length of next entry */
tioejfcb=stg(tiotptr+12,3)
jfcb=swareq(tioejfcb) /* Convert sva to 31-Bit addr */
dsname.a=strip(stg(jfcb,44)) /* Dsname jfcbdsnm */
lrecl.a =c2d(stg((jfcb+104),2)) /*Lrecl jcfclrecl */
blksz.a =c2d(stg((jfcb+102),2)) /*blksize JFCBLKSI */
primq.a =c2d(stg(jfcb+152,3)) /*Dir qty JFCBPQTY */
secq.a =c2d(stg(jfcb+156,3)) /*Dir qty JFCBSQTY */
dir.a =c2d(stg(jfcb+160,3)) /*Dir qty JFCBDQTY */
recfm.a =c2x(stg(jfcb+100,1)) /*Dir qty JFCRECFM */
volume.a=storage(d2x(jfcb+118),6)/* Volser jfcbvols (Not
used) */
say 'Iterations : ' a
say 'Dataset Name: ' dsname.a
say 'LRECL : ' lrecl.a
say 'Blksize : ' blksz.a
say 'Dir blocks : ' dir.a
say 'Prim Qty : ' primq.a
say 'Sec Qty : ' secq.a
say 'Volume : ' volume.a
say 'Recfm : ' recfm.a
End
End
tiotptr=tiotptr+tioelngh /* Get next entry */
tioelngh=c2d(stg(tiotptr,1)) /* Get entry length */
End
ddname.0=a
Return
/*-------------------------------------------------------------------*/
ptr: Return c2d(storage(d2x(Arg(1)),4)) /* Return a pointer */
/*-------------------------------------------------------------------*/
stg: Return storage(d2x(Arg(1)),Arg(2)) /* Return storage */
/*-------------------------------------------------------------------*/
swareq: Procedure
If right(c2x(Arg(1)),1) \= 'F' Then /* SWA=BELOW ? */
Return c2d(Arg(1))+16 /* YES, RETURN SVA+16 */
sva = c2d(Arg(1)) /* CONVERT TO DECIMAL */
tcb = ptr(540) /* TCB PSATOLD */
jscb = ptr(tcb+180) /* JSCB TCBJSCB */
qmpl = ptr(jscb+244) /* QMPL JSCBQMPI */
qmat = ptr(qmpl+24) /* QMAT QMADD */
Do While sva>65536
qmat = ptr(qmat+12) /* NEXT QMAT QMAT+12 */
sva=sva-65536 /* 010006F -> 000006F */
End
Return ptr(qmat+sva+1)+16
|
I am invoking this piece of rexx via batch (COBOL program invokes this REXX). Here is the SYSPRINT output.
Code: |
Iterations : 1
Dataset Name: TSONJAY.INPUT.FILE1
LRECL : 300
Blksize : 32700
Dir blocks : 0
Prim Qty : 0
Sec Qty : 3750
Volume : TSG085
Recfm : 90
Iterations : 1
Dataset Name: TSONJAY.INPUT.FILE2
LRECL : 300
Blksize : 32700
Dir blocks : 0
Prim Qty : 0
Sec Qty : 3750
Volume : TSG036
Recfm : 90
Iterations : 1
Dataset Name: TSONJAY.COMPARE.OUTPUT1
LRECL : 304
Blksize : 0
Dir blocks : 0
Prim Qty : 150
Sec Qty : 200
Volume : TSG077
Recfm : 90
Iterations : 1
Dataset Name: TSONJAY.TEST1.LINKLIB
LRECL : 0
Blksize : 23476
Dir blocks : 0
Prim Qty : 0
Sec Qty : 0
Volume : TSG057
Recfm : C0
|
Everything works fine but the Dir blocks and Primary quantity are always zero. Could someone please verify my code and let me know what could be the problem.
Thanks a ton,
Phantom |
|
Back to top |
|
|
Phantom Data Mgmt Moderator
Joined: 07 Jan 2003 Posts: 1056 Topics: 91 Location: The Blue Planet
|
Posted: Thu Sep 09, 2004 1:16 am Post subject: |
|
|
The dataset TSONJAY.TEST1.LINKLIB which is allocated to the DD STEPLIB is a PDS. But still I don't get the Dir blocks for this.
What does the field JFCBDQTY refer to ? is the Maximum directory blocks allocated or the no. of directory blocks used ?
If it refers to either of the two mentioned above is there any other field in the JFCB control blocks that give us the other one ?
Please help.
Thanks a lot.
Phantom |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
|
Back to top |
|
|
Phantom Data Mgmt Moderator
Joined: 07 Jan 2003 Posts: 1056 Topics: 91 Location: The Blue Planet
|
Posted: Thu Sep 09, 2004 8:26 am Post subject: |
|
|
Kolusu,
This is where I got the offsets for JFCBDQTY & JFCBPQTY .... from. The LRECL, Sec qty and others work fine but the Primary qty & Directory blocks are always zero. Could you please figure out what could be wrong in my code above ?
Thanks a ton in advance,
Regards,
Phantom |
|
Back to top |
|
|
|
|