250 pts.
 Concatenate many *CHAR 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
ASKED: October 6, 2010  4:30 PM
UPDATED: October 7, 2010  12:54 PM

Answer Wiki:
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
Last Wiki Answer Submitted:  October 6, 2010  5:39 pm  by  CharlieBrowne   33,695 pts.
All Answer Wiki Contributors:  CharlieBrowne   33,695 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


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


 

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 pts.

 

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

 33,695 pts.

 

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.

 33,695 pts.

 

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

 110,135 pts.

 

Great
Thanks Charlie.
Thanks Tom… yes i do have access to CL Manuals.

 250 pts.