Dealing with Temporary Files in WebDocs iSeries

Posted on July 28, 2016

WebDocs iSeries uses the IFS directory /RJSTEMP and the library RJSTEMP to store information and files temporarily. In general, it will attempt to clean up after itself, but there are situations which arise that do not perform clean up operations. As a result, files will gradually accumulate, taking up disk that could otherwise be used for other processes.

The RJSTEMP library

The RJSTEMP isn’t only used by WebDocs iSeries, and it’s considered unsafe to simply do a CLRLIB except immediately following an IPL, and before any RJS Software processes have started. Generally the only reason that the library tends to expand is if new user sessions are being created without being cleared. Older versions of WebDocs iSeries were particularly prone to this. Versions of WebDocs above 3.08 should have the command:

DOCRMVSESU USER(*ALL)

which can be scheduled to run on a nightly or weekly basis. At version 3.14 or above, the DOCSESPRG command is available as well to manage session files during operations. (for more information, see last week’s article, item 2: Problems with folder or document access).

A simple query can determine whether RJSTEMP has grown due to sessions that have not been cleared:

SELECT COUNT(*) FROM RJSIMAGE/DOCSES00

The following query can be used to count the actual number of temporary tables in the RJSTEMP library:

SELECT COUNT(*) FROM QSYS2/SYSTABLES
WHERE SYSTEM_TABLE_SCHEMA = 'RJSTEMP' 

Clearing RJSTEMP

Clearing the RJSTEMP library should only be done when the system is in a restricted state, or when no RJS processes are running.

CLRLIB RJSTEMP

The /RJSTEMP IFS folder

The RJSTEMP directory is a directory that is created on the root (‘/’) of the IFS by RJS Software Products and is used as a temporary working folder for many RJS Software Systems solutions.

The RJSTEMP directory can be accessed by running the following command:

 WRKLNK '/RJSTEMP'

When to Purge the RJSTEMP Directory

Care should be taken when purging the RJSTEMP directory. Do not run a purge command if there are any RJS Software Systems processes currently running on the iSeries or on a Server that is connecting to the iSeries as it could cause those applications to error and/or hang.

 It is strongly recommended that you limit the purging process to one of two possible occasions:

1. If your company typically allows most of their jobs to end at night and use a scheduler to start them off again early in the morning, you could schedule the purge command to run before you start up the jobs running RJS Software Systems solutions.

2. When you IPL your iSeries, the purge command can be added to your system start-up before the typical jobs get started.

How to Purge the RJSTEMP Directory

The command below will allow you to purge a single file or an entire directory of files on the IFS. Due to the fact that this command is extremely easy to use and the fact that it permanently removed files from the IFS, please make sure that you have read the security warnings and suggestions above.

1. To Purge a Single File from the IFS

The following example assumes that I want to purge the file TEST.PDF from the ‘/RJSTEMP’ directory on the IFS.

RMVLNK OBJLNK('/RJSTEMP/TEST.PDF')

2. To Purge All Files from Single Directory on the IFS

The following example assumes that I want to purge all the files from the ‘/RJSTEMP’ directory on the IFS.

RMVLNK OBJLNK('/RJSTEMP/*')

3. To Purge Select Files from Single Directory on the IFS

The following example assumes that I want to purge all the files that start with the letters “RJS” from the ‘/RJSTEMP’ directory on the IFS.

RMVLNK OBJLNK('/RJSTEMP/RJS*')