Pregunta

I need to pass the SYSUID and JOBID to the cobol program for logging purpose, how is this possible?,

can the same be passed as an input for a query in a JCL.

Thanks in advance.

¿Fue útil?

Solución

SYSUID is simple, you just add it to the PARM parameter of your EXEC statement.

//ASTEP EXEC PGM=A#PGM,PARM='&SYSUID'

JOBID isn't available as a parameter. You will have to write COBOL code to chain through z/OS control blocks (see the Data Areas books at that link) if you need it. This can be done, but I don't recommend it.

If you actually want to get the job number, you write code to go to the PSA control block, which is at relative memory location 0. From there you get a pointer to the current TCB which is in the PSATOLD field of the PSA, from the TCB you get the TCBJSCBB field which is a pointer to the JSCB, from the TCBJSCBB fielf in the JSCB you get a pointer to the SSIB which contains the SSIBJBID field which is the job number. All of these control blocks, PSA, TCB, JSCB, and SSIB are documented (for z/OS 2.4) at the link above. And I reiterate that I don't recommend doing this.

There's a tutorial on chaining through z/OS control blocks in two parts from Longpela.

Otros consejos

I agree with @cschneid that you don't want to do all of the pointer chaining just to get the job number. But of course we did do it while creating a "banner page printing" program. We based ours off the code at http://gsf-soft.com/Freeware/COB2JOB.shtml.

If you are comfortable with using SET ADDRESS OF items in the LINKAGE SECTION, REDEFINE--ing POINTER and COMP-5 items, along with creating 01 level structurs from assembler DSECTs, then by all means do it. As a lightweight COBOL subroutine, it's not that much more overhead than an assembler routine (but assembler is better). If you are comfortable with the REXX STORAGE function, you can look at Dave Alcock's IPLINFO program.

However, if the COBOL language constructs I mentioned are unknown to you, then write an assembler subroutine, or ask someone to write it.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top