Fixing paths in WebDocs iSeries (NFS Edition)

This week I had an interesting discussion with a customer, which dovetailed nicely with the two topics we?ve addressed thus far at RJS Hacks: changing file paths in WebDocs iSeries and mounting remote filesystems into the IFS.The situation is as follows:Company X stores all their documents locally on the IFS. Eventually, this is deemed to take up too much space, and a fileserver was built to hold all but the most recent documents. A directory was created for each year/month on the fileserver, and each directory had its own NFS share, and was mounted separately into its own, corresponding, IFS directory.This was ungainly, and unpleasant to manage, so we were asked to help clean things up. They created a new folder structure on the fileserver, but they were hesistant about resetting the database to re-run the DOCMOVLOC command, and rightly so. Because the file origin and destination were both on the fileserver, it would be faster to simply move the files to the new folder structure manually and then manually update WebDocs to point to the new location.We will be directly editing two of the most important physical files in WebDocs: DOCS00 and DOCVER00. Make a backup of the RJSIMAGE library, and make sure that no one is using the system, and that there are no processes checking in documents while following the steps below.For this example, the IFS path /RJS/NFS/Bad/Folder/Structure represents the old mount location on the IFS, and /RJS/NFS/Improved/Folder/Structure/ represents the new. Replace these paths with whatever is relevant on your system.Once all the documents had been manually moved to their new locations, we ran the following two queries:Query 1: Unsets the fields that flag a document as ?Archived?, modifier the fields to point to the new location (DOCVER00):update rjsimage/docver00 set vdocpath = replace(vftppath, '/RJS/NFS/Bad/Folder/Structure/', '/RJS/NFS/Improved/Folder/Structure/'), vdocfile = replace(vftpfile, '/RJS/NFS/Bad/Folder/Structure/', '/RJS/NFS/Improved/Folder/Structure/'), varchsel = '', vftpfile = '', vftppath = '', vdiskstat = '' where vftppath like '/RJS/NFS/Bad/Folder/Structure/%'Query 2: Unsets the fields that flag a document as ?Archived?, modifier the fields to point to the new location (DOCS00)update rjsimage/docs00 set diskstatus = '', darchsel = '', docpath = (select VDOCPATH from rjsimage/docver00 join rjsimage/docs00 on vdocid = docid where vdocpath LIKE '/RJS/NFS/Improved/Folder/Structure/%'), docfile = (select VDOCFILE from rjsimage/docver00 join rjsimage/docs00 on vdocid = docid where vdocpath LIKE '/RJS/NFS/Improved/Folder/Structure/%') where docid = (select VDOCID from rjsimage/docver00 join rjsimage/docs00 on vdocid = docid where vdocpath LIKE '/RJS/NFS/Improved/Folder/Structure/%')