How to read UPSI switch in JCL from Natural batch program

I tried user exit example USR4002P but #UPSI result is always ‘XXXXXXXX’.
Can someone confirm if this user exit works for retrieving UPSI value? or does it work only for certain Natural versions or platforms!

Is there any other way to retrieve UPSI switch value in Natural program?

Thanks!

***Natural version 8.2.5.6 on z/VSE

*Question is related to a production (customer)

Sorry. I’m already on Natural 9.2.1, where UPSI is obsolete.

Have you checked the return code from the call?

Here’s the comment in v9.3:

0730     4    #PROGRAM (A8)    /* profile parameter PROGRAM current setting  
0740 /*  4    FILLER   8X      /* **Obsolete parameter UPSI removed for NAT92**  
0750     4    #JOBID   (A8)    /* Job ID (Replaces obsolete PARM UPSI -NAT92)
0760     4    #SUBSID  (A4)    /* profile parameter SUBSID current setting

So, appears that #JOBID replaced #UPSI as of NAT92, but I’m not sure if you will get anything different than all X’s that you are currently seeing. On the z/OS system I’m looking at, #JOBID contains the system generated JES job number.

The UPSI value you get from USR4002P refers to the NATURAL profile parameter UPSI which is, as Ralph & Douglas mentioned,
no longer available with NATURAL 9, not to the setting of the UPSI byte itself.

To get the UPSI value in a NATURAL program you will need a small interface routine like this

GETUPSI  CSECT
         USING *,12
         SAVE  (14,12)                                          
         LR    12,15                                               
*
         L     2,0(0,1)    Address of Parameter from NATURAL (A1)
         COMRG                                                   
         MVC   0(1,2),23(1)                                   
*
         RETURN (14,12)
                                      

Assemble it, link it, make it available to NATURAL, CALL GETUPSI with a parameter of format A1,
then use USR1028N to decode the UPSI byte into "bits".

Thanks to all who responded. Wolfgang’s solution is what I expected and hoped to see. Best regards!

Generalized routine for this:

  • R1 => PARAMETER; R2=> LENGTH
    SUBUPSI DS 0H
    stm R14,R12,12(r13)
    la r0,sva2
    st r13,sva2+4
    st r0,8(,r13)
    lr r13,r0