# NATURAL Helproutines and OPTIONAL Parameters

**URL:** <https://techcommunity.softwareag.com/t/natural-helproutines-and-optional-parameters/78370>\
**Category:** Forum\
**Tags:** Adabas-Natural, Natural, Natural-News-and-General-Topics\
**Created:** [June 19, 2008, 1:41am UTC](https://techcommunity.softwareag.com/t/natural-helproutines-and-optional-parameters/78370 "2008-06-19T01:41:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Arieh\_Siegal](https://avatars.discourse-cdn.com/v4/letter/a/87869e/32.png) [@Arieh\_Siegal](https://techcommunity.softwareag.com/u/Arieh_Siegal)\
**Post date:** [June 19, 2008, 1:41am UTC](https://techcommunity.softwareag.com/t/natural-helproutines-and-optional-parameters/78370/1 "2008-06-19T01:41:30Z")

</div>

I am maintaining a Helproutine called RFSTATH1 which has PARAMETER values defined as follows:

0230 DEFINE DATA  
0240 PARAMETER  
0250 1 RFSTATH1  
0260 2 SEL-DECODE (A20) BY VALUE RESULT OPTIONAL  
0270 2 SEL-KEY (A2)  
0280 LOCAL USING RF0000AF  
0290 LOCAL USING CO0000A3  
0300 END-DEFINE

In order to test out how the ‘BY VALUE RESULT OPTIONAL’ works on the first (explicit) parameter, I wrote an ad-hoc that looks like this:

0060 DEFINE DATA  
0070 LOCAL  
0080 1 RFSTATH1  
0090 2 SEL-DECODE (A20)  
0100 2 SEL-KEY (A2)  
0110 END-DEFINE  
0120 \*  
0140 MOVE ‘TX’ TO SEL-KEY  
0150 \*  
0160 INPUT (AD=M) ‘=’ SEL-KEY (HE=‘RFSTATH1’,‘SEL-DECODE’)  
0170 \*  
0180 WRITE ‘=’ SEL-DECODE  
0190 / ‘=’ SEL-KEY  
0200 END

(Note: The Helproutine puts up a list of valid State Codes & allows user to select one)

Alas, when I run this, and then select a state (e.g. ‘CT’) from the Helproutine, the corresponding SEL-DECODE value (which, with NATURAL DEBUGGER and DIsplay VAriable feature, I verified really is populated with ‘CONNECTICUT’ within RFSTATH1), is being written as blank on my WRITE statement.

This is making me think that the parm value really isn’t getting passed back…either that, or I’m doing something wrong in my Helproutine invocation.

Ideas??

Thanks - Arieh

---

<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:** [June 19, 2008, 10:45am UTC](https://techcommunity.softwareag.com/t/natural-helproutines-and-optional-parameters/78370/2 "2008-06-19T10:45:06Z")

</div>

try

```auto
0160 INPUT (AD=M) '=' SEL-KEY (HE='RFSTATH1',SEL-DECODE) 
```

The helproutine cannot return a value to a literal ‘SEL-DECODE’ - it needs a variable, eg SEL-DECODE.

---

<div class="post-metadata">

**Author:** ![Arieh\_Siegal](https://avatars.discourse-cdn.com/v4/letter/a/87869e/32.png) [@Arieh\_Siegal](https://techcommunity.softwareag.com/u/Arieh_Siegal)\
**Post date:** [June 19, 2008, 8:07pm UTC](https://techcommunity.softwareag.com/t/natural-helproutines-and-optional-parameters/78370/3 "2008-06-19T20:07:21Z")

</div>

Thanks Douglas. I had a feeling I was doing something dumb…I had the quotes there from a previous test & forgot to take them out.

Arieh

---

<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:** [April 2, 2021, 2:50pm UTC](https://techcommunity.softwareag.com/t/natural-helproutines-and-optional-parameters/78370/4 "2021-04-02T14:50:32Z")

</div>


