Specifying the Teraspace Storage Model
Specifying the Teraspace Storage Model
To choose the teraspace storage model for your RPG, COBOL, C or C++ program, specify the following options when you compile your code:
-
For C and C++, specify *YES on the TERASPACE parameter when you create your modules.
-
Specify *TERASPACE or *INHERIT on the Storage model (STGMDL) parameter of the create module command for your ILE programming language.
-
Specify *TERASPACE on the STGMDL parameter of the Create Program (CRTPGM) or Create Service Program (CRTSRVPGM) command. This choice must be compatible with the storage model of the modules that you bind with the program. See Rules for Binding Modules for details.
You can also specify *TERASPACE on the STGMDL parameter of the Create Bound C Program (CRTBNDC), Create Bound C++ Program (CRTBNDCPP), Create Bound RPG Program (CRTBNDRPG), and Create Bound COBOL Program (CRTBNDCBL) commands, which create in one step a bound program that contains only one module.
On the CRTPGM and CRTSRVPGM commands, you can also specify *INHERIT on the STGMDL parameter. This causes the program or service program to be created in such a way that it can use either single-level storage or teraspace, depending on the type of storage in use in the activation group into which the program or service program is activated.
The use of the *INHERIT attribute provides the greatest flexibility, but then you must also specify *CALLER on the ACTGRP parameter. In this case, remember that your program or service program can get activated with either single-level storage or teraspace, and you must take care that your code can effectively handle both situations. For example, the total size of all static variables must be no larger than the smaller limits imposed for single-level storage.
Table 1. Allowed storage model for particular types of programs
| Program storage model | Program type | ||
|---|---|---|---|
| OPM *PGM | ILE *PGM | ILE *SRVPGM | |
| *TERASPACE | No | Yes | Yes |
| *INHERIT | No | Yes, but only with ACTGRP(*CALLER) | Yes, but only with ACTGRP(*CALLER) |
| *SNGLVL | Yes | Yes | Yes |