COZZI-Copy Text Right-Adjusted (CLRIGHT)

Where allowed to run:
  • Batch program (*BPGM)
  • Interactive program (*IPGM)
  • Batch ILE CL module (*BMOD)
  • Interactive ILE CL module (*IMOD)
Threadsafe: No
Parameters
Examples
Error messages

The COZZI-Copy Text Right-Adjusted (CLRIGHT) command copies a character variable or text string to a target CL variable, right-justified. If you have the latest IBM i PTFs installed and you are running IBM i v7r1 you may be able to use %TRIMR instead of this command.

Top

Parameters

Keyword Description Choices Notes
VAR CL variable name Not restricted Required, Positional 1
VALUE Text to be copied Character value Required, Positional 2
TRIM Trim blanks before copy *YES, *NO Optional, Positional 3
Top

CL variable name (VAR)

Specifies target CL variable that receives the right-justified text.

This is a required parameter.

CL Variable
Specify the character CL variable TYPE(*CHAR) that is receives the right-justified text.
Top

Text to be copied (VALUE)

Specifies text that is copied, right-justified to the CL variable specified on the VAR parameter.

This is a required parameter.

character-value
Specify any valid CL text string or variable.
Top

Trim blanks before copy (TRIM)

Specifies whether blanks are moved from the value prior to the right-adjust being performed.

*YES
Blanks are trimmed off the value before right-justification.
*NO
Blanks are not trimmed from the text string on the VALUE parameter. Normally you would want trimming so that the result is right-justified.
Top

Examples for CLRIGHT

Example 1: Simple Command Example

DCL     &TEXTTOT  TYPE(*CHAR) LEN(15)
DCL     %GRANDTOT TYPE(*DEC)  LEN(7 2)
CLEDIT  VAR(&TEXTTOT) VALUE(&GRANDTOT)
CLRIGHT VAR(&TEXTTOT) VALUE(&TEXTTOT *TCAT '**')

This command convert the numeric value in &GRANDTOT to character using the COZTOOLS CLEDIT command. Then it adds two asterisks to the result and moves everything, right-justified into the &TEXTTOT variable.

Top

Error messages

Unknown
Top