The need for "temporary" files arises in nearly every application system at one time or another. Temporary files are commonly used for holding summarized data, passing large amounts of information between programs, or for preparing "flat" files for transfer to other systems (such as PCs).
The technique described in the following example is not new, but the application of it within LANSA yields some useful results.
Given that you identify a need for a temporary file called WRKFILE which contains the fields A, B and C, the suggested technique is as follows:
CHANGE FIELD(#LIB) TO(*PARTDTALIB)
EXEC_OS400 COMMAND('CRTDUPOBJ OBJ(WRKFILE) FROMLIB(#LIB) +
TOLIB(QTEMP)')
POINT FILE(WRKFILE) TO_LIBRARY(QTEMP)
This code will cause a duplicate version of file WRKFILE to be created in library QTEMP (your job's temporary library), and will then "point" all I/O commands involving file WRKFILE to the version of the file in QTEMP.
The best features of using work files in special library QTEMP are: