From: James Moore To: All
I need to add a field to our Master physical file. Can anyone give me some tips on what to watch out for? Will I have to recompile the logicals (10 of them) or will an IPL take care of that? Also, will I run into level check problems? Any help would be appreciated.
From: Pete Hall To: James Moore
Yes-on all counts. You could specify LVLCHK(*NO) on the CRTxF or CHGxF commands; but if you do that, your new field may not be properly initialized when records are added, and if the new field is not at the end of the record, you stand a very good chance of corrupting your data. Even input operations may return garbage. You will need to delete all dependent logicals before you will be able to delete the old physical file. If you leave the old physical file on disk, the logicals will remain attached to it. In general, the procedure for modifying a physical file record definition is as follows:
1. Delete all dependent logicals.
2. Rename the old physical file.
3. Create the new physical file (CRTPF).
4. Map the old data into the new file:
CPYF FROMFILE(LIB/OLDFILE) +
TOFILE(LIB/NEWFILE) +
MBROPT(*ADD) FMTOPT(*MAP *DROP)
5. Recreate all dependent logicals (CRTLF).
6. Recompile all programs which use the file or any dependent logicals. If you can't easily identify the programs, either use PDM to scan for the file name, specifying option 14 (compile), or use DSPPGMREF to build an output file for all programs in the application libraries, and write a query to list the programs that use the file(s) or the record name(s), and then manually submit the compiles working from the query report. If you want to get fancy, you can write a CL program to process the DSPPGMREF file and submit the compile commands automatically. You could even front-end the CL program with an OPNQRYF, which would allow a general purpose program to recompile all impacted programs based on a variable file name. I'll bet that would make a neat utility for MC.
7. Delete the old physical file after you are sure that the data is OK.
From: Ernie Malaga To: James Moore
Pete's advice is sound, but I want to add one more tip you may have missed. QUSRTOOL contains a command to recreate a physical file, named Rebuild Database File (RBLDBF). There's also another command to delete all dependent logicals at once (DLTDEPLGL), which is worth looking into.
In general, I don't trust QUSRTOOL much. So, though I can't really recommend that you use these utilities, they could be what the doctor ordered.
LVLCHK(*NO) should be used only temporarily, to get something urgent out the door, but never as a permanent solution. It's a sure-fire way to get into trouble, as Pete mentioned.
LATEST COMMENTS
MC Press Online