SCNEXTDTA SCAN AND EXTRACT DATA TAAMSKF |
The Scan and Extract Data command scans a string of data for a value
and returns the first n bytes prior to a blank after a successful
scan. For example, if you are scanning message text, you might want
the value after the word 'library '.
A typical series of commands would be:
DCL &RTNVAL *CHAR LEN(50)
.
SCNEXTDTA INPVAL(...) SCNVAL(LIBRARY) SCNLEN(8) +
RTNVAL(&RTNVAL)
If INPVAL was:
'Data area ABC created in library DEF'
The return value would contain DEF.
Note that both the input value and the scan value are translated to
upper case before scanning and the the scan length of 8 allows a scan
for 'library '. If a length of 7 had been specified, the return
value would be blank as a blank would be found immediately following
the scan value.
SCNEXTDTA escape messages you can monitor for
---------------------------------------------
TAA9891 The scan value was not found
Escape messages from based on functions will be re-sent.
SCNEXTDTA Command parameters *CMD
----------------------------
INPVAL The input value to be scanned. Up to 500 bytes may
be entered. The value is folded to upper case
before scanning.
SCNVAL The value to scan for. Up to 30 bytes may be
entered.
SCNLEN The length to scan for. If you want the return
value following a word like 'library', you would
normally specify an additional position for the
blank thus scanning for 'library '. The scan length
would then be 8.
A value between 1 and 30 must be specified.
RTNVAL The return value containing the first n characters
that are terminated by a blank after the found scan
value.
If the input value is '...library ABC was used.' and
you scan for the word 'library' with a length of 8,
ABC will be returned.
This is a required parameter that must be specified
as *CHAR LEN(50).
Restrictions
------------
Because SCNEXTDTA returns a variable, the command may only be used in
a CL like program.
Prerequisites
-------------
The following TAA Tools must be on your system:
SCNVAR Scan variable
SNDESCINF Send escape information
SNDESCMSG Send escape message
TRNVAL Translate value
Implementation
--------------
None, the tool is ready to use.
Objects used by the tool
------------------------
Object Type Attribute Src member Src file
------ ---- --------- ---------- ----------
SCNEXTDTA *CMD TAAMSKF QATTCMD
TAAMSKFC *PGM CLP TAAMSKFC QATTCL
|
Added to TAA Productivity tools July 15, 2013