TurboIMAGE/XL Database Management System Reference Manual MPE/iX V6.5 (30391-90011)
Chapter 6 301
Host Language Access
RPG
RPG
RPG contains language constructs that make calls to TurboIMAGE/XL intrinsics, rather
than having the user code do the intrinsic calls directly. For example, RPG opens all files at
the beginning of program execution, thereby calling DBOPEN for any databases named on
File Description specifications. Likewise, DBCLOSE is automatically called for databases at
the end of program execution. Another example is the RPG CHAIN operation which calls
DBFIND and/or DBGET, depending on its usage.
A small set of TurboIMAGE/XL intrinsics have no RPG language equivalent and so cannot
be accessed at the present time. These include DBERROR, DBEXPLAIN, DBBEGIN, DBEND,
and DBMEMO. Because the sample program on which this RPG program is based contains
calls to DBERROR and DBEXPLAIN, the RPG version cannot exactly match the functionality
of the sample program. Instead, it displays the status value returned by TurboIMAGE/XL
when an error occurs.
NOTE
Because the Schema Processor, DBSCHEMA, upshifts alphabetic characters,
programs must specify data set and data item names in all uppercase
characters. Take note of this as RPG does not require that you use uppercase
characters.
For information of TurboIMAGE/XL data item lengths and type designators, refer to
chapter 3. Tables 3-2 and 3-3 show the TurboIMAGE/XL type designators, sub-item
lengths, and data types typically used to process them in RPG.
Defining Data Types, Variables, and Intrinsics
The first five F-specs implement the OPEN-THE-DATABASE routine of the sample program in
RPG. RPG automatically opens all databases (by calling DBOPEN) at the beginning of
program execution. F-specs are used to declare how each database/set is to be opened and
accessed.
In this program, the database is opened with mode 1 (shared modify access) by entry of L
in column 66 on the KIMAGE line. This entry also allows user-controlled locking of the
database/set/item to occur.
The data set is opened for chained sequential read accesses by entry of C in column 67 of
the KIMAGE line. If an error occurs during opening of the database, the program will
abort.
Note that RPG also closes all databases (by calling DBCLOSE) at the end of program
execution, so there is no need for the user to call a separate routine to do this.
$CONTROL NOINFO,MAP,NAME=RTURBO
H L 1
****************************************************************
* Program name: RTURBO *
* Description : Example of RPG access to TurboIMAGE/XL *
****************************************************************
FSALES IC F 38R 6AI 27 DISC