Parameter list is not refreshed from previous calls

15 pts.
Tags:
AS/400
CL programming
Command Source
COMMANDS
CPP
iSeries
Parameter list -AS400
Validation
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?

Answer Wiki

Thanks. We'll let you know when a new response is added.

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

Discuss This Question: 2  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Rohithsharma84
    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 pointsBadges:
    report
  • TomLiotta
    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
    125,585 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following