Previous Topic: Using Explicit References to LibrariesNext Topic: Using QGPL


Using QTEMP

If a job needs to create temporary work objects in order to execute, for example, message queues, data areas, or files, the objects should be created in the job’s scratch library, QTEMP. This will ensure that:

Work objects should be duplicated into QTEMP by use of the OS/400 Create Duplicate Object (CRTDUPOBJ) command, working on a model object kept in the system execution object library. Note that the CRTDUPOBJ command requires that the name of the library containing the model object be specified—the name of the originating library should not be ‘hard coded’ as a literal, but retrieved, as above.

It may not be desirable to give the user rights to use the CRTDUPOBJ command, in which case a special ‘duplication program’ may be created with USER(*OWNER), which will adopt the rights of a user profile that has the necessary authorities.

You should allow for the possibility of the work object already existing in QTEMP. You do not need to delete the work object explicitly when you finish.

The following code would create a work file UUWKFLP in QTEMP from a model library, by calling a program UUCRDPC, which in turn, calls a program UULBNMR.