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

To Capture the Job Number Submitted in a rexx variable


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
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
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: 8797
Location: Welsh Wales

PostPosted: Wed Nov 16, 2011 6:18 pm
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

Global Moderator


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

PostPosted: Wed Nov 16, 2011 6:22 pm
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:

www.ibmmainframes.com/viewtopic.php?t=49742
www.ibmmainframes.com/viewtopic.php?t=43390
www.ibmmainframes.com/viewtopic.php?t=25759
www.ibmmainframes.com/viewtopic.php?t=24027
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
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
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:

www.ibmmainframes.com/viewtopic.php?t=49742
www.ibmmainframes.com/viewtopic.php?t=43390
www.ibmmainframes.com/viewtopic.php?t=25759
www.ibmmainframes.com/viewtopic.php?t=24027
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: 1788
Location: Bloomington, IL

PostPosted: Wed Nov 16, 2011 8:22 pm
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
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

Moderator Emeritus


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

PostPosted: Wed Nov 16, 2011 8:39 pm
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
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

Moderator Emeritus


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

PostPosted: Wed Nov 16, 2011 9:11 pm
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: 2455
Location: Hampshire, UK

PostPosted: Wed Nov 16, 2011 9:24 pm
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: 1788
Location: Bloomington, IL

PostPosted: Wed Nov 16, 2011 9:40 pm
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: 8797
Location: Welsh Wales

PostPosted: Wed Nov 16, 2011 10:06 pm
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: 792
Location: Pennsylvania

PostPosted: Wed Nov 16, 2011 10:21 pm
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: 2501
Location: Atlanta, Georgia, USA

PostPosted: Wed Nov 16, 2011 10:49 pm
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
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
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
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

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Thu Nov 17, 2011 10:02 pm
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

Moderator Emeritus


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

PostPosted: Thu Nov 17, 2011 10:32 pm
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
Pedro

Global Moderator


Joined: 01 Sep 2006
Posts: 2547
Location: Silicon Valley

PostPosted: Thu Nov 17, 2011 10:51 pm
Reply with quote

See chapter 7, 'Reviewing execution of a job', of "Implementing REXX
Support in SDSF", SG24-7419-00

I think you can copy all of the examples in chapter 7 into one rexx program to do what you want (more or less).
Back to top
View user's profile Send private message
Anirban Bhattacharjee

New User


Joined: 12 Aug 2011
Posts: 9
Location: India

PostPosted: Fri Nov 18, 2011 11:58 am
Reply with quote

Pedro wrote:
See chapter 7, 'Reviewing execution of a job', of "Implementing REXX
Support in SDSF", SG24-7419-00

I think you can copy all of the examples in chapter 7 into one rexx program to do what you want (more or less).



Thanks Pedro,,,,yeah..this book contains so many examples and covers almost everything I need.!!icon_smile.gif
Back to top
View user's profile Send private message
Anirban Bhattacharjee

New User


Joined: 12 Aug 2011
Posts: 9
Location: India

PostPosted: Fri Nov 18, 2011 12:13 pm
Reply with quote

dick scherrer wrote:
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.



Ok Dic...yes bith u and enrico are correct.i agree.Just because i have been asked to be stupid doesnt mean I have to..gave it a lot of thought.
So I am starting over :

This is my requirement in brief :(repeating again for easy reference)

1) We have 4 Jobs.

2) First drains data from the queue .It takes no input and drains all the records from a queue without any filter and writes them to a current version of GDG.

3) In the next job..testers can input their uniqueue record identifier,say a serial number, and that filters the desired records only to another GDG.
Here every invidual testers will provide their own serial numbers and will get the desired records only as output .This job will search all the versions of GDG created by Step 2 for the record.

4)Output of 3rd job is input to Job 4.Job 4 creates 2 outputs(GDGs),one for archival and another for Printing in AFP printer.

My assignment is to create a panel based tool which will enable the non tech staffs to interact with the system.There shouldbe panel with minimum 100 coloumns for Step 2 where users will proide their identifiers
instead of them providing the same in SYSIN step.The tool will put their
identifiers from the panel in to the JCL and submit the job.

In all of the steps I need to show the output file names in a panel screen so that the users need not go to SDSF and find that out.
Also all the outputs of individual jobs needs to be displayed on the screen.

Now I dont have edit/copy/move and compile access to changeman..
so I have written a compile JCL and run JCl of my own and it works:)
I cant inform anybody through mail...all outputs must be captured in the tool screen itself.

Please advise what would be the best approach to achive this based upon your experience and observations .
If u just give me some basic ideas ..i would be ever grateful to you.
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: Sat Nov 19, 2011 12:16 pm
Reply with quote

Hello,

Quote:
Please advise what would be the best approach to achive this based upon your experience and observations .
If i was required to do something similar, i would not have used this approach. . .

You/your organization has already decided steps that must be taken and now the goal is to try to find a way to implement so that the process can run end-to-end. I question the steps as defined. I suspect that "someone" has made this decision without thinking about the supportablilty of such a process. There are several "requirements" that i believe should be re-thought.

The amount of knowledge transfer that would be needed to address this here is too big for a forum topic. As a starting point, i would take the direction that the online and the batch do not need to "communicate". The results of the batch jobs can be made available by storing the data in user-specific files or database tables. Then using other screens, they can look at whatever without using SDSF.
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: Sat Nov 19, 2011 5:01 pm
Reply with quote

Quote:
...by storing the data in user-specific viles...


I know it is a typo, but what a great name that would be for a dataset containing "bad" (or "junk") data :-)

Serendipity stumbles upon us again.
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 -> CLIST & REXX Goto page 1, 2  Next

 


Similar Topics
Topic Forum Replies
No new posts Compile Several JCL JOB Through one r... CLIST & REXX 4
No new posts Running REXX through JOB CLIST & REXX 13
No new posts Error to read log with rexx CLIST & REXX 11
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts isfline didnt work in rexx at z/OS ve... CLIST & REXX 7
Search our Forums:

Back to Top