Trimming variable in CLLE

user278576 picture user278576 · Feb 22, 2010 · Viewed 7k times · Source

How can you trim a variable in CLLE??

Answer

robertnl picture robertnl · Feb 24, 2010

No standard function TRIM is available in CLLE. However,

  • If you want to glue two variables, then look at *TCAT (or |<). This command removes the blanks in between (e.g. 'xyz ' *TCAT 'uvw' becomes 'xyzuvw'
  • If you really want to trim, then try '' *TCAT $YOURVAR *TCAT '' (can't try this one myself now. No as/400 around at home ... )
  • Or use the fact that you're working with ILE CL. You can use the command CALLPRC to call a module that can do the trick! Write that module yourself with ILE RPG or COBOL.