The program looks OK except that you only do a CRTLF, first you will need to do a DLTF to delete the logical before you compile it.
I’m not sure why you need to recompile all your logicals if you’ve only changed some attributes on your physical. If you have to recompile your physical, then you normally need to remove the logicals first, in which case your DSPDBR won’t find any logicals to recompile.
If you did add/remove/change fields in the file (or the PF key) you can also just issue a
<pre>CHGPF FILE(PF1) SRCFILE(QDDSSRC) </pre>
That will automatically create the new file, copy the data from the old file to the new file, recreate the logical files, and remove the old file.
Right, the CHGPF does it all and the CHGPF will cover any other PF atribute changes.
So the only reason for recompiling a LF is if you want to change it, perhaps add that new field as part of the Logical file key.
If the logical file has it’s own field list and you want to add this field to the LF, then you need to alter the LF code and recompile the LF.
Now for the bad news, if the Format Level Identifier changes – adding or deleting a field or changing a fields type/width/number of decimals, you will need to recomile all of the RPG/RPGLE/CBL/CBLLE programs that use this files external description. Also you must recompile any CL/CLLE programs that declare this file with DCLF since these use the file description. Some SQL uses of the file may need to be recoded. Other changes if the programs may also be required based on your logic but the recomiles are absolutely necessary.