Where allowed to run:
|
Parameters Examples Error messages |
The Edit Numeric (CLEDIT) command converts a numeric CL variable to character after applying an edit code or edit word.
Top |
Keyword | Description | Choices | Notes |
---|---|---|---|
VAR | CL variable for edited value | Character value | Required, Positional 1 |
VALUE | Numeric value to edit | Not restricted | Required, Positional 2 |
EDIT | Edit code/Word | Character value, 1, 2, 3, 4, A, B, C, D, J, K, L, M, N, O, P, Q, X | Optional, Positional 3 |
TRIM | Trim blanks (left adjust) | *YES, *NO | Optional, Positional 4 |
Top |
Specify any CL variable of TYPE(*CHAR) to receive the edited numeric value.
This is a required parameter.
Top |
Specify any valid numeric CL variable. This variable's value is converted to character format after appling the edit code or editword specified on the EDIT parameter. Sadly, IBM provides no method to mimic the CHGVAR's VALUE parameter. Therefore an arithmetic express is NOT allowed on this parameter. Only a CL variable name may be specified.
This is a required parameter.
Top |
Specifies the edit code (1-9, A-D, J-M, N-Q or X) or any valid EDIT WORD pattern to apply to the numeric value value specified on this parameter. If the value for this parameter is longer than 1 position and is NOT 'X-' or '-X', then it is assumed to be an Edit Word. Otherwise it is an edit code.
------ "Status" ------- ---- (Negative Sign) ---- Thousands Zero Right-Side Left-Side Separator Supress None CR Minus Minus Yes Yes 1 A J N Yes No 2 B K O No Yes 3 C L P No No 4 D M Q
Top |
Specifies whether the returned, edited value has leading blanks truncated.
Top |
Example 1: Using the Default Edit Code
DCL VAR(&AMOUNT) TYPE(*DEC) LEN(7 2) DCL VAR(&AMT) TYPE(*CHAR) LEN(10) CHGVAR VAR(&AMOUNT) VALUE(1250.25) CLEDIT VAR(&AMT) VALUE(&AMOUNT)
This example converts the packed decimal data in &AMOUNT into character using the default editcode 'P'. The result is: ' 1250.25' However since TRIM(*YES) is the default, the actual value returned is '1250.25' (leading blanks are removed).
Example 2: Using an Edit Word
DCL VAR(&LEN) TYPE(*DEC) LEN(5 0) DCL VAR(&LENA) TYPE(*CHAR) LEN(5) CHGVAR VAR(&LEN) VALUE(64) /* ..... */ CLEDIT VAR(&LENA) VALUE(&LEN) EDIT('0 ')
This example converts the value in &LEN to text by applying the edit word specified. The result is: '0064'
Top |
Top |