List parms

pts.
Tags:
AS/400
CLP
Development
I am trying to pass a list parm from my command to the CL. I need help. Mike

Answer Wiki

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

When you are passing a list parameter the first two bytes of the parameter is a binary value that says how many list elements you sent.
For example you are sending a parm that has up to 12 library names possible that can be sent. The parm would be defined in the CL as character and 122 bytes long. Extract the first two positions of this 122 bytes using %BINARY into a decimal variable. This tells you the count of how many libraries were passed from 1 to 12. Use this counter to substring through the last 120 characters to find the library names.

Discuss This Question: 4  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
  • HowieK
    1. Add the PARM parameter to the PGM statement in your CL for each value you want to pass. 2. Add a DCL with the correct attributes for each PARM. NOTE: I pass all parms as *CHAR and do the conversion with CHGVAR. 3. Call the program specifying the value for the PARMs. Each value should be enclosed in single quotes.
    0 pointsBadges:
    report
  • JPLamontre
    Can you send the command source ? so I could propose you a backbone
    0 pointsBadges:
    report
  • Byimw02
    TCSRERUN:PGM PARM(&EXCHINFO &PROCDATE &DATALIB &ABSHRRN + ALLTRADES &COPYMIS) DCL VAR(&EXCHINFO) TYPE(*CHAR) LEN(58) DCL VAR(&PROCDATE) TYPE(*CHAR) LEN(7) DCL VAR(&DATALIB) TYPE(*CHAR) LEN(10) DCL VAR(&ABSHRRN) TYPE(*DEC) LEN(15 5) DCL VAR(&ALLTRADES) TYPE(*CHAR) LEN(1) DCL VAR(&COPYMIS) TYPE(*CHAR) LEN(1) DCL VAR(&EXCHANGE) TYPE(*CHAR) LEN(4) DCL VAR(&NBREXCH) TYPE(*DEC) LEN(2) DCL VAR(&OFFSET) TYPE(*DEC) LEN(3) VALUE(3) DCL VAR(&LGTH) TYPE(*DEC) LEN(3) VALUE(4) DCL VAR(&EXCHANGE) TYPE(*CHAR) LEN(4) DCL VAR(&T4FILE) TYPE(*CHAR) LEN(4) CHGVAR VAR(&NBREXCH) VALUE(%BIN(&EXCHINFO 1 2)) EXCHLOOP: IF COND(&NBREXCH = 0) THEN(GOTO CMDLBL(ENDPGM)) CHGVAR VAR(&EXCHANGE) VALUE(%SST(&EXCHINFO &OFFSET + &LGTH)) CHGVAR VAR(&OFFSET) VALUE(&OFFSET + &LGTH) CHGVAR VAR(&T4FILE) VALUE(%SST(&EXCHINFO &OFFSET &LGTH)) CHGVAR VAR(&OFFSET) VALUE(&OFFSET + &LGTH) FLRDFILES: IF COND(*NOT &FLR *AND (EXCHANGE = 'AMEX' *OR &EXCHANGE = 'NYSE')) THEN(DO) CHGVAR VAR(%SST(&FLRD 5 4)) VALUE(&MMDD) || || CHGVAR VAR(&NBREXCH) VALUE(&NBREXCH -1) GOTO CMDLBL(EXCHLOOP) Sorry for the crude editing. The 1st parm is the list and &NBREXCH is the list counter. I pull the qualified names for (4+4=8 for a max list of 7 items (8*7=56 + the 2 bytes for the binary number = 58 size for &EXCHINFO) I progress thru the loop for the number of items entered. You are welcome to email me if you have any questions.
    0 pointsBadges:
    report
  • JPLamontre
    ok, you have sent the clp. I asked for the command. What is exactly the issue ? calling a command from a clp or calling a clp from a command ?
    0 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