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
 

 

getting JOBID in the JCL

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
antonrino.b

New User


Joined: 10 Jan 2006
Posts: 76
Location: Germany

PostPosted: Tue Aug 08, 2006 12:47 pm    Post subject: getting JOBID in the JCL
Reply with quote

Hi,

I have a JCL to run a COBOL program which inserts a row into table tableA. While inserting, it populates the column Entry-id of the table with the JOBID.

After running the JCL, I have to submit the following query to check whether the row has been inserted.

Select * from tableA where Entry-id=<JOBID>.

I want to include this query submission in the JCL itself. For which I need the JOBID of the jcl being submitted. Is it possible to get that?

Thanks,
Antu
Back to top
View user's profile Send private message

narasimha_devi
Warnings : 1

New User


Joined: 10 Mar 2005
Posts: 26

PostPosted: Tue Aug 08, 2006 2:18 pm    Post subject: Re: getting JOBID in the JCL
Reply with quote

Hi,

OPTION 1:
You can pass Job-ID thru SYSIN.

//sysin dd *
job-id

This you can accept in your cobol program.

OPTION 2:
you can pass JOB-ID as data

//ddjobid dd *
job-id

In your cobol program allocate a file assigning to "ddjobid".
Read the file once to get the job-id.

Thanks
Devi
Back to top
View user's profile Send private message
antonrino.b

New User


Joined: 10 Jan 2006
Posts: 76
Location: Germany

PostPosted: Tue Aug 08, 2006 3:06 pm    Post subject:
Reply with quote

JOBID is assigned only at the time of JCL submission. My COBOL program already picks up the JOBID and uses it while inserting into table.

I need that for my inline SPUFI query, which I want to add next to my COBOL program run step.

Hope I am clear about my requirement.

Thanks,
Antu
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: Tue Aug 08, 2006 6:09 pm    Post subject: Re: getting JOBID in the JCL
Reply with quote

Why doesn't your COBOL program get this information automatically?
Back to top
View user's profile Send private message
antonrino.b

New User


Joined: 10 Jan 2006
Posts: 76
Location: Germany

PostPosted: Tue Aug 08, 2006 6:19 pm    Post subject:
Reply with quote

No, My COBOL program automatically gets this information.

I need the jobid for executing the query as inline in JCL after the completion of cobol program.

Code:
//cobrun job-acc-info
****
//steplib dd dsn=my.pgm.lib
step1 exec pgm=pgmname
.
.
.

****
//step2 exec dsn=my.db.load
.
.
//systsin dd *
Select * from tableA where Entry-id=<JOBID> <--- here i need the jobid
Back to top
View user's profile Send private message
narasimha_devi
Warnings : 1

New User


Joined: 10 Mar 2005
Posts: 26

PostPosted: Wed Aug 09, 2006 11:21 am    Post subject: Re: getting JOBID in the JCL
Reply with quote

Hi,

If this table is inserted by only one JOB then we can get job-id using subquery.

//systsin dd *
Select * from tableA where Entry-id= (select JOBID from tableA fetch FIRST ROW ONLY)

If your table is inserted/updated with only one JOB then it picks the JOBID from first row and then assign the JOBID to Entry-Id in where clause.

Try this..
Back to top
View user's profile Send private message
antonrino.b

New User


Joined: 10 Jan 2006
Posts: 76
Location: Germany

PostPosted: Wed Aug 09, 2006 11:40 am    Post subject:
Reply with quote

No devi, it is updated by many programs simultaneously..
Back to top
View user's profile Send private message
narasimha_devi
Warnings : 1

New User


Joined: 10 Mar 2005
Posts: 26

PostPosted: Wed Aug 09, 2006 12:16 pm    Post subject: Re: getting JOBID in the JCL
Reply with quote

Hi,

If it is updated with multiple Jobs then what you want to check in your sql query?

if you want to check whether rows are inserted or not then why dont you add the sql query in the same Job where you are executing the cobol program to insert rows.
Back to top
View user's profile Send private message
antonrino.b

New User


Joined: 10 Jan 2006
Posts: 76
Location: Germany

PostPosted: Wed Aug 09, 2006 1:46 pm    Post subject:
Reply with quote

That is my requirement. I want to add the sql query in the same job.

I was trying to get the JOBID of the job being submitted, in the same job itself to execute the query.

Anyway, I will try running the query with "fetch first one row". But are you sure, that it will return the most recent row?
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2360
Location: Israel

PostPosted: Wed Aug 09, 2006 1:52 pm    Post subject:
Reply with quote

Here is my solution: Insert additional step between the COBOL and your SELECT.

In this step, put a REXX exec that gets the jobid and generate the SYSTSIN for the next step. You can use temporary file with DISP=(NEW,PASS) in the REXX setp, and DISP=(OLD,DELETE,DELETE) in the next step.

To get jobid from REXX, you may try the following code:
Code:
/* REXX */                                   
/* Get jobid: CURRENT_TCB->JSCB->SSIB */     
numeric digits 24 ; TRACE I                   
cvtptr=storage(10,4)   /*CVT*/               
psatcb=storage(d2x(c2d(cvtptr)),4)           
currtcb=storage(d2x(c2d(psatcb)),4)           
tcbjscb=storage(d2x(c2d(currtcb)+x2d(B4)),4) 
jscbssib=storage(d2x(c2d(tcbjscb)+x2d(13c)),4)
ssibjbid=storage(d2x(c2d(jscbssib)+x2d(c)),8)
say 'jobid='ssibjbid                         
return 0                                     


Enjoy.

O.
Back to top
View user's profile Send private message
narasimha_devi
Warnings : 1

New User


Joined: 10 Mar 2005
Posts: 26

PostPosted: Wed Aug 09, 2006 2:14 pm    Post subject: Re: getting JOBID in the JCL
Reply with quote

Hi,


If you are adding SQL query in the same job then you can use the job-id which is passed to cobol.
Otherwise job-id which is defined in jobcard.

Fetch first row only will retrieve the first row from the table not the latest one.

In ur table if you have current date or current time stamp then you can get latest row from the table using max(timstamp/date column) in subquery.

Thanks
Devi
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Regarding 'TSO OUTPUT jobname(jobid)' Arunkumar Chandrasekaran TSO/ISPF 17 Thu Oct 30, 2014 3:53 pm
No new posts Address TSO STATUS JOBNAME - Not gett... kumjara CLIST & REXX 4 Thu Feb 27, 2014 12:46 pm
No new posts How can I get jobid of a submitted jo... ppandey07 JCL & VSAM 24 Mon Aug 08, 2011 6:30 pm
No new posts Recovering compiler listing using jobid Robert Sample TSO/ISPF 1 Wed May 11, 2011 5:50 pm
No new posts Changing JOBID using REXX saagu CLIST & REXX 3 Wed Jul 21, 2010 12:55 pm


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