Understanding the MICRTPG Program (by Sections of Code)
You will recognize some of these statements from the MI01 example, but others
are new.
The following statements, which you have seen, for example, in “MI01
Program—Complete Code Example,” define the entry point to this program and the
parameters being passed on the call:
ENTRY \ (PARM_LIST) EXT;
DCL SPCPTR MBR@ PARM;
DCL SPCPTR BINOFFSET@ PARM;
DCL OL PARM_LIST (MBR@, BINOFFSET@) PARM EXT;
DCL DD MBR CHAR(1ð) BAS(MBR@);
DCL DD BINOFFSET BIN(4) BAS(BINOFFSET@);

Declaring the Structure

The following, however, are new statements:
DCL DD RSLVOBJ CHAR(34);
DCL DD RSLVTYPE CHAR(1) DEF(RSLVOBJ) POS(1) INIT(X'19');
DCL DD RSLVSUBTYPE CHAR(1) DEF(RSLVOBJ) POS(2) INIT(X'34');
DCL DD RSLVNAME CHAR(3ð) DEF(RSLVOBJ) POS(3);
DCL DD RSLVAUTH CHAR(2) DEF(RSLVOBJ) POS(33) INIT(X'ðððð');
These statements declare a structure named RSLVOBJ that comprises four subele-
ments defined within it. The subelements specify their position relative to the start
of the structure RSLVOBJ. In the cases of the RSLVTYPE, RSLVSUBTYPE, and
RSLVAUTH data elements, they initialize the associated storage.
The RSLVOBJ structure is used later in the program as an input to the resolve
system pointer (RSLVSP) MI instruction. The RSLVSP instruction resolves (estab-
lishes addressability) to a user space (*USRSPC) (the X'1934' object type and
subtype) named RSLVNAME (assigned from the source member name (MBR) data
element). This user space is the one created in “Source for the CL03 Program” on
page 7-13. If you are interested in the details of this structure, see the
Machine
Interface Functional Reference
under RSLVSP. For other valid object types and
subtypes, see
AS/400 Licensed Internal Code Diagnostic Aids – Volume 1
,
LY44-5900, and
AS/400 Licensed Internal Code Diagnostic Aids – Volume 2
,
LY44-5901.
Note: In the declare (DCL) statement of RSLVOBJ, the leading blanks used to
indent the subelements (for example, RSLVTYPE and RSLVSUBTYPE) are
strictly to enhance the readability of the source. They are not a requirement
of the QPRCRTPG API. In general, you can use strings of blanks of any
length in the source of a program. Blanks, one or more, are simply used as
delimiters in identifying tokens. The major exception is the INIT argument
of a DCL statement where the number of blanks is important. For example,
the previous declare statement could have been written as follows and other
than readability, nothing would have been lost:
DCL DD RSLVOBJ CHAR(34); DCL DD RSLVTYPE CHAR(1)
DEF(RSLVOBJ) POS(1) INIT(X'19'); DCL DD RSLVSUBTYPE CHAR(1)
DEF(RSLVOBJ) POS(2)
INIT(X'34'); DCL DD RSLVNAME CHAR(3ð) DEF(RSLVOBJ) POS(3); DCL
DD RSLVAUTH CHAR(2) DEF(RSLVOBJ) POS(33) INIT(X'ðððð');
7-16 System API Programming V4R1