Moving Documents Between IFS Folders

June 27, 2016

Because WebDocs maintains a separation between its internal file structure and the operating system’s, you can organize documents for your users in one manner, while organizing them on the IFS in an entirely different manner. This article takes you through the steps of reorganizing the folder structure on the IFS.

This article assumes all of your documents are saving to a single IFS location: /RJSIMAGEDOC. Saving documents to a single IFS location has not been a problem for you until recently, but now that the system has been live for a little while the folder is beginning to become a bit ungainly, and takes several minutes for iSeries Navigator to load the several hundred thousand documents it contains. In addition, your nightly backups are taking longer now, and if things continue the backup jobs will take longer than their allotted time. To better handle the present, and in preparation for the future, you’d like to reorganize the documents on the IFS into a folder structure broken down by year, like so:


This can be done with relative ease, and in a manner that is completely invisible to your users. This article assumes that you have access to an iSeries user profile with *ALLOBJ special authority, that the system was initially installed in 2007, and that you have not reorganized documents on the IFS before. But first, enter the following commands on a command line:

RJSIMAGE/DOCSQL SQLSTM('select count(*) from rjsimage/docver00 where vftpfile ''''')
RJSIMAGE/DOCSQL SQLSTM('select count(*) from rjsimage/docs00 where darchsel ''Y''')

Both counts should return with zero results; if either command returns anything other than zero, please contact Technical Support before going further.

Creating the new folders

Before you attempt to move anything, you will need to create the new folder locations first.

For those who are using a mounted file system, the subfolders will need to be created on the mounted device. For example, if you are mounting an NFS share from a Linux fileserver into the IFS, you will need to create the new folders on the Linux fileserver, not from the iSeries.

To create the new folder locations, enter the following commands on a command line:


Update IFS Paths for Folders in WebDocs

Now you need to ensure that documents entering the system are going to the correct location. Update the existing WebDocs folders to point to this year’s folder (/RJSIMAGEDOC/2010) from the Work with Document Folders menu option:

Option 11: Work with Document Folders

Updating IFS paths in rjs webdocs

Replace ‘/RJSIMAGEDOC’ with ‘/RJSIMAGEDOC/2010′ for each folder.

updating ifs folders in webdocs

Select documents to be moved

Changing the IFS Path in a WebDocs folder entry specifies where to save new documents that are entering the system, but it does not move any documents already in the system. So the next step is to split the documents that are already in the system into the four subfolders you created by specifying what documents will be moved to each subfolder. To select a range of documents to be moved, set the DARCHSEL field in the DOCS00 physical file to ‘Y’ using the query below:

RJSIMAGE/DOCSQL SQLSTM(‘update rjsimage/docs00 set darchsel = ”Y” where year(chkdate) = ”2007”’)

In your environment, the criteria could be anything that you can query – index values, user IDs, document types, folders, or any combination you can envision.

Moving the documents

All documents checked in to WebDocs in 2007 are now selected to be moved, so your next step is to run the DOCMOVLOC command to begin the move process. The move process will take some time, depending on how many documents you are moving, but the documents will still be available to your users. The command first moves each document to the new location, and checks the document to ensure that it copied correctly. Only then does DOCMOVLOC update the database to point to the new location, and delete the file from the old location. As far as your users are concerned, no change will have occurred. To run the DOCMOVLOC command, enter the following on a command line:


Once the DOCMOVLOC command completes, run the update statement to select 2008’s documents and follow it up with the DOCMOVLOC command going to /RJSIMAGEDOC/2008. Repeat for 2009 and 2010.

Now your documents are neatly split up into subfolders by the year they entered the system. You’ll want to make an annual reminder to create the next folder in the series (/RJSIMAGEDOC/2011 in this example), and change the IFS Paths in the Work with Document Folders menu (or, if you’re a programmer, write a short program to do so automatically).


Related Products

Related Solutions