# How to read UPSI switch in JCL from Natural batch program

**URL:** <https://techcommunity.softwareag.com/t/how-to-read-upsi-switch-in-jcl-from-natural-batch-program/309512>\
**Category:** Forum\
**Tags:** Adabas-Natural, Natural, Natural-on-Mainframes\
**Created:** [March 18, 2025, 10:20pm UTC](https://techcommunity.softwareag.com/t/how-to-read-upsi-switch-in-jcl-from-natural-batch-program/309512 "2025-03-18T22:20:42Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![EmadMarzouka](https://avatars.discourse-cdn.com/v4/letter/e/ecc23a/32.png) [@EmadMarzouka](https://techcommunity.softwareag.com/u/EmadMarzouka)\
**Post date:** [March 18, 2025, 10:20pm UTC](https://techcommunity.softwareag.com/t/how-to-read-upsi-switch-in-jcl-from-natural-batch-program/309512/1 "2025-03-18T22:20:42Z")

</div>

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)**

---

<div class="post-metadata">

**Author:** ![Ralph\_Zbrog](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/ralph_zbrog/32/78_2.png) [@Ralph\_Zbrog](https://techcommunity.softwareag.com/u/Ralph_Zbrog)\
**Post date:** [March 18, 2025, 10:36pm UTC](https://techcommunity.softwareag.com/t/how-to-read-upsi-switch-in-jcl-from-natural-batch-program/309512/2 "2025-03-18T22:36:01Z")

</div>

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

Have you checked the return code from the call?

---

<div class="post-metadata">

**Author:** ![Douglas\_Kelly](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/douglas_kelly/32/102_2.png) [@Douglas\_Kelly](https://techcommunity.softwareag.com/u/Douglas_Kelly)\
**Post date:** [March 18, 2025, 11:29pm UTC](https://techcommunity.softwareag.com/t/how-to-read-upsi-switch-in-jcl-from-natural-batch-program/309512/3 "2025-03-18T23:29:24Z")

</div>

Here’s the comment in v9.3:

```auto
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.

---

<div class="post-metadata">

**Author:** ![wolfgang.winter](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/wolfgang.winter/32/17954_2.png) [@wolfgang.winter](https://techcommunity.softwareag.com/u/wolfgang.winter)\
**Post date:** [March 19, 2025, 11:40am UTC](https://techcommunity.softwareag.com/t/how-to-read-upsi-switch-in-jcl-from-natural-batch-program/309512/4 "2025-03-19T11:40:43Z")

</div>

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

```auto
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".
```

---

<div class="post-metadata">

**Author:** ![EmadMarzouka](https://avatars.discourse-cdn.com/v4/letter/e/ecc23a/32.png) [@EmadMarzouka](https://techcommunity.softwareag.com/u/EmadMarzouka)\
**Post date:** [March 19, 2025, 5:53pm UTC](https://techcommunity.softwareag.com/t/how-to-read-upsi-switch-in-jcl-from-natural-batch-program/309512/5 "2025-03-19T17:53:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Neil\_Beesley9](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/neil_beesley9/32/37232_2.png) [@Neil\_Beesley9](https://techcommunity.softwareag.com/u/Neil_Beesley9)\
**Post date:** [March 19, 2025, 6:40pm UTC](https://techcommunity.softwareag.com/t/how-to-read-upsi-switch-in-jcl-from-natural-batch-program/309512/6 "2025-03-19T18:40:21Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/techcommunity/original/3X/c/d/cd19967bb605d28a72d77eb83a1cae22f3df2eb8.svg) [@system](https://techcommunity.softwareag.com/u/system)\
**Post date:** [September 15, 2025, 6:40pm UTC](https://techcommunity.softwareag.com/t/how-to-read-upsi-switch-in-jcl-from-natural-batch-program/309512/7 "2025-09-15T18:40:49Z")

</div>

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
