The Edit Large Variable command provides editing for a large
character variable that contains numeric data. Some system functions
return large character variables that exceed 15 digits and place them
in *CHAR variables. A *CHAR input value of up to 30 bytes is
supported. The return CHROUT value must be declared as *CHAR
LEN(43). RPG type edit codes are used.
See also the CLCLRGVAR tool command to perform calculations on large
variables.
A typical series of commands would be:
DCL &CHAR43 *CHAR LEN(43)
.
EDTLRGVAR CHROUT(&CHAR43) NUMINP(&xxx)
The &xxx value must be a *CHAR variable (or literal) up to 30 bytes
in length. The value is right adjusted before editing. The edited
return value in the &CHAR42 variable would be left adjusted.
The defaults used are:
EDTCDE = J
NBRDEC = 0
SIGN = +
LDGSYM = *NO
For example, if &xxx contained:
12345678901234567890
The &CHAR42 return value would be:
12,345,678,901,234,567,890
If NBRDEC(2) had been specified, the return value would be:
123,456,789,012,345,678.90
Number of decimals
------------------
EDTLRGVAR only operates on a whole number (no decimal point). You
can specify the number of decimal positions in the return value for
presentation purposes.
If you are dealing with a large value that contains a number of
decimal positions other than 0, you will need to convert the value to
a whole number before using EDTLRGVAR. For example, it the value has
2 decimal positions, you could do the following:
DCL &CHAR43 *CHAR LEN(43)
DCL &WHOLENBR *CHAR LEN(30)
.
CLCLRGVAR OPER(*MULT) FACTOR1(&xxx) FACTOR2(100)
RESULT(&WHOLENBR)
.
EDTLRGVAR CHROUT(&CHAR43) NUMINP(&WHOLENBR) NBRDEC(2)
NUMINP rules and examples
-------------------------
** Up to 30 bytes in a *CHAR variable (or literal).
** Leading blanks or zeros are valid.
** Trailing blanks are valid (because the date will be right
adjusted before editing).
** Embedded blanks or non-digits are not valid in the input
value.
** A minus sign or decimal notation are not valid in the input
value. See the SIGN and NBRDEC parameters.
Examples where 'b' is equal to blank.
Valid Values
------------
'123'
'123bbbbbbbbbbbbbbbbbbbbbbbbbbbb'
'bbbbbbbbbbbbbbbbbbbbbbbbbbbb123'
'0000000000000000000000000000000'
'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb0'
'0bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb'
'0'
'0000000000000000000000012300000'
Invalid values Reason
-------------- ------
'1 3' Embedded blank
'123.45' Non-digit
'123A45' Non-digit
'12345-' Non-digit
'-12345' Non-digit
'12,345' Non-digit
EDTLRGVAR escape messages you can monitor for
---------------------------------------------
None. Escape messages from based on functions will be re-sent.
EDTLRGVAR Command parameters *CMD
----------------------------
CHROUT The edited return value. It must be declared as
*CHAR LEN(43). The edited value will be left
adjusted followed by blanks.
NUMINP The value to be edited. It may up to 30 bytes in
length. The value is right adjusted before editing
begins. The value may not contain embedded blanks,
a minus sign, nor other non-digit values. Leading
blanks or zeros are valid. Trailing blanks are
valid.
SIGN Whether the NUMINP value should be considered plus
or minus.
'+' is the default,
'-' may be entered for a negative value. Note that
the NUMINP value cannot contain a minus sign. If
SIGN(-) is entered, the edited result will contain a
trailing '-' or 'CR' depending on the edit code
used.
NBRDEC The number of decimal positions to be used in the
CHROUT value. The default is 0. It must be a value
between 0 and 9.
Note that the NUMINP value may not contain a decimal
position. You must use a whole number as an input
value, but the NBRDEC parameter lets you edit the
value as if it had decimal positions. The decimal
format of the job determines the decimal notation
used.
EDTCDE The edit code to be used for editing.
The valid values are:
1 2 3 4 A B C D J K L M N O P Q
The edit codes have the same meaning as the RPG edit
codes. Date editing via the 'Y' edit code is not
supported nor is the 'W' edit code for time editing
supported by EDTVAR.
'J' is the default which provides for separation
characters, a trailing minus sign (if negative), and
at least one zero for an all zero input value
(multiple zeros are inserted after the decimal point
if any).
Use DSPEDTCDE for a review of the supported edit
codes and the results.
The edit code also controls the result if the NUMINP
value is 0 (such as whether blanks appear, a single
zero, or a value such as '.00').
Note that the system defined edit codes are not
supported.
LDGSYM A *YES/*NO parameter for whether a leading currency
symbol should appear in the result.
*NO is the default for no leading currency symbol.
*YES may be specified to begin the CHROUT value with
a leading currency symbol. The QCURSYM system value
determines the currency symbol used.
Restrictions
------------
Because EDTLRGVAR returns a value, the command may only be used in a
CL like program.
Prerequisites
-------------
The following TAA Tools must be on your system:
ADJVAR Adjust variable
SNDESCINF Send escape information
SNDESCMSG Send escape message
Implementation
--------------
None, the tool is ready to use.
Objects used by the tool
------------------------
Object Type Attribute Src member Src file
------ ---- --------- ---------- ----------
EDTLRGVAR *CMD TAACLUC QATTCMD
TAACLUCC *PGM CLP TAACLUCC QATTCL
|