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
 

 

To Capture the Job Number Submitted in a rexx variable
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
Anirban Bhattacharjee

New User


Joined: 12 Aug 2011
Posts: 9
Location: India

PostPosted: Wed Nov 16, 2011 6:13 pm    Post subject: To Capture the Job Number Submitted in a rexx variable
Reply with quote

Hi!
I am submitting a Job from a rexx program in TSO Address Space using
"SUBMIT 'XXXX.XXXX.XXX(YYYYYYYY)'"


Now I want to capture the Job Number which appears in the message :

"IKJ56250I JOB XXXXXX40(JOB09614) SUBMITTED"

after submitting the job in a variable to be used in a rexx program which
uses SDSF API.

For exapmle refering to the message above if I can store the Job Number : 09614 in a variable ,say M ,then I can use it to check my job using the logic :

do ix=1 to JNAME.0
if JNAME.ix = M then do

Address SDSF "ISFACT ST TOKEN(’"TOKEN.ix"’) PARM(NP ?)" , "( prefix abh_"
/*** my program logic **/

Now how to I capture the Job Number from the message that is displayed immediately after job submission to a variable ?

If using Outtrap is the answer (which I am not sure of) ,,please provide some skeleton code as well.

Please help.
Back to top
View user's profile Send private message

expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Wed Nov 16, 2011 6:18 pm    Post subject:
Reply with quote

Is this yet another one of those things that submits a job and waits for it to finish before doing something else

Please tell me it isn't

Please tell us what you are trying to do and why the job number is so important
Back to top
View user's profile Send private message
superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4648
Location: Raleigh, NC, USA

PostPosted: Wed Nov 16, 2011 6:22 pm    Post subject: Reply to: To Capture the Job Number Submitted in a rexx vari
Reply with quote

Yes, OUTTRAP is the answer.

Code:

Call Outtrap(j.)             
"SUBMIT ......"
Call Outtrap(Off)                           
Say j.2                     


And, for what it's worth, a search showed plenty of existing examples:

http://www.ibmmainframes.com/viewtopic.php?t=49742
http://www.ibmmainframes.com/viewtopic.php?t=43390
http://www.ibmmainframes.com/viewtopic.php?t=25759
http://www.ibmmainframes.com/viewtopic.php?t=24027
http://www.ibmmainframes.com/viewtopic.php?t=11550
Back to top
View user's profile Send private message
Anirban Bhattacharjee

New User


Joined: 12 Aug 2011
Posts: 9
Location: India

PostPosted: Wed Nov 16, 2011 7:29 pm    Post subject:
Reply with quote

expat wrote:
Is this yet another one of those things that submits a job and waits for it to finish before doing something else

Please tell me it isn't

Please tell us what you are trying to do and why the job number is so important


Hi Expat,

Ironically , yes it is yet another of those things which submits a job and waits for it to execute.I have explained my objectives below.If u feel that there is a better approach to achive the same result other than the approach I have taken , please let me know.

There are a few jobs which we execute over and over for testing.I am making a tool using Rexx ,thus allowing the users to interact with the system through ISPF Panels.
Many users will simultaneously run the jobs and I wanted to Capture the Job number for unique identification,since I am not aware of everybody's RACF ID and Username in the team.Also users will submit multiple jobs not necessarily in the same order.

If I can search with the Job No then it ensures that I can search the JESYSMESG for the output (i need to search in JESYSMESG only for testing). unique for each user.I am using the userids to be appended in a temp dataset name which will contain the output copied from JESYSMESG.

But I got the answer.Many thanks to Kevin for the links and the sample code.Also the links he posted are priceless for me .Indeed I got to admit that I didnot search enough before posting the question.
Back to top
View user's profile Send private message
Anirban Bhattacharjee

New User


Joined: 12 Aug 2011
Posts: 9
Location: India

PostPosted: Wed Nov 16, 2011 7:32 pm    Post subject: Re: Reply to: To Capture the Job Number Submitted in a rexx
Reply with quote

superk wrote:
Yes, OUTTRAP is the answer.

Code:

Call Outtrap(j.)             
"SUBMIT ......"
Call Outtrap(Off)                           
Say j.2                     


And, for what it's worth, a search showed plenty of existing examples:

http://www.ibmmainframes.com/viewtopic.php?t=49742
http://www.ibmmainframes.com/viewtopic.php?t=43390
http://www.ibmmainframes.com/viewtopic.php?t=25759
http://www.ibmmainframes.com/viewtopic.php?t=24027
http://www.ibmmainframes.com/viewtopic.php?t=11550



Hi Kevin,
Many thanks for the answer.
It works .
The threads are also very helpful.
My gratitudes for the same.

I admit that I did not put enough effort to search the whole forum before posting the question.Will do from now on .
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1738
Location: Bloomington, IL

PostPosted: Wed Nov 16, 2011 8:22 pm    Post subject:
Reply with quote

Anirban Bhattacharjee wrote:
There are a few jobs which we execute over and over for testing.I am making a tool using Rexx ,thus allowing the users to interact with the system through ISPF Panels.
Many users will simultaneously run the jobs and I wanted to Capture the Job number for unique identification,since I am not aware of everybody's RACF ID and Username in the team.

Presumably these users (at least the ones who will be using this tool) are limited to submitting jobs whose names begin with their TSO IDs? In any case you are aware that the TSO ID can be retrieved via the USERID function?
Quote:
Also users will submit multiple jobs not necessarily in the same order.

If I can search with the Job No then it ensures that I can search the JESYSMESG for the output (i need to search in JESYSMESG only for testing). unique for each user.I am using the userids to be appended in a temp dataset name which will contain the output copied from JESYSMESG.

But why does this require that the on-line process wait? Indeed, it would seem that doing this would limit a user to submitting a single job at a time, waiting for it to finish (or abend with an Sx22...), and then repeating the process; very wasteful and inefficient.
Back to top
View user's profile Send private message
Anirban Bhattacharjee

New User


Joined: 12 Aug 2011
Posts: 9
Location: India

PostPosted: Wed Nov 16, 2011 8:31 pm    Post subject:
Reply with quote

Akatsukami wrote:
Anirban Bhattacharjee wrote:
There are a few jobs which we execute over and over for testing.I am making a tool using Rexx ,thus allowing the users to interact with the system through ISPF Panels.
Many users will simultaneously run the jobs and I wanted to Capture the Job number for unique identification,since I am not aware of everybody's RACF ID and Username in the team.

Presumably these users (at least the ones who will be using this tool) are limited to submitting jobs whose names begin with their TSO IDs? In any case you are aware that the TSO ID can be retrieved via the USERID function?
Quote:
Also users will submit multiple jobs not necessarily in the same order.

If I can search with the Job No then it ensures that I can search the JESYSMESG for the output (i need to search in JESYSMESG only for testing). unique for each user.I am using the userids to be appended in a temp dataset name which will contain the output copied from JESYSMESG.

But why does this require that the on-line process wait? Indeed, it would seem that doing this would limit a user to submitting a single job at a time, waiting for it to finish (or abend with an Sx22...), and then repeating the process; very wasteful and inefficient.




Hi,
Yes we have to wait for the previous jobs to finish.This is a part of the activity defined for our testing.Once the job finishes the outout of this job
produdced the last step will be given input to the next job.

But I thank for taking time to review my approach. Now if the online process does not wait for the job to finish,,,how to get the output file....?Please advise.
What should I do to enable users to submit the job concurrently and making it more efficient.Please let me know if any specific info is required to analyze the scenario from ur end.
Thanks again for taking time to review my post
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 Nov 16, 2011 8:39 pm    Post subject:
Reply with quote

Hello,

For only 1 user, this is a wasteful approach. For many users, this could have a larger negative affect on the system.

You might consider having the user submit whatever job(s) and at the end of each job, send an e-mail to the user with info from the job as well as the job number. We do this all of the time.
Back to top
View user's profile Send private message
Anirban Bhattacharjee

New User


Joined: 12 Aug 2011
Posts: 9
Location: India

PostPosted: Wed Nov 16, 2011 8:59 pm    Post subject:
Reply with quote

dick scherrer wrote:
Hello,

For only 1 user, this is a wasteful approach. For many users, this could have a larger negative affect on the system.

You might consider having the user submit whatever job(s) and at the end of each job, send an e-mail to the user with info from the job as well as the job number. We do this all of the time.


Hi dick Ok..but I have to make the tool where users will select the job numbers.
Say if u enter 1 in the ISPF panel and press Enter , it will submit Job1. Then u press option C1 it will show the output of Job1 from JESYSMESG.Then u press Option2 it will Submit Job2 with the output file produced in Job1 .....and so on and so forth.

Any better ideas..@ dick scherrer
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 Nov 16, 2011 9:11 pm    Post subject:
Reply with quote

Hello,

Quote:
Any better ideas..@ dick scherrer
Yes. Change the process so that the jobs send the job number to the user and then they can use the job number to look at the job in the spool. . .
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 1713
Location: UK

PostPosted: Wed Nov 16, 2011 9:24 pm    Post subject:
Reply with quote

Instead of submitting a job, waiting for it to finish, submitting the next and so on why not submit all jobs at once with the second and subsequent jobs being held with the job that is to precede them issuing a release on successful completion? Or, have the first job submit the next and so on?
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1738
Location: Bloomington, IL

PostPosted: Wed Nov 16, 2011 9:40 pm    Post subject:
Reply with quote

Anirban Bhattacharjee wrote:
Yes we have to wait for the previous jobs to finish.This is a part of the activity defined for our testing.Once the job finishes the outout of this job
produdced the last step will be given input to the next job.

But I thank for taking time to review my approach. Now if the online process does not wait for the job to finish,,,how to get the output file....?Please advise.
What should I do to enable users to submit the job concurrently and making it more efficient.Please let me know if any specific info is required to analyze the scenario from ur end.
Thanks again for taking time to review my post

It depends in part on the nature and size of your system. At my site, we have separate production and development sysplexes, as well as several stand-alone systems for system-level testing. What we would consider a trivial expenditure of machine resources may represent an intolerable burden for you. It also depends on whether you are running JES2 or JES3; in the latter, you can fairly easily network jobs together (although many shops have modifications to JES2 that allow this).

Assuming that you run JES3, I would do something like this:

  1. Have the user specify the jobs to be run (perhaps the name of the library and member) and the order in which they are to be run (for simplicity’s sake, I will assume that they will run one at a time).
  2. Have your tool copy each job to a temporary data set, determining or deciding the job name, and insert a JES3 NET card after the job card in each one.
  3. At the end of the job, add two steps. The first retrieves the job name and number from the control blocks (IIRC, you’ll want the ASCB) and writes it to a temporary data set. The second one reads that data set and invokes your spool management software (probably (E)JES) to extract the information you want from the spool and set it up for the next job.
  4. Submit the job.

If this takes long enough (and we have test-generator tools that fabricate and submit hundreds of jobs in a complex DJC network that it creates on the fly; such a generation may take 10-15 minutes to run), you may wish the tool to submit a job does all this in the background.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Wed Nov 16, 2011 10:06 pm    Post subject:
Reply with quote

Anirban Bhattacharjee wrote:
dick scherrer wrote:
Hello,

For only 1 user, this is a wasteful approach. For many users, this could have a larger negative affect on the system.

You might consider having the user submit whatever job(s) and at the end of each job, send an e-mail to the user with info from the job as well as the job number. We do this all of the time.


Hi dick Ok..but I have to make the tool where users will select the job numbers.
Say if u enter 1 in the ISPF panel and press Enter , it will submit Job1. Then u press option C1 it will show the output of Job1 from JESYSMESG.Then u press Option2 it will Submit Job2 with the output file produced in Job1 .....and so on and so forth.

Any better ideas..@ dick scherrer


Use a scheduler software, which is most likely installed at your site.

It does exactly what it says it does on the packet.
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 645
Location: Pennsylvania

PostPosted: Wed Nov 16, 2011 10:21 pm    Post subject:
Reply with quote

Why do you need the user to submit the next Job?

What are they looking at in the JESYSMESG that the process can not do itself?

Write a small Rexx/SDSF program to analyze the output and submit the next Job if acceptable.

You could even set a return code, and have the remaining functionality in the same Job execute based on the return code.

This is yet another case of the solution has been predetermined by the TS rather than stating the problem and getting expert advice on a workable solution.

I for one have written many user driven applications, and never once have I considered having the Rexx/ISPF application wait for a batch job to complete.

Anirban, I suggest you redesign your approach. Ignore good advice if you will.
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 Nov 16, 2011 10:49 pm    Post subject: Reply to: To Capture the Job Number Submitted in a rexx vari
Reply with quote

Also, easily obtained in Assembler (R1 is used as an example only) -

Code:

         L     R1,540                  CURRENT 'TCB'
         L     R1,180(,R1)             POINT TO 'JFCB'
         L     R1,316(,R1)             POINT TO 'SSID'
         LA    R1,12(,R1)              OK, WE'RE HERE
         MVC   JOBNBR,0(R1)            POPULATE AS C'JOB00000'

With a little bit of ingenuity, you can can convert this to COBOL. icon_wink.gif

Mr. Bill
Back to top
View user's profile Send private message
Anirban Bhattacharjee

New User


Joined: 12 Aug 2011
Posts: 9
Location: India

PostPosted: Thu Nov 17, 2011 1:35 pm    Post subject:
Reply with quote

daveporcelan wrote:
Why do you need the user to submit the next Job?

What are they looking at in the JESYSMESG that the process can not do itself?

Write a small Rexx/SDSF program to analyze the output and submit the next Job if acceptable.

You could even set a return code, and have the remaining functionality in the same Job execute based on the return code.

This is yet another case of the solution has been predetermined by the TS rather than stating the problem and getting expert advice on a workable solution.

I for one have written many user driven applications, and never once have I considered having the Rexx/ISPF application wait for a batch job to complete.

Anirban, I suggest you redesign your approach. Ignore good advice if you will.



Thanks Dave.
Back to top
View user's profile Send private message
Anirban Bhattacharjee

New User


Joined: 12 Aug 2011
Posts: 9
Location: India

PostPosted: Thu Nov 17, 2011 9:21 pm    Post subject:
Reply with quote

Hi All,

I had a discussion with our team leadership and I presented the idea of alternative approaches which did include ideas presented by Bill,Dave,Nic,Expat,Dic and Akatsukami.

The constraint here is I am not supposed to modify any JCL as JCLs are
being written by developers and these run in productions.The automation that I am being asigned is mainly for non MF resources and clients who can atleast repeat the jobs using GUI Panels and the output would be visible to them.
sending mails - is not an option I have icon_sad.gif.
So they have instructed me to strictly follow the repeated step process.
The ultimate objective here is that users dont have to submit jobs using J or Sub ..they need not Go to ISPF and use ST and then ? under NP and review the output...Necessary outputs will be presented to them by the program on the screen after jobs finish executing.

If any Job abends,,,,then the Abend Code will be presented on the screen which they will convey to the developer. Even we are not supposed to
rectify it on our own no matter what level of expertise one has.

So under these circumstances ..what I have done so far is :
isfcols = "JNUM JOBID JNAME QUEUE"

K = Outtrap('m.')
"SUBMIT 'xxxxx.xxx.xxx(uuuu)'"
K = Outtrap('off')
Parse var m.1 v1 v2 v3 v4

now v3 = XXXXXXXX(JOB12345) so used Substr and obtained
my_jnum=Substr(v3,13,5)


then I used this job number as
do ix=1 to JNUM.0
if JNUM.ix=my_num then do
Address SDSF "ST TOKEN(’"TOKEN.ix"’) PARM(NP ?)" , "( prefix jds_"
/** here checking if nrc<>0 then exit 20 else---

do jx=1 to jds_DDNAME.0
if jds_DDNAME.jx = "JESYSMSG" then do

Address SDSF "ISFACT ST TOKEN(’"jds_TOKEN.jx"’)" , "PARM(NP SA)"
do kx=1 to isfddname.0
/*now using EXECIO and finding the output*/

I know that it may not be a good approach ..so now that O have stated my
restrictions..I implore our seniors ..please help with some ideas which u think will be more feasibile (actually wanted to say not lame and stupid as mine!)
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Thu Nov 17, 2011 9:35 pm    Post subject:
Reply with quote

Did you happen to mention the problems if the initiators are full or stopped for some reason or when a users TSO session times out before the job finishes.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Thu Nov 17, 2011 10:02 pm    Post subject: Reply to: To Capture the Job Number Submitted in a rexx vari
Reply with quote

if You had lurked a bit around You would have noticed that the general consensus is
against building Your own scheduler, and against having a tso user wait for a batch process to complete.

if Your organization is happy with it, just go ahead, but do not expect too much help from anybody around here!
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: Thu Nov 17, 2011 10:32 pm    Post subject:
Reply with quote

Hello,

Quote:
I implore our seniors ..
Why might you believe we would provide advice on something that most of us (seniors) believe should not be done.

Your management may expect you to do "something", but we would be somewhat irresponsible to help implement something that is known to cause more problems that it solves.
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 -> CLIST & REXX All times are GMT + 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. Get a job submitted itself every time... arunsoods JCL & VSAM 3 Tue Nov 22, 2016 4:05 pm
No new posts What is the command to check MODE of ... rohanthengal CLIST & REXX 6 Fri Nov 18, 2016 1:48 pm
This topic is locked: you cannot edit posts or make replies. Rexx to create GDG by scanning JJ result krish.deepu CLIST & REXX 5 Tue Oct 25, 2016 5:32 pm
No new posts Replace repeated JCL with looping REXX prino CLIST & REXX 3 Thu Oct 13, 2016 5:30 am
This topic is locked: you cannot edit posts or make replies. Need to code a Rexx PGM sundaram.naveen CLIST & REXX 18 Thu Oct 06, 2016 6:45 pm


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