Re: getting the mainframe id in a cobol program

2008-09-23 Thread Walt Farrell
On Mon, 22 Sep 2008 12:48:16 -0500, Brain [EMAIL PROTECTED] wrote:
Could some one please help me mt to get the mainframe id when i execute the
cobol program, this id will hen be inserted in a table to see who has inserted
the record.

Your question leaves out one critical piece of information required for a
complete answer.  Where does that COBOL program run?  Batch?  CICS?  IMS? 
Elsewhere?

In particular, for CICS or IMS the required techniques differ from those for
batch.

-- 
  Walt Farrell, CISSP
  IBM STSM, z/OS Security Design

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html



Re: getting the mainframe id in a cobol program

2008-09-23 Thread Itschak Mugzach
The idea is to start at address 16H (CVT) and use variables defines as USAGE
POINTER to travel on the control blocks chain to the TCB. The is a good
sample here, as they already mapped the DSECTs to Cobol for you. See below:
 http://coding.derkeiler.com/Archive/Cobol/comp.lang.cobol/2003-10/0077.html

Regards,

ITschak

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html



Re: getting the mainframe id in a cobol program

2008-09-23 Thread Walt Farrell
On Tue, 23 Sep 2008 18:34:20 +0300, Itschak Mugzach [EMAIL PROTECTED] wrote:

The idea is to start at address 16H (CVT) and use variables defines as USAGE
POINTER to travel on the control blocks chain to the TCB. The is a good
sample here, as they already mapped the DSECTs to Cobol for you. See below:
 http://coding.derkeiler.com/Archive/Cobol/comp.lang.cobol/2003-10/0077.html

Sorry, Itschak, that's a good example, but it covers only the case of the
program running in batch.  It does not handle CICS transactions, IMS
transactions, etc.   COBOL program is too imprecise as a description. 
Where the program runs is perhaps more important to the original question.

-- 
  Walt Farrell, CISSP
  IBM STSM, z/OS Security Design

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html



Re: getting the mainframe id in a cobol program

2008-09-23 Thread Brain
Thanks for all for the respose to my query...

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html



getting the mainframe id in a cobol program

2008-09-22 Thread Brain
Hello.

Could some one please help me mt to get the mainframe id when i execute the 
cobol program, this id will hen be inserted in a table to see who has inserted 
the record.

Thanks,
RajeevV

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html



Re: getting the mainframe id in a cobol program

2008-09-22 Thread John McKown
On Mon, 22 Sep 2008 12:48:16 -0500, Brain [EMAIL PROTECTED] wrote:

Hello.

Could some one please help me mt to get the mainframe id when i execute the
cobol program, this id will hen be inserted in a table to see who has inserted
the record.

Thanks,
RajeevV

If you want a pure COBOL program, then it is going to be a bit complicated
to code and might someday fail because IBM could change things. You'd need
to do a lot of chain chasing. Instead, I would strongly suggest that you
use an assembler subroutine which uses the IAZXJSAB macro. This is the
correct, and documented, way to do it. The routine is very small:

USERID   CSECT
USERID   AMODE ANY
USERID   RMODE ANY
 SAVE  (14,12),,USERID
 LR11,15
 USING USERID,11
 CNOP  0,4
 BAS   2,*+76  BRANCH AROUND SAVE AREA
 DC18A(0)  SAVE AREA
 ST13,4(,2)SAVE REGISTER 13
 ST2,8(,13)SAVE BACK CHAIN
 LR13,2LOAD SAVE AREA POINTER
 L 2,0(,1) POINT TO RETURN AREA FOR USERID
 IAZXJSAB READ,X
   USERID=(2)
 L 13,4(,13)   POINT TO OLD SAVE AREA
 RETURN (14,12),T,RC=0 RETURN
 LTORG *
 IAZJSAB
 IHAASCB
 IHAASSB
 IHAPSA
 IKJTCB
 IHASTCB
 END   USERID

You call it via:

...
77  RUNNING_USER_ID PIC X(8).
...
 CALL USERID USING RUNNING_USER_ID.

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html



Re: getting the mainframe id in a cobol program

2008-09-22 Thread Mark Zelden
On Mon, 22 Sep 2008 12:48:16 -0500, Brain [EMAIL PROTECTED] wrote:

Hello.

Could some one please help me mt to get the mainframe id when i execute the
cobol program, this id will hen be inserted in a table to see who has inserted
the record.


Some a good sample on Gilbert Saint-Flour's web site:

http://home.comcast.net/~gsf/  

  .. then click on MVS Tools and Doc
 http://home.comcast.net/~gsf/tools/

.. then Retrieve System Information in COBOL. 
 http://gsf-soft.com/Freeware/COB2SYS.shtml


Mark
--
Mark Zelden
Sr. Software and Systems Architect - z/OS Team Lead
Zurich North America / Farmers Insurance Group - ZFUS G-ITO
mailto:[EMAIL PROTECTED]
z/OS Systems Programming expert at http://expertanswercenter.techtarget.com/
Mark's MVS Utilities: http://home.flash.net/~mzelden/mvsutil.html

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html



Re: getting the mainframe id in a cobol program

2008-09-22 Thread Mark Zelden
On Mon, 22 Sep 2008 12:48:16 -0500, Brain [EMAIL PROTECTED] wrote:

Hello.

Could some one please help me mt to get the mainframe id when i execute the
cobol program, this id will hen be inserted in a table to see who has inserted
the record.


Some a good sample on Gilbert Saint-Flour's web site:

http://home.comcast.net/~gsf/  

  .. then click on MVS Tools and Doc
 http://home.comcast.net/~gsf/tools/

.. then Retrieve Job Information in COBOL. 
   http://gsf-soft.com/Freeware/COB2JOB.shtml

.. also Retrieve System Information in COBOL. 
 http://gsf-soft.com/Freeware/COB2SYS.shtml


Mark
--
Mark Zelden
Sr. Software and Systems Architect - z/OS Team Lead
Zurich North America / Farmers Insurance Group - ZFUS G-ITO
mailto:[EMAIL PROTECTED]
z/OS Systems Programming expert at http://expertanswercenter.techtarget.com/
Mark's MVS Utilities: http://home.flash.net/~mzelden/mvsutil.html

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html



Re: getting the mainframe id in a cobol program

2008-09-22 Thread Roland Schiradin
Not sure what you by mainframe ID but Marks posting should help.

Roland

Hello.

Could some one please help me mt to get the mainframe id when i execute the
cobol program, this id will hen be inserted in a table to see who has inserted
the record.

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html