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
         LR    11,15
         USING USERID,11
         CNOP  0,4
         BAS   2,*+76              BRANCH AROUND SAVE AREA
         DC    18A(0)              SAVE AREA
         ST    13,4(,2)            SAVE REGISTER 13
         ST    2,8(,13)            SAVE BACK CHAIN
         LR    13,2                LOAD 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

Reply via email to