Page 1 of 1

Retrieving &SYSUID

PostPosted: Mon May 02, 2011 4:20 pm
by Puffe
Hi,

I know that I can use symbol parameter &SYSUID in a sequential filename and together with the NOTIFY-statement.
But, now I wonder if it's possible to get the actual value from &SYSUID and put it in a record in a sequential file ??

Yours sincerely,

Mikael

Re: Retrieving &SYSUID

PostPosted: Mon May 02, 2011 4:39 pm
by Robert Sample
Write a short program in the language of your choice to take the value from the PARM= and write it to the file. The user id is substituted in PARM='&SYSUID' and becomes available to the program.

Re: Retrieving &SYSUID

PostPosted: Mon May 02, 2011 5:56 pm
by steve-myers
To extend Mr. Sample's idea: the userid is available in a control block called the ACEE, which any program can locate, though it's not easy. While the ACEE is considered to be a RACF control block, the other two major security systems (ACF2 and Top Secret) maintain an ACEE and fill in at least basic security data, though not as much as RACF, and that includes the userid.

Re: Retrieving &SYSUID

PostPosted: Mon May 02, 2011 7:14 pm
by prino
In REXX:
ascb = storage(224,4)                             /* psaaold  */
asxb = storage(d2x(c2d(ascb) + 108),4)            /* ascbasxb */
                                                  /*___racf___*/
acee = storage(d2x(c2d(asxb) + 200),4)            /* acee     */
unam = storage(d2x(c2d(acee) + 100),4)            /* aceeunam */
user_name = strip(storage(d2x(c2d(unam) + 1),20))


In PL/I, from a running job:

dcl p1               ptr init (ptrvalue(16)) static;
dcl 1 s1 based(p1),
      2 p2           ptr;
dcl 1 s2 based(p2),
      2 p3           ptr;
dcl 1 s3 based(p3),
      2 *            ptr,
      2 tcb_ptr      ptr;
dcl 1 tcb based(tcb_ptr),
      2 *(3)         ptr,
      2 tiot_ptr     ptr,
      2 *(41)        ptr,
      2 jscb_ptr     ptr;
dcl 1 tiot based(tiot_ptr),
      2 jobname      char (8),
      2 stepname     char (8);
dcl 1 jscb based(jscb_ptr),
      2 *(65)        ptr,
      2 jscbjct      ptr,
      2 *(13)        ptr,
      2 jscbssib     ptr;
dcl 1 jct based(jscbjct),
      2 *(5)         ptr,
      2 *            char,
      2 jctjstat     bit  (8),
      2 *            char (2),
      2 jctjname     char (8),            /* job name                */
      2 *(4)         ptr,
      2 jctsdkad     char (3),            /* sva of first sct        */
      2 *            char,
      2 jctjctx      char (3),            /* sva of jctx             */
      2 *            char,
      2 jctactad     char (3),            /* sva of first act        */
      2 *            char,
      2 *(26)        ptr,
      2 *            char,
      2 jmrjmrjd     fixed dec(5,3),      /* job start date (julian) */
      2 *(2)         ptr,
      2 jctuser      char (7),            /* job user id             */
      2 *            char,
      2 jctacode     char (4);            /* job abend code          */

Re: Retrieving &SYSUID

PostPosted: Tue May 03, 2011 12:33 am
by Frank Yaeger
Mikael,

You can use a DFSORT job like the following to do what you asked for:

//S1 EXEC PGM=SORT,PARM='JP1"&SYSUID"'
//SYSOUT DD SYSOUT=*
//SORTIN DD *
RECORD
//SORTOUT DD SYSOUT=*
//SYSIN DD *
  OPTION COPY
  INREC BUILD=(JP1)
/*


For complete information on this technique, see "SET and PROC symbols in control statements" at:

http://www.ibm.com/support/docview.wss? ... g3T7000242

Re: Retrieving &SYSUID

PostPosted: Tue May 03, 2011 10:34 am
by Puffe
I've tried your solution Frank but I couldn't get it to work.
I got rc=16.

I wrote following

//STEP02   EXEC SORT,PARM='JP1"&SYSUID"'
//*                                     
//SYSOUT   DD SYSOUT=*                   
//SORTIN   DD *                         
RECORD                                   
//SORTOUT  DD DSN=MIKE.TEST.USERID1,     
//            DISP=(,CATLG),             
//            DATACLAS=TL               
//SYSIN    DD *                         
  OPTION COPY                           
  INREC BUILD=(JP1)                     
/*     


The result from the execution

ICE067I 0 INVALID PARAMETER IN JCL EXEC PARM OR INVOKED PARM LIST 
            OPTION COPY                                           
            INREC BUILD=(JP1)                                     
                         Ã…                                         
ICE007A 1 SYNTAX ERROR

Re: Retrieving &SYSUID

PostPosted: Tue May 03, 2011 5:24 pm
by Puffe
At my company we haven't upgrade to the version where I can use JPx-commands.

We have version
ICE201I G

Re: Retrieving &SYSUID

PostPosted: Tue May 03, 2011 10:24 pm
by Frank Yaeger
Yes, that would explain it. Ask your System Programmer to install z/OS DFSORT V1R10 PTF UK90025 or z/OS DFSORT V1R12 PTF UK90026 (Oct, 2010)