RPGSTSDS RPG STATUS DATA STRUCTURE TAARPGE
The RPG Status Data Structure tool provides an externally described
file that can be used to define the RPG III or RPG IV Status Data
Structure. This simplifies working with the Status Data Structure
because all fields are properly defined to the program and have
Only a single statement is needed to describe the Status Data
Structure in a program. The following lines of code are are in the
proper format to be copied into your RPG program by using SEU. First
use CPYTAA TAAARCMBR(RPGSTSDS) to copy the source for this
documentation member to QATTINFO in TAATOOL.
D PGMSTS ESDS EXTNAME(TAARPGEQ)
This specifies the name of the structure as PGMSTS. The 'E'
specifies that an externally described file is used. The 'S'
specifies that it is the status data structure. The 'DS' that it is
a data structure and TAARPGEP (or TAARPGEQ for RPG IV) is the name of
the physical file in TAATOOL which contains the definitions.
The fields in the data structure are defined in the RPG manual. You
may see the definitions used by this tool by using the previous Input
spec in a compiled program or by using DSPFMT TAARPGEP (or TAARPGEQ).
The data structure contains information about the compiled program
such as the program name (STPNAM), the compile date (STCDAT) and time
(STCTIM) as well as the message ID value (STMSID) when an error
The fields defined in the data structure can be used as normal fields
within your program.
If a file error occurs (e.g. record lock exception), the information
is posted in the STFSTS field which contains the status code (e.g.
01218 = record lock exception). The STLFOP field will contain the
last file operation performed. The STSTSF contains the remainder of
the file status information. This is the same information that can
be found in the File Information Data Structure.
In some applications, you may wish to just use the program status
data structure to handle certain file exceptions and then use an Hx
indicator if it is other than this. For example, the following shows
how to use the information for the record lock exception:
C keyfld CHAINrecord 2055
C* Check error indicator
C 55 DO If file err
C* If record lock do something special
C STFSTS IFEQ '01218' If rcd lock
C* Your code to handle record lock exception
C END If rcd lock
C* Other file error, set H5 and return
C SETON H5
C END If file err
None, the tool is ready to use.
Objects used by the tool
Object Type Attribute Src member Src file
------ ---- --------- ---------- ----------
TAARPGEP *FILE PF TAARPGEP QATTDDS
TAARPGEQ *FILE PF TAARPGEQ QATTDDS
Added to TAA Productivity tools April 1, 1995