NATURAL Helproutines and OPTIONAL Parameters

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

try

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.

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