File Caching in RSE
November 18, 2009 Jon Paris
Two of my favorite features of RSE are the Outline View and the Program Verifier. One thing they both have in common is the fact that they use cached descriptions of any required externally described files. These cached descriptions are retrieved once and then stored in the RSE workspace for fast retrieval when required to refresh the Outline View or when Verifying the code in the editor. Because both these features rely on those cached descriptions, they also have something else in common; when a file’s external description changes, neither of them will automatically catch on to that fact. Therefore they can be using out of date file information and this can be a common cause of confusion. “What do you mean there’s no such field? I just added it to the file and recompiled it!” There are a number of ways to deal with the “out of date” file cache situation. Depending on whether you know that a specific file’s description has changed or merely suspect that to be the cause of some behavior (such as verifier errors of the type described above), you may choose one or the other of the following options: 1. If you know the file(s) that have changed, you can easily update the cached information. Locate the file in the Remote Systems tree view, right-click on the file, and then select “Cache File Descriptions.” Now when you refresh your outline view and/or re-verify your source, you should see that you have the updated file and field descriptions. Don’t forget that if this is a new file, you may need to refresh the tree view before you can see it. 2. If there are a number of files where the new file descriptions don’t seem to be showing up or if you’re not sure which file the fields should be in, an alternative approach is to select the Verify (Prompt) option, select “Cache” from the list on the left, and check the “Refresh Cache” check box. When you subsequently press “OK” to invoke the verifier, it will go out and re-cache all the file descriptions for files used by that source member. There are also options to completely clear your cache of all file descriptions, but that’s a pretty drastic thing to do and I can’t think of an occasion when that would be an advisable way to solve this particular problem. But in a few minutes we will discuss one set of circumstances where you might need to do this if you are using WDSC. Note that this issue of a “stale cache” will not be cured by closing and restarting WDSC/RDi, or recreating the file (whether within RSE or any other way). One might think that the “Refresh” button in the Outline view would do it, but sadly it doesn’t. For those of you interested in such trivia, the reason is that under the covers, the Outline view is populated by the cross reference data provided by the verifier! If only IBM would add a “Refresh All” button to force it to perform the underlying verification with the cache refresh option. It might seem logical that RSE would recognize that the DDS source for a file has been changed in the editor and that therefore it should refresh its cached version of that file, but sadly it is just not that intelligent. It gets its file descriptions exclusively from the file object itself, never from the source, and it only goes back to update its file description information when forced to using one of the methods mentioned above. I mentioned earlier that there was one situation where you would need to clear the entire cache. This relates to a bug in WDSC that causes the verifier (or a refresh of the outline view) to take longer and longer and longer. What causes the slow down? Apparently the algorithm used for searching the cache is very inefficient when the cache lists are very large. Sadly, although this bug has been known for a while, IBM chose not to fix it in WDSC, so you will have to move to RDi to get rid of it. In order to work around the problem in WDSC, the cache has to be cleared completely. There are actually two “clear cache” options in the preferences. The one you need appears on the Remote Systems→iSeries→Cache preference page. For those using RDi , it’s Remote Systems→IBM i→Cache, but since this particular problem is fixed in RDi, you shouldn’t need to use it for this purpose. The button you need is marked “Clear Cache.” You do NOT want the button on another page that says “Clear Cached Files”. If you use that one, you’ll wipe out of the all temporary copies of the source members open in the editor, which could really ruin your day if you haven’t saved them! P.S. For the adventurous among you, it is possible to edit the cached file descriptions used by WDSC, but it is not a task for the faint of heart. This is something I occasionally did when truly desperate, perhaps because I needed to verify or outline a program and had no internet connection available to pick up the current file descriptions. In RDi 7.5 all the layouts seem to have changed so I guess I’ll have to forgo that dubious pleasure. Jon Paris is one of the world’s most knowledgeable experts on programming on the System i platform. Paris cut his teeth on the System/38 way back when, and in 1987 he joined IBM’s Toronto software lab to work on the COBOL compilers for the System/38 and System/36. He also worked on the creation of the COBOL/400 compilers for the original AS/400s back in 1988, and was one of the key developers behind RPG IV and the CODE/400 development tool. In 1998, he left IBM to start his own education and training firm, a job he does to this day with his wife, Susan Gantner–also an expert in System i programming. Paris and Gantner, along with Paul Tuohy and Skip Marchesani, are co-founders of System i Developer, which hosts the new RPG & DB2 Summitconference. Send your questions or comments for Jon to Ted Holt via the IT Jungle Contact page.
|