CHKAPOST CHECK APOSTROPHES FOR COMMAND PARMS TAACLPM |
The Check Apostrophe command is specifically designed for those cases
where you will be creating or changing parameters of a command using
QCMDEXC and the parameter may include an embedded apostrophe. The
command analyzer will reject such a request. The proper method of
handling apostrophes is to ensure that they are double. For example,
ab'c should become ab''c.
The CHKAPOST command will ensure that the parameter is properly
handled. It also removes any leading and trailing apostrophes from
the value. If consecutive apostrophes exist, they are left as is.
For example, ab''cd would be left as is.
The default is to check for a single apostrophe ('). An option
exists to check for the double apostrophe character (") or both the
single and double.
A typical use of the command would be with a TEXT parameter:
DCL &RTNVAR *CHAR LEN(500)
DCL &TEXT *CHAR LEN(50)
DCL &CMD *CHAR LEN(500)
.
.
CHKAPOST VAR(&TEXT) RTNVAR(&RTNVAR)
CHGVAR &CMD ('CHGxxx TEXT(' *CAT '''' *CAT +
&RTNVAR *TCAT '''' *CAT ')')
CALL QCMDEXC PARM(&CMD 500)
The command is built by CHGVAR and then executed using QCMDEXC.
The CHKAPOST2 command provides the same function, but will handle a
5000 variable.
CHKAPOST Command parameters *CMD
---------------------------
VAR The variable to be checked. It can be up to 500
bytes.
RTNVAR The return variable. It must be defined as *CHAR
LEN(500).
APOSTCHAR The apostrophe character to check for. *SINGLE is
the default to check for a single apostrophe (').
*DOUBLE may be specified to check for the double
apostrophe (").
*BOTH may be specified to check for both characters.
CHKAPOST2 Command parameters *CMD
----------------------------
VAR The variable to be checked. It can be up to 5000
bytes.
RTNVAR The return variable. It must be defined as *CHAR
LEN(5000).
APOSTCHAR The apostrophe character to check for. *SINGLE is
the default to check for a single apostrophe (').
*DOUBLE may be specified to check for the double
apostrophe (").
*BOTH may be specified to check for both characters.
Restrictions
------------
The command can only be used in a CL program.
Prerequisites
-------------
None.
Implementation
--------------
None, the tool is ready to use.
Objects used by the tool
------------------------
Object Type Attribute Src member Src file
------ ----- --------- ---------- -----------
CHKAPOST *CMD TAACLPM QATTCMD
CHKAPOST2 *CMD TAACLPM2 QATTCMD
TAACLPMC *PGM CLP TAACLPMC QATTCL
TAACLPMC2 *PGM CLP TAACLPMC2 QATTCL
Structure
---------
CHKAPOST Cmd
TAACLPMC CL pgm
CHKAPOST2 Cmd
TAACLPMC2 CL pgm
|
Added to TAA Productivity tools April 1, 1995