2. Have MICRTPG2 create an automatically extendable space (it can automat-
ically increase to as many as 16MB in size) using the Create Space (CRTS)
instruction. Because the CRTS instruction requires a definition template, you
need to define it (see the
Machine Interface Functional Reference
for details).
The following template creates a space (type and subtype equal to X'19EF')
that is defined through the OBJCRTOPT data element1. The space is
defined as temporary (the next initial program load (IPL) will free up the storage
occupied by the space), extendable up to as many as 16MB, and within a
context (a library).
DCL DD CRTSTMPLT CHAR(16) BDRY(16);
DCL DD TMPLTSPEC CHAR(8) DEF(CRTSTMPLT) POS(1);
DCL DD TMPLTSIZE BIN(4) DEF(TMPLTSPEC) POS(1) INIT(16);
DCL DD TMPLTBA BIN(4) DEF(TMPLTSPEC) POS(5) INIT();
DCL DD OBJID CHAR(32) DEF(CRTSTMPLT) POS(9);
DCL DD SPCTYPE CHAR(1) DEF(OBJID) POS(1) INIT(X'19');
DCL DD SPCSUBTYPE CHAR(1) DEF(OBJID) POS(2) INIT(X'EF');
DCL DD SPCNAME CHAR(3) DEF(OBJID) POS(3) INIT(" ");
DCL DD OBJCRTOPT CHAR(4) DEF(CRTSTMPLT) POS(41) INIT(X'62');1
DCL DD OBJRCVOPTS CHAR(4) DEF(CRTSTMPLT) POS(45);
DCL DD ᑍ CHAR(2) DEF(OBJRCVOPTS) POS(1) INIT(X'');
DCL DD ASP CHAR(2) DEF(OBJRCVOPTS) POS(3) INIT(X'');
DCL DD SPCSIZ BIN(4) DEF(CRTSTMPLT) POS(49) INIT(1);
DCL DD INTSPCVAL CHAR(1) DEF(CRTSTMPLT) POS(53) INIT(X'');
DCL DD PERFCLASS CHAR(4) DEF(CRTSTMPLT) POS(54) INIT(X'');
DCL DD ᑍ CHAR(1) DEF(CRTSTMPLT) POS(58) INIT(X'');
DCL DD PUBAUT CHAR(2) DEF(CRTSTMPLT) POS(59) INIT(X'');
DCL DD TMPLTEXTN BIN(4) DEF(CRTSTMPLT) POS(61) INIT(96);
DCL SYSPTR CONTEXT DEF(CRTSTMPLT) POS(65);
DCL SYSPTR ACCESSGRP DEF(CRTSTMPLT) POS(81);
DCL SYSPTR USRPRF DEF(CRTSTMPLT) POS(97);
DCL DD MAXSPCSIZ BIN(4) DEF(CRTSTMPLT) POS(113) INIT();
DCL DD DOMAIN CHAR(2) DEF(CRTSTMPLT) POS(117) INIT(X'1');
DCL DD ᑍ CHAR(42) DEF(CRTSTMPLT) POS(119) INIT((42)X'');
3. Establish addressability to the CRTS template:
DCL SPCPTR CRTSTMPLT@ INIT(CRTSTMPLT);
4. Because the space is defined to be in a context, supply the address of the
context in the previous CRTS template. This program uses the QTEMP context
that is identified by the following:
DCL SYSPTR QTEMP@ BASPCO POS(65);
Use the copy bytes with pointers instruction (CPYBWP) to set the template
context data element.
CPYBWP CONTEXT, QTEMP@;
5. In the instruction stream, create the space:
CRTS USRSPC@, CRTSTMPLT@;
This returns a system pointer to the created space in the system pointer:
DCL SYSPTR USRSPC@;
6. Declare a space pointer for addressability to the space through a space pointer
(as opposed to the system pointer returned by the CRTS instruction):
DCL SPCPTR USRSPC;
Chapter 7. Machine Interface Programming 7-19