15 pts.
 Parameter list is not refreshed from previous calls
I created a command with validity checker defined. The validation work fine but the parameter list is not refreshed from previous calls to the command. I've defined a simple list for "user name " parameter in my command. If I give 3 user names (A, B, & C) in the list, in the next call even if I enter just 1 name (say, D), the program receives users as D, B, & C. The Validity checker and the CPP are written in CL. Can you suggest what I may be missing?

Software/Hardware used:
ASKED: June 8, 2009  6:02 PM
UPDATED: October 22, 2009  2:32 AM

Answer Wiki:
Because the command is reusing space, you will see previous values in a list even if they are not now 'valid'. In a simple list in a command definition, the first two bytes of the parameter passed to the CPP and to the validity checker are a binary number which tells you the number of entries in the list. Your validity checking program must look at this value and see how many values are ACTUALLY being returned. In the example you give, this will be 3 for the first call, and 1 for the second call. In CL, nowadays (CLLE), you can use the %BIN function to return the value in a decimal variable. Previously, you would have had to use a sort of 'lookup' on a hex string to get a single number you could understand in your CL program Regards, Sloopy
Last Wiki Answer Submitted:  June 9, 2009  2:45 pm  by  Sloopy   2,195 pts.
All Answer Wiki Contributors:  Sloopy   2,195 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

Hi Sloopy,

Thanks for looking into this.

I have been checking the length the same way you mentioned… may be I got it wrong so I’m pasting the code below. Please take a look.

This is the the parameter as defined in the command source:
PARM KWD(USER1) TYPE(*NAME) LEN(10) +
MIN(1) MAX(3) CHOICE(‘Name’) PROMPT(‘User +
Profile(s)’)

This is the piece from the validity checker:
CHGVAR VAR(&USER#) VALUE(%BINARY(&USER1 1 2))

Strangely enough, even if I do not enter more than 1 value in the list, it still returns the number as 3 based on my previous call.

 15 pts.

 

Please supply OS version/release and cumulative PTF level.

Also, please supply (1) a little more code and (2) the command used to compile the validity checker. Other questions might follow based on those answers.

Tom

 107,845 pts.