Free storage when saving

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

Normally, saving an object does not remove it from the server. 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 server. The server deletes the contents of the object. You can perform operations such as moving and renaming an object whose storage you freed. However, you must 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
Start of change*FILE1,2End of change 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 server frees the storage that is occupied by the data portion of the object, but the object description remains on the server. If you save a database file that has already been freed and free its storage, the server 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 server, and you save a database file and free its storage, the server saves the object description.
2
The server 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 you must 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 server sends a message that indicates that the server 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 server saves them. This includes the object description, the document description, the search values, and the document contents.

Related information
Qp0lSaveStgFree()