RTVFLDDTA RETRIEVE FIELD DATA TAADBLS |
The Retrieve Field Data command is a program (TAADBLSR) that may be
called to retrieve the data for a field in a file. An externally
described data structure (TAADBLSP) and a record image is used to
communicate with the program. The intent of the tool is to allow a
general purpose print program where neither the file nor the fields
are known when the program is written. The data to be passed back
may include editing characters for decimal data if a edit code is
requested.
Assume you want to write a general purpose program to print fields
from a data base where the name of the file and fields are not known
when the program is written.
By using RTVFLDDTA, you can dynamically access the data from a record
image based on a field name.
The companion tool is RTVCOLHDG which will retrieve the column
headings for a field.
The TAADBLSP externally described data structure provides for
communication to and from the TAADBLSR program. A record image must
also be passed.
The following parameters exist in the TAADBLSP data structure:
** FDRQST. *CHAR LEN(8). Input. For normal use pass *FIELD.
The program remains open to allow data from another field to
be retrieved. When all data has been retrieved, pass *CLOSE
which closes the program without retrieving any data.
** FDRTNC. *CHAR LEN(8). Input. The return code from TAADBLSR.
Either *GOOD or *NOFLD is returned.
** FDFILE. *CHAR LEN(10). Input. The file name to retrieve the
field from.
** FDLIB. *CHAR LEN(10). Input. The library where the file
exists.
** FDFLD. *CHAR LEN(10). Input. The field name to retrieve
data for.
** FDFLDT. *CHAR LEN(1). Input. The field type. The field
type is not used in RTVFLDDTA. It is determined from the file
definition instead.
** FDDTAW. *CHAR LEN(5). Input. The data width including
editing of the field. A maximum of 44 is allowed. If the
maximum is exceeded then 44 will be used.
** FDEDIT. *CHAR LEN(1). Input. The edit code associated with
the field. '*' should be entered for character fields or if
you want the editing described for the field in DDS. '%'
should be entered for 'no editing'. Packed or binary data
will be converted. Any of the standard edit codes may be
entered.
** FDSTR. *CHAR LEN(3). Input. The field start location. The
field start location is not used in RTVFLDDTA. It may be
input from data gathered from RTVCOLHDG. All data returned is
left justified in FDDATA and FDPDTA. The intent of the field
is to allow you to store the important field information in an
array.
** FDDATA. *CHAR LEN(256). Output. The first 256 bytes of the
unedited data. Numeric data is positioned in the first 19
bytes.
** FDPDTA. *CHAR LEN(256). Output. The first 256 bytes of the
edited data. Numeric data is right-adjusted and positioned in
the field width.
** FDRSV. *CHAR LEN(100). A reserved area for possible
additional parameters.
The following code may be copied to and RPG program to interface with
the RTVFLDDTA program. Your record image should be moved to the RCD
data structure left adjusted.
IRCD DS 9999
I 'TAATOOL/TAADBLSR' C GETDTA
IFLDDTA E DSTAADBLSP
.
C* It is generally preferable to have the following code in a
C* subroutine which allows it to be called with a request
C* value of *COLHDG or *CLOSE.
C CALL GETDTA Get data
C PARM FLDDTA Field data
C PARM RCD Record data
RTVFLDDTA escape messages you can monitor for
---------------------------------------------
None. Escape messages from based on functions will be re-sent.
CPF9898 is sent for a variety of error conditions such as the FDFILE
or FDLIB parameters are blank.
RTVFLDDTA command parameters
----------------------------
No command exists.
Restrictions
------------
The maximum record width supported is 9999 bytes.
Prerequisites
-------------
The following TAA Tools must be on your system:
RTVFLDARR Retrieve field array
SNDESCMSG Send escape message
Implementation
--------------
None, the tool is ready to use.
Objects used by the tool
------------------------
Object Type Attribute Src member Src file
------ ---- --------- ---------- ----------
TAADBLSR *PGM RPG TAADBLSR QATTRPG
TAADBLSP *FILE PF TAADBLSP QATTDDS
|
Added to TAA Productivity tools January 1, 2008