Concatenate many *CHAR variables.

250 pts.
Tags:
AS/400
CL variables
Concatenate
Variables
Is it possible to Concatenate many *CHAR variable in one same type variable. I've created a CL who will read records from one file and concatenate them in one varaible which i will use after in my CL. But after exiting the loop i got a varaible with the last record value so the concatenation doesn't work see my CL below : AUDLOOP: RCVF RCDFMT(LSTAUTHOS) OPNID(ID01) MONMSG (CPF0864) EXEC(GOTO ENDPGM2) CHGVAR VAR(&AUTHO) VALUE(%SST(&ID01_LSTAUTHOS 2 8)) SNDMSG MSG(&AUTHO) TOUSR(CGI_KB) CHGVAR VAR(&AUD) VALUE(&AUD *CAT &AUTHO) GOTO CMDLBL(AUDLOOP) Can someone help with this. Thanks a lot.

Software/Hardware used:
OS400

Answer Wiki

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

Change this statement
CHGVAR VAR(&AUD) VALUE(&AUD *CAT &AUTHO)
to this
CHGVAR VAR(&AUD) VALUE(&AUD *TCAT &AUTHO)

Noticed I change it from adding at the end *CAT to adding while ingnore the trailing blanks in the field (*TCAT)
Also lookup *BCAT in the manuals

Discuss This Question: 5  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
  • junioras400
    Hi Charlie Thanks for your quick response :) it's ok with *TCAT but i need to keep a blank between varaibles. like this : variable1 variable2 varaible3 varaiable4 with *TCAT i'm getting this : variable1variable2varaible3varaiable4 any suggestions :) thanks in advance.
    250 pointsBadges:
    report
  • CharlieBrowne
    Try this CHGVAR VAR(&AUD) VALUE(&AUD *TCAT ' ' *CAT &AUTHO) With this you are putting a single blank after the last valid character and then doing a normal *CAT adding &AUTHNO
    41,370 pointsBadges:
    report
  • CharlieBrowne
    Also, if it is possible that &AUTHNO contains a blank, you would have a problem. To resolve that, replace the ' ' in my previous example with '#' or any other special character.
    41,370 pointsBadges:
    report
  • TomLiotta
    it’s ok with *TCAT but i need to keep a blank between varaibles. Did you try CharlieBrowne's other suggestion: Also lookup *BCAT in the manuals Do you have access to the CL programming manual? Tom
    125,585 pointsBadges:
    report
  • junioras400
    Great Thanks Charlie. Thanks Tom... yes i do have access to CL Manuals.
    250 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