MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Userkey of user who submitted job

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
bauer
Intermediate


Joined: 10 Oct 2003
Posts: 315
Topics: 49
Location: Germany

PostPosted: Wed Jan 14, 2004 5:04 am    Post subject: Userkey of user who submitted job Reply with quote

Hi,

MVS Batchprogram, coded in PL1 (Assembler, cobol ....), is called by using JCL, controlled using JES2.

Is is possible to find out the User Key of the user, who submitted the job (reading controlblock information, using assembly macro ....... ???????) ?


Thanks for any hints.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Wed Jan 14, 2004 9:07 am    Post subject: Reply with quote

bauer,

Following is the cobol code written by gilber saint-flour which will give you the desired results.

Code:

 CBL NOLIB,APOST,NODECK,OBJECT,NOSEQ,BUF(10000),NONAME                 
 CBL NOMAP,NOLIST,NOOFFSET,NOXREF                                       
       IDENTIFICATION DIVISION.                                         
         PROGRAM-ID. COB2JOB.                                           
         AUTHOR. GILBERT SAINT-FLOUR <GSF@POBOX.COM>.                   
      *----------------------------------------------------------------*
      *                                                                *
      *    THIS PROGRAM RETRIEVES SPECIFIC JOB-RELATED DATA FROM MVS   *
      *    CONTROL BLOCKS AND MOVES IT TO WORKING-STORAGE.             *
      *                                                                *
      *    THE NAME OF THE CONTROL-BLOCK IS INDICATED IN POS 1-6 OF    *
      *    THE PROCEDURE DIVISION LINES.                               *
      *    THE LAYOUT OF THE MVS CONTROL BLOCKS IS DESCRIBED IN THE    *
      *    MVS DATA AREAS MANUALS, WHICH CAN BE FOUND ON ANY MVS OR    *
      *    OS/390 CD COLLECTION OR VIEWED ON-LINE BY GOING TO:         *
      *        HTTP://WWW.S390.IBM.COM/BOOKMGR-CGI/BOOKMGR.CMD/LIBRARY *
      *    AND SEARCHING FOR:                                          *
      *        MVS DATA AREAS                                          *
      *----------------------------------------------------------------*
       DATA DIVISION.                                                   
        WORKING-STORAGE SECTION.                                       
         01 RESULTS.                                                   
           05 JOB-NAME PIC X(8).                                       
           05 PROC-STEP PIC X(8).                                       
           05 STEP-NAME PIC X(8).                                       
           05 PROGRAM-NAME PIC X(8).                                   
           05 PROGRAM-NAME2 PIC X(8).                                   
           05 JOB-NUMBER PIC X(8).                                     
           05 JOB-CLASS PIC X.                                         
           05 MSG-CLASS PIC X.                                         
           05 PROGRAMMER-NAME PIC X(20).                               
           05 USER-ID PIC X(8).                                         
           05 GROUP-NAME PIC X(8).                                     
           05 USER-NAME PIC X(20).                                     
           05 BATCH-OR-CICS PIC X(5).                                   
              88 BATCH VALUE 'BATCH'.                                   
              88 CICS  VALUE 'CICS '.                   
           05 MICRO-SECONDS PIC S9(15) COMP-3.                         
         01 FOUR-BYTES.                                                 
           05 FULL-WORD PIC S9(8) COMP.                                 
           05 PTR4      REDEFINES FULL-WORD POINTER.                   
        LINKAGE SECTION.                                               
         01 CB1.  05 PTR1 POINTER OCCURS 256.                           
         01 CB2.  05 PTR2 POINTER OCCURS 256.                           
       PROCEDURE DIVISION.                                             
 PSA       SET ADDRESS OF CB1 TO NULL                                   
 TCB       SET ADDRESS OF CB1 TO PTR1(136)                             
           SET PTR4 TO PTR1(83)                                         
           COMPUTE MICRO-SECONDS = FULL-WORD * 1048576                 
           SET PTR4 TO PTR1(84)                                         
           COMPUTE MICRO-SECONDS = MICRO-SECONDS + (FULL-WORD / 1024)   
 TIOT      SET ADDRESS OF CB2 TO PTR1(4)                               
           MOVE CB2(1:8) TO JOB-NAME                                   
           MOVE CB2(9:8) TO PROC-STEP                                   
           MOVE CB2(17:8) TO STEP-NAME                                 
 JSCB      SET ADDRESS OF CB2 TO PTR1(46)                               
           MOVE CB2(361:8) TO PROGRAM-NAME                             
 SSIB      SET ADDRESS OF CB2 TO PTR2(80)                               
           MOVE CB2(13:8) TO JOB-NUMBER                                 
 PRB       SET ADDRESS OF CB2 TO PTR1(1)                               
           MOVE CB2(97:8) TO PROGRAM-NAME2                             
 JSCB      SET ADDRESS OF CB2 TO PTR1(46)                               
 JCT       SET ADDRESS OF CB2 TO PTR2(66)                               
           MOVE CB2(48:1) TO JOB-CLASS                                 
           MOVE CB2(23:1) TO MSG-CLASS                                 
 ACT       MOVE ZERO TO FULL-WORD                                       
           MOVE CB2(57:3) TO FOUR-BYTES(2:3)                           
           SET ADDRESS OF CB2 TO PTR4                                   
           MOVE CB2(25:20) TO PROGRAMMER-NAME                           
 EXT2      SET ADDRESS OF CB2 TO PTR1(53)                               
 CAUF      IF CB2(21:4) = LOW-VALUES THEN                               
             SET BATCH TO TRUE                                         
           ELSE                                                         
             SET CICS TO TRUE                                           
           END-IF                                                       
 PSA       SET ADDRESS OF CB1 TO NULL                                                 
 ASCB      SET ADDRESS OF CB1 TO PTR1(138)                 
 ASXB      SET ADDRESS OF CB2 TO PTR1(28)                 
           MOVE CB2(193:8 ) TO USER-ID                     
 ACEE      SET ADDRESS OF CB2 TO PTR2(51)                 
           MOVE CB2(31:8 ) TO GROUP-NAME                   
 UNAM      SET ADDRESS OF CB1 TO PTR2(26)                 
           MOVE ZERO TO FULL-WORD                         
           MOVE CB1(1:1) TO FOUR-BYTES(4:1)               
           MOVE CB1(2:FULL-WORD) TO USER-NAME
             
           DISPLAY 'THE JOB NAME    : ' JOB-NAME           
           DISPLAY 'THE JOB NUMBER  : ' JOB-NUMBER         
           DISPLAY 'THE JOB CLASS IS: ' JOB-CLASS         
           DISPLAY 'THE MSG CLASS IS: ' MSG-CLASS         
           DISPLAY 'THE USER ID IS  : ' USER-ID           
           DISPLAY 'THE USER NAME IS: ' USER-NAME         

           GOBACK.                                                       



Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu


Last edited by kolusu on Mon Sep 20, 2004 1:42 pm; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website
bauer
Intermediate


Joined: 10 Oct 2003
Posts: 315
Topics: 49
Location: Germany

PostPosted: Thu Jan 15, 2004 1:42 pm    Post subject: Reply with quote

kolusu,

very good information, control block ASXB is correct, Pl1 solution looks like this:
Code:

   /* PREFIXED SAVE AREA */
    DCL 1 PSA             BASED(SYSNULL()),
           2 FILLER       CHAR(548),
           2 PSAAOLD      PTR      ;
 
    /* ADRESS SPACE CONTROL BLOCK */
    DCL 1 ASCB            BASED(PSA.PSAAOLD) ,
           2 FILLER       CHAR(108) ,
           2 ASCBASXB     PTR   ;
 
    /* ADRESS SAPCE EXTENSION BLOCK */
    DCL 1 ASXB            BASED(ASCB.ASCBASXB) ,
           2 FILLER       CHAR(192) ,
           2 ASXBUSER     CHAR(7)   ;
 
   PUT SKIP EDIT('"',ASXB.ASXBUSER,'"')(A,A,A);
Back to top
View user's profile Send private message
Cogito-Ergo-Sum
Advanced


Joined: 15 Dec 2002
Posts: 637
Topics: 43
Location: Bengaluru, INDIA

PostPosted: Mon Sep 20, 2004 12:57 pm    Post subject: Reply with quote

Kolusu,
The 05 level in the PROCEDURE DIVISION (below PSA) in your post is a typo?

http://gsf-soft.com/Freeware/COB2JOB.shtml


BTW, does merely coding the LINKAGE SECTION bring in the control block information? I am not sure, how this program works. Rolling Eyes
_________________
ALL opinions are welcome.

Debugging tip:
When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
-- Sherlock Holmes.
Back to top
View user's profile Send private message
Cogito-Ergo-Sum
Advanced


Joined: 15 Dec 2002
Posts: 637
Topics: 43
Location: Bengaluru, INDIA

PostPosted: Mon Sep 20, 2004 1:34 pm    Post subject: Reply with quote

Ok, got it. It is there in MVS Data Area Manual.

The PSA maps the storage that starts at location 0 for the related processor.

Thus, the based on NULL or SYSNULL automatically points to PSA.
_________________
ALL opinions are welcome.

Debugging tip:
When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
-- Sherlock Holmes.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Mon Sep 20, 2004 1:41 pm    Post subject: Reply with quote

Cogito,

The definition for 05 MICRO-SECONDS PIC S9(15) COMP-3. was indeed a typo. I am editing the post to remove it.

Check this link for MVS Data Area Manuals .

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/FINDBOOK?filter=mvs+data+areas&Collection=0

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
bauer
Intermediate


Joined: 10 Oct 2003
Posts: 315
Topics: 49
Location: Germany

PostPosted: Mon Sep 20, 2004 2:16 pm    Post subject: Reply with quote

Hi,

yes, datatype was invalid. I agree, but for my problem this field was not for any interest.

I think, the pl1 soloution looks not so difficult. thank god, I'm pl1 programmer, not cobol programmer.

regards,
bauer
Back to top
View user's profile Send private message
Cogito-Ergo-Sum
Advanced


Joined: 15 Dec 2002
Posts: 637
Topics: 43
Location: Bengaluru, INDIA

PostPosted: Mon Sep 20, 2004 2:33 pm    Post subject: Reply with quote

Actually, I tried the PL/I solution. Fewer lines to code. Wink

Bauer,
Is there any place where I can get the address of new PSW? Basically, I want the address of the would-be instruction. I tried the PSA map; but, I am not sure.
_________________
ALL opinions are welcome.

Debugging tip:
When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
-- Sherlock Holmes.
Back to top
View user's profile Send private message
bauer
Intermediate


Joined: 10 Oct 2003
Posts: 315
Topics: 49
Location: Germany

PostPosted: Tue Sep 21, 2004 1:26 am    Post subject: Reply with quote

Cogito-Ergo-Sum,

sorry, no idea.

regards,
bauer
Back to top
View user's profile Send private message
vak255
Intermediate


Joined: 10 Sep 2004
Posts: 384
Topics: 79

PostPosted: Mon Nov 29, 2004 5:06 am    Post subject: would you please explain why address of CB1 is moved to PTR1 Reply with quote

Hi kolusu,
would you please explain why address of CB1 is moved to PTR1(138) and why 138 particularly
Rolling Eyes
Code:
ASCB      SET ADDRESS OF CB1 TO PTR1(138)                 
ASXB      SET ADDRESS OF CB2 TO PTR1(28)                 
           

what do you mean by typo
Back to top
View user's profile Send private message
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Mon Nov 29, 2004 5:32 am    Post subject: Reply with quote

Vak255,

When counted from PSA, ASCB is located at offset 544. ((138 - 1) * 4 = 544). When you refer it using COBOL Pointers, each pointer variable occupies 4 bytes. So 138 * 4 gives 548 but since the addressing starts from ZERO you need subtract another 4 from the result which is equivalent to (138 - 1) * 4.

Let us know if you need more information.

TypO: Its nothing but "Error During Typing". Wink

Thanks,
Phantom
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group