The Retrieve Qualified Name command extracts the command, qualifier,
and label from a string. It also returns variables for whether a
prompt character (?) exists, whether a leading comment exists, and
the library where the command exists.
A typical series of commands would be:
DCL &INPUT *CHAR LEN(5000)
DCL &CMDNAM *CHAR LEN(10)
DCL &QLFNAM *CHAR LEN(10)
.
CHGVAR &INPUT '.... the command string ...')
RTVQLFNAM INPUT(&INPUT) CMDNAM(&CMDNAM)
QLFNAM(&QLFNAM)
&CMDNAM would contain the command name found in the string. &QLFNAM
would contain the qualified library name if it exists.
If the INPUT string contains only a label or a comment, RTVQLFNAM
completes normally. The &CMDNAM variable would be blank.
Valid command syntax is required (some errors are checked for, but
not all).
S/38 syntax is considered an error.
RTVQLFNAM escape messages you can monitor for
---------------------------------------------
TAA9892 The INPUT parameter may not be all blank
TAA9893 A / was found without a preceding qualifier
TAA9894 More than 10 characters exist for the cmd/qlf/label
Escape messages from based on functions will be re-sent.
Command parameters *CMD
------------------
INPUT The input string to be checked for a command. Up to
5000 bytes may be input. The value may not be all
blank.
CMDNAM The command name found. If only a comment or label
exists, the value returned will be blank and the
command will complete normally. If specified, the
variable must be declared as *CHAR LEN(10).
QLFNAM The qualified name (without the slash) if one was in
the INPUT string. If specified, the variable must
be declared as *CHAR LEN(10).
LABEL The label (without the colon) if one was in the
INPUT string. If the INPUT contains only a label,
the label is returned and the CMDNAM value will be
blank. If specified, the variable must be declared
as *CHAR LEN(10).
PMTCHAR A *YES/*NO return value for whether a prompting
character (?) exists prior to the command name in
the INPUT string. *YES is returned if a ?
character exists. If specified, the variable must
be declared as *CHAR LEN(4).
LDGCOMMENT A *YES/*NO return value for whether a leading
comment exists prior to the command name in the
INPUT string. *YES is returned is a leading comment
appears before a command name. If the INPUT
contains only a comment, *YES is returned and the
CMDNAM value will be blank. If specified, the
variable must be declared as *CHAR LEN(4).
CHKOBJERR The message ID if CHKOBJ fails attempting to check
the command. If a qualified library name is found
in the INPUT string, it will be used to check
existence. If no qualified name exists, *LIBL is
used. If the command is found, the return value
will be blank. If no command was found in the INPUT
string, the return value will be blank.
If the command cannot be found, the typical error is
CPF9801 (not found), but other CHKOBJ errors may
exist (such as CPF9810 = the library does not
exist).
If specified, the variable must be declared as *CHAR
LEN(7).
CMDLIB If a command exists in the INPUT string and passes
the CHKOBJ check, the library where the command was
found is returned. If a qualified library name was
used, this will be the same name as the qualified
library name. If the command does not exist or is
not found, the return value will be blank. If
specified, the variable must be declared as *CHAR
LEN(10).
Restrictions
------------
Because RTVQLFNAM returns variables, it may only be used in a CL
program.
Valid command syntax is assumed.
The INPUT string may not be all blank.
S/38 syntax is considered an error.
Prerequisites
-------------
The following TAA Tools must be on your system:
SNDESCMSG Send escape message
Implementation
--------------
None, the tool is ready to use.
Objects used by the tool
------------------------
Object Type Attribute Src member Src file
------ ---- --------- ---------- ----------
RTVQLFNAM *CMD TAACMES QATTCMD
TAACMESC *PGM CLP TAACMESC QATTCL
|