ADJVAR ADJUST VARIABLE TAACLQD
The Adjust Variable command adjusts a string of data and returns it
either centered, left adjusted, or right adjusted. For right
adjusting of a decimal value, see the RGTADJVAR tool.
Assume you want to use ADJVAR to adjust a a 30 byte field which
The name field
The result after centering would be:
The name field
A typical command would be:
DCL &RTNVAR *CHAR LEN(256)
DCL &TITLE *CHAR LEN(50)
ADJVAR INPVAR(&xxx) RTNVAR(&RTNVAR) VARLEN(50) +
CHGVAR &TITLE &RTNVAR
The INPVAR can be up to 256 bytes in length. The VARLEN value
specifies the logical length that will be considered. The command
determines the leftmost and rightmost non-blank characters in INPVAR
and adjusts into the RTNVAR field according to the VARLEN field.
In this example, the VARLEN field is 50 so the input data would be
centered in the first 50 bytes of the &RTNVAR field. The CHGVAR
command moves the return value to the variable where you want the
Command parameters *CMD
INPVAR The input variable to be adjusted. It can be up to
256 bytes in length. The data is not changed. The
value cannot be all blank nor may the logical size
of the field (as determined by the VARLEN parameter)
be all blank.
RTNVAR The return variable which must be declared as *CHAR
LEN(256). The logical length of the variable is
determined by the VARLEN parameter. The return
value will be adjusted into the logical size of the
VARLEN The length of the variable. The length applies to
both the input and return variable. The length must
be between 2 and 256.
ADJUST The adjustment to be made. *CENTER is the default
to center the value. *LEFT does a left adjust.
*RIGHT does a right adjust. The length of the
number of bytes is determined by the first and last
non-blank of the input variable. Any data beyond
the VARLEN size is ignored.
SETLR The setting for LR in the RPG program. The default
is *YES which causes the program to be closed on
return. *NO may be specified to keep the program
open which is a good performing solution if you will
repeatedly use the adjust function.
Use from a HLL
You can call the CPP directly. The following is RPG code in the
correct format to be copied into a program. First use CPYTAA
TAAARCMBR(ADJVAR) to copy the source from this documentation member
to QATTINFO in TAATOOL. Change the PARM Factor 2 values to meet your
C CALL 'TAACLQDR'
C PARM INPVAR 50
C PARM RTNVAR256
C PARM 50 INPLEN 30
C PARM '*CENTER' ADJUST 7
C PARM '*YES' SETLR 4
Because the command returns a variable, it can only be used in a CL
The logical portion of the input field cannot be all blank. Any data
beyond the logical portion is ignored.
The following TAA Tools must be on your system:
SNDESCMSG Send escape message
None, the tool is ready to use.
Objects used by the tool
Object Type Attribute Src member Src file
------ ---- --------- ---------- ----------
ADJVAR *CMD TAACLQD QATTCMD
TAACLQDR *PGM RPG TAACLQDR QATTRPG
Added to TAA Productivity tools May 1, 1996