RTVNXTNAM RETRIEVE NEXT NAME TAACLUD |
The Retrieve Next Name command takes a name value such as 'ABC0001',
adds 1 to the digit portion, and returns the next name 'ABC0002'.
The number portion of the name may contain 1-9 digit positions, but
must be in the trailing position of the name. A rollover such as
from a name 'ABC9999' causes an escape message. RTVNXTNAM may be
used for objects, members, or your own internal naming convention.
Assume you want a new member name by adding 1 to the last member name
in the file. Assume the members begin with ABC and have 6 digits
following. The first member name used was ABC000001. A typical
series of commands would be.
DCL &LSTMBR *CHAR LEN(10)
DCL &NEWMBR *CHAR LEN(10)
.
RTVMBRD FILE(xxx) MBR(*LAST) RTNMBR(&LSTMBR)
RTVNXTNAM CURNAM(&LSTMBR) NBRDIGITS(6)
NXTNAM(&NEWMBR)
ADDPFM FILE(xxx) MBR(&NEWMBR)
If the last member name used was ABC000456, the new member would be
ABC000457.
The NBRDIGITS parameter identifies the number of digits in your
naming convention. These are checked to ensure values 0-9. The
CURNAM parameter must be a valid object name. It cannot begin with a
digit.
If the CURNAM value is ABC99999, an escape message would be issued
because a rollover of the number occurred.
RTVNXTNAM escape messages you can monitor for
---------------------------------------------
TAA9891 A rollover has occurred. A new name cannot
be assigned.
Escape messages from based on functions will be re-sent.
RTVNXTNAM Command parameters *CMD
----------------------------
CURNAM The current name to add 1 to. The number of digits
can be a length of 1 to 9 such as 'An',
'Annnnnnnnn', or 'ABCnnn'. The name must be a valid
object name on the system. The number must be in
the trailing positions. Blanks may follow the
number.
It is valid to have a name such as ABC1234 and
specify NBRDIGITS(2). The next name retrieved would
be ABC1235.
NBRDIGITS The number of trailing digits in the number portion
of the name. If the CURNAM is ABC101, the number of
digits would be 3.
NXTNAM The next name that has been created by adding 1 to
the current name. This is a required return
variable that must be declared as *CHAR LEN(10).
Restrictions
------------
Because RTVNXTNAM returns a variable, the command may only be used in
a CL like program.
Prerequisites
-------------
The following TAA Tools must be on your system:
EDTVAR Edit variable
RTVVALA Retrieve value attributes
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
------ ---- --------- ---------- ----------
RTVNXTNAM *CMD TAACLUD QATTCMD
TAACLUDC *PGM CLP TAACLUDC QATTCL
|
Added to TAA Productivity tools October 15, 2013