classAnova - Knowledge Shared


Posted by: Bob Cozzi
IT Researcher
Cozzi Productions, Inc.
North Aurora, IL
RPG Open - Documentation Group
has no ratings.
Published: 08 Feb 2011
Revised: 04 Aug 2011 - 4642 days ago
Last viewed on: 18 Apr 2024 (7522 views) 

Using IBM i? Need to create Excel, CSV, HTML, JSON, PDF, SPOOL reports? Learn more about the fastest and least expensive tool for the job: SQL iQuery.

RPG Open - Documentation Group Published by: Bob Cozzi on 08 Feb 2011 view comments

RPG Open

TCAT, BCAT, SCAT Concatenate Multiple Strings

Syntax Diagram

result = tcat( s1 : s2 [: s3 : s4 : ... ] );

result = bcat( s1 : s2 [: s3 : s4 : ... ] );

result = scat( c : s1 : s2 [: s3 : s4 : ... ] );

The concatenation procedures perform multiple concatenation operations simultaneously. There are 3 variations of the subprocedures:

  1. TCAT - Performs concatenation and removes all blanks between each value--similar to *TCAT in the CL language.
  2. BCAT - Performs concatenation and removes all blanks between each value and then inserts a single blank between each value--similar to *BCAT in the CL language.
  3. SCAT - Performs concatenation and removes all blanks between each value and then inserts a user-specified character(s) between each value.

 

      /free
            userName = bcat(firstname : lastname);
            xmldata = tcat('<cust>':%char(custno):'</cust>');
            csvData = scat(',' : compname : address : city : state : zipcode);
      /end-free

Up to 8 values may be concatenated at a time.

NOTE: The SCAT subprocedure allows multiple characters (not just single characters) for its first parameter (character-to-insert).

Return to RPGOpen.com

Return to classanova.com home page.
Sort Ascend | Descend

COMMENTS