IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Capturing the JOBNAME in COBOL program


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Mon Apr 16, 2012 2:52 pm
Reply with quote

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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Apr 16, 2012 2:53 pm
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: 2481
Location: Netherlands, Amstelveen

PostPosted: Mon Apr 16, 2012 3:02 pm
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
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: 2481
Location: Netherlands, Amstelveen

PostPosted: Mon Apr 16, 2012 3:09 pm
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Apr 16, 2012 3:09 pm
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

Superior Member


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

PostPosted: Mon Apr 16, 2012 3:38 pm
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Apr 16, 2012 3:39 pm
Reply with quote

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

Superior Member


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

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

And apart from what Enrico has suggested, here is another example: 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: 2501
Location: Atlanta, Georgia, USA

PostPosted: Tue Apr 17, 2012 5:54 am
Reply with quote

Bill,

Kudos much appreciated.

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

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: 1353
Location: Israel

PostPosted: Wed Apr 18, 2012 2:38 am
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: 2501
Location: Atlanta, Georgia, USA

PostPosted: Wed Apr 18, 2012 4:10 am
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

Moderator Emeritus


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

PostPosted: Wed Apr 18, 2012 8:15 am
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

Superior Member


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

PostPosted: Wed Apr 18, 2012 8:21 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts Using API Gateway from CICS program CICS 0
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
Search our Forums:

Back to Top