Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Capturing the JOBNAME in COBOL program

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
nightbuzzz

New User


Joined: 04 May 2007
Posts: 21
Location: kuala lumpur

PostPosted: Mon Apr 16, 2012 2:38 pm    Post subject: Capturing the JOBNAME in COBOL program
Reply with quote

Hi Al,

There is a scenario i am facing and want a little help..

My COBOL program gets executed multiple times in different JCL's and every time i have to identify in which JCL it is getting executed. How can i achieve that except passing the JOBNAME thru PARM.

Thanks in advance.

Mayank
Back to top
View user's profile Send private message

enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Mon Apr 16, 2012 2:52 pm    Post subject: Reply to: Capturing the JOBNAME in COBOL program
Reply with quote

see
http://gsf-soft.com/Freeware/
and
http://gsf-soft.com/Freeware/COB2JOB.shtml
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7225

PostPosted: Mon Apr 16, 2012 2:53 pm    Post subject: Re: Capturing the JOBNAME in COBOL program
Reply with quote

nightbuzzz wrote:
Hi Al,

There is a scenario i am facing and want a little help..

My COBOL program gets executed multiple times in different JCL's and every time i have to identify in which JCL it is getting executed. How can i achieve that except passing the JOBNAME thru PARM.

Thanks in advance.

Mayank


Who is Al?

Do you mean that you need to know while your program is running which JOBNAME it has?

Or do you instead need to know afterwards, or just for maintenance, which JOBs executed your program, or which bits of JCL contain steps which could cause its execution?

Maybe since you mention the PARM you mean the former? What is the drawback that you see in using the PARM?

EDIT: I see the Cobol cat-is-out-of-the-bag. The reason not to do it in Cobol (in Production) is that noone provides copybooks for the Control Block layouts. If you write a little something in Assembler instead (search post posts on same sort of subject by Bill O'Boyle) then IBM supply the macros which are used. You have a system change from IBM involving Control Blocks, all documented through the changed Assembler macros. Changes to Cobol programs using it? For stuff you've just copied from somewhere? Not something you'd like your system-software-upgrade-verification-process hanging on, is it?
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2422
Location: Netherlands, Amstelveen

PostPosted: Mon Apr 16, 2012 3:02 pm    Post subject:
Reply with quote

Al is Al Bundy.

Obtaining knowledge about programs executed is mostly an after the fact situation. Displaying some control block info is useless, if you cant write
that info to a file. Else you have to scan JES logs, beside that there is no
organization that allows the use of files not purposefull to the program.
So SMF will be your friend.
Back to top
View user's profile Send private message
nightbuzzz

New User


Joined: 04 May 2007
Posts: 21
Location: kuala lumpur

PostPosted: Mon Apr 16, 2012 3:06 pm    Post subject:
Reply with quote

Hi,

Sorry for the TYPO, its ALL.

My query is, i want to to know in my COBOL program that in which JOB it is getting executed.
My program runs multiple times in different JOBs.

Regards
Mayank
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2422
Location: Netherlands, Amstelveen

PostPosted: Mon Apr 16, 2012 3:09 pm    Post subject:
Reply with quote

Well use the links from Mr. Sorichetti.

Now im terrible curious what your program is going to do, after you got
that jobname info.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7225

PostPosted: Mon Apr 16, 2012 3:09 pm    Post subject: Reply to: Capturing the JOBNAME in COBOL program
Reply with quote

OK, we knew about Al really :-)

You've made it a little clearer, but failed to say why you think the PARM is not a solution for you.

If you don't like the PARM and can't say why, you or someone else could knock-together a callable Assembler module along the lines provided by Bill O'Boyle.

EDIT: Assembler for the reasons already stated. If it is just something in "development" and not "critical" to development, then you could reasonably use the Cobol route.
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Mon Apr 16, 2012 3:38 pm    Post subject:
Reply with quote

Possibly, you could use the symbol translator utility EZACFSM1 and translate the &JOBNAME system variable into the actual jobname, and write the output to a dataset, to be looked at later - no?
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7225

PostPosted: Mon Apr 16, 2012 3:39 pm    Post subject: Reply to: Capturing the JOBNAME in COBOL program
Reply with quote

Or pass the &JOBNAME as the PARM....
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Mon Apr 16, 2012 3:41 pm    Post subject:
Reply with quote

And apart from what Enrico has suggested, here is another example: http://ibmmainframes.com/about35300.html - suggest, use with caution.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2502
Location: Atlanta, Georgia, USA

PostPosted: Tue Apr 17, 2012 5:54 am    Post subject: Reply to: Capturing the JOBNAME in COBOL program
Reply with quote

Bill,

Kudos much appreciated.

Here's the link to sub-program "GETJOBI" -

http://www.ibmmainframes.com/viewtopic.php?p=167434&highlight=#167434

Regards,
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1219
Location: Israel

PostPosted: Wed Apr 18, 2012 2:38 am    Post subject:
Reply with quote

Here is another link, provided by IBM itself: How to find the JOB name using a COBOL program.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2502
Location: Atlanta, Georgia, USA

PostPosted: Wed Apr 18, 2012 4:10 am    Post subject: Reply to: Capturing the JOBNAME in COBOL program
Reply with quote

Marso,

Great find. Didn't realise IBM advocated control-block traversing in COBOL. icon_wink.gif

Regards,
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Apr 18, 2012 8:15 am    Post subject:
Reply with quote

Hello,


Bill Woodger wrote:
dick scherrer wrote:
[...]

If you post your cobol code that retrieves the dsn, i'll amend several topics that refer to doing this, but no longer work due to changed control blocks.

[...]

From the link provided by Anuj.

New release of z/OS, the information can change. z/OS 2 next year (apparently), so a bigger change, potentially, than just the 1.xx to 1.xx+1. IBM will change the Assembler macros if necessary. No-one, and not their dog, will change the bits of Cobol scattered over the internet. Or they might. Eventually. Hopefully correctly, maybe not.

I lke that from IBM - on the one hand "only use the macros" "don't rely on anything except what we say you can rely on", and then they throw a Cobol example at you anyway. Even redefining the pointers to add to them (what is wrong with SET UP BY?).

Glad that's cleared up.

/pointed tone on
It would be good, I feel, if we didn't encourage this unless TS/OPs say, with straight faces, "no, this isn't going into Production".
/pointed tone off
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Wed Apr 18, 2012 8:21 pm    Post subject:
Reply with quote

Quote:
It would be good, I feel, if we didn't encourage this unless TS/OPs say, with straight faces, "no, this isn't going into Production".
As they say - not evreything which can be done, should be done. icon_smile.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts IMS BMP program causes 878 system abend Artemk IMS DB/DC 7 Tue Nov 22, 2016 8:26 pm
This topic is locked: you cannot edit posts or make replies. RANDOM Function in COBOL swapnil781 COBOL Programming 2 Tue Nov 15, 2016 6:17 pm
No new posts Regarding COBOL Stored Procedure opti... selvamsrinivasan85 DB2 4 Fri Nov 04, 2016 8:57 pm
No new posts COBOL Version 6.1 Virendra Shambharkar COBOL Programming 5 Tue Nov 01, 2016 11:24 am
No new posts Cobol list of programs being called biswajit.dattagupta COBOL Programming 5 Tue Nov 01, 2016 2:10 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us