IBM Version 4 Universal Remote User Manual


 
7. To keep track of how many bytes of source are loaded into the *USRSPC,
define BINOFFSET. BINOFFSET is also being defined very specifically as an
integer (BIN(4)) because it will be used later in the program with the set space
pointer offset (SETSPPO) MI instruction. This requires an integer argument to
refer to the space:
DCL DD BINOFFSET BIN(4) AUTO INIT();
8. Because the size of the source is also a parameter to the QPRCRTPG API,
define a space pointer to refer to BINOFFSET:
DCL SPCPTR BINOFFSET@ AUTO INIT(BINOFFSET);
The two previous declare statements have also introduced a new attribute to
the DCL statement. Previously, all of the DCLs used the default of static
(STAT) storage. BINOFFSET and BINOFFSET@, on the other hand, are being
allocated from automatic (AUTO) storage. Many hours of debug time can be
saved if you clearly understand how the AS/400 manages these two types of
storage. For more information on the types of storage, see “AS/400 Program
Storage” on page 7-36.
So that the program does not retain the size of the source loaded from pre-
vious invocations of the program, you can declare BINOFFSET as being auto-
matic. Because BINOFFSET@ needs to be set to the address of BINOFFSET
(so that BINOFFSET can be passed as a parameter to CL06), you will also
declare it as automatic. An alternative to using automatic storage would have
been to explicitly set a static storage BINOFFSET to 0 by using CPYNV, but
this does not allow for a discussion of the storage management differences.
9. Use the CL06 program to load the space after it is created. Because CL06 is
limited to only 2000 bytes of addressability per parameter per call (CALLX), the
MICRTPG2 program uses the Override with Database File (OVRDBF) CL
command to cause the CL06 program to read and load twenty 80-byte source
records per call. The source records are read starting at 1 on the first call, 21
on the second, 41 on the third, and so on. To run CL commands from the
MICRTPG2 program, the program uses the Execute Command (QCMDEXC)
API:
DCL SYSPTR QCMDEXC INIT("QCMDEXC", CTX("QSYS"), TYPE(PGM));
10. Format the appropriate character strings for the Override with Database File
(OVRDBF) CL command:
Note: In the following declare (DCL) statement for CLOVRCMD, the 3 strings
of '1234567890' are used strictly so that you can see that 10 bytes are
being used. The strings themselves are overridden by the subsequent
subelement DCLs for FILNAM, MBRNAM, and RECNUM, and could be
replaced by 10 blanks:
DCL DD CLOVRCMD CHAR(65);
DCL DD OVRSTR CHAR(39) DEF(CLOVRCMD) POS(1)
INIT("OVRDBF MISRC 123456789 MBR(123456789)");
DCL DD OVRSTR2 CHAR(26) DEF(CLOVRCMD) POS(4)
INIT(" POSITION(ᑍRRN 123456789)");
DCL DD FILNAM CHAR(1) DEF(CLOVRCMD) POS(14);
DCL DD MBRNAM CHAR(1) DEF(CLOVRCMD) POS(29);
DCL DD RECNUM ZND(1,) DEF(CLOVRCMD) POS(55);
11. Format the appropriate character strings for the Delete Override (DLTOVR) CL
command. Because the OVRDBF commands are issued repetitively to
progress through the source, the previous overrides need to be deleted:
7-20 System API Programming V4R1