Freeing storage when saving

 

Freeing storage when saving explains how to use the STG parameter to remove an object from your system after you save it. This only works with a limited number of commands.

Normally, saving an object does not remove it from the system. However, you can use the storage (STG) parameter on some save commands to free some of the storage that is used by saved objects.

If you specify STG(*FREE), the object description and search values remain on the system. The system deletes the contents of the object. You can perform operations such as moving and renaming an object whose storage you freed. However, restore the object to use it.

You can use the STG(*FREE) parameter for the object types in the following table:


Table 1. Object types that support freeing storage
Object Type Description
*FILE1,2 Database files
*STMF3 Stream files
*JRNRCV4 Journal receivers
*PGM5 Programs
*DOC Documents
*SQLPKG SQL packages
*SRVPGM Service programs
*MODULE Modules

1

When you free a database file, the system frees the storage that is occupied by the data portion of the object, but the object description remains on the system. If you save a database file that has already been freed and free its storage, the system does not save the object description and you receive the following message:
CPF3243 Member xxx already saved with storage freed
If you install the Media and Storage Extensions product on your system, and you save a database file and free its storage, the system saves the object description.

2

The system does not free the storage occupied by logical file access paths.

3

You can free storage for *STMF objects, but not during a save operation. Free the storage for *STMF objects with the Save Storage Free "Qp0lSaveStgFree() API".

You can save an *STMF object whose storage has already been freed, but restore the *STMF object before you can use it.

4

You can free storage for a journal receiver if it is detached and all previous journal receivers are deleted or have their storage freed.

5

Do not specify STG(*FREE) for a program that is running. This causes the program to end abnormally. For Integrated Language Environment® (ILE) programs, the program does not end abnormally. The system sends a message that indicates that the system did not save the ILE program.

You can also specify STG(*DELETE) on the Save Document Library Object (SAVDLO) command. This deletes any filed documents after the system saves them. This includes the object description, the document description, the search values, and the document contents.

 

Parent topic:

Before you save anything...
Related information
Qp0lSaveStgFree()