You are currently viewing AS400 CLP Using CAT/BCAT/TCAT


Combining the two character variables on the AS400 CLP can use CAT, TCAT or BCAT. Here are the details:

  • CAT – concatenates 2 strings according to variable length (as is).
  • TCAT – concatenates 2 strings by ignoring variable lengths and removing trailing blanks for the first variable.
  • BCAT – concatenates 2 strings by ignoring variable lengths, removing trailing blanks on the first variable and adding spaces between the two variables.
             DCL        VAR(&CHAR1) TYPE(*CHAR) LEN(10) VALUE('SAUL ')
             DCL        VAR(&CHAR2) TYPE(*CHAR) LEN(10) +             
                          VALUE('LIMBONG ')                           
             DCL        VAR(&CAT) TYPE(*CHAR) LEN(20)                 
             DCL        VAR(&TCAT) TYPE(*CHAR) LEN(20)                
             DCL        VAR(&BCAT) TYPE(*CHAR) LEN(20)                
             CHGVAR     VAR(&CAT) VALUE(&CHAR1 *CAT &CHAR2)           
             CHGVAR     VAR(&TCAT) VALUE(&CHAR1 *TCAT &CHAR2)         
             CHGVAR     VAR(&BCAT) VALUE(&CHAR1 *BCAT &CHAR2)         
             SNDPGMMSG  MSG('Using CAT :')                            
             SNDPGMMSG  MSG(&CAT)                                     
             SNDPGMMSG  MSG('Using TCAT :')                           
             SNDPGMMSG  MSG(&TCAT)                                    
             SNDPGMMSG  MSG('Using BCAT :')                           
             SNDPGMMSG  MSG(&BCAT)                                    

Compile and run the program.

This Post Has One Comment

  1. Amosjoel

    Join my forex trading team +17034249698 text me on WhatsApp

Leave a Reply