Compile all dependent logical files at once

90 pts.
Tags:
AS/400 Control Language
CL
CL/400
Logical File
Physical File
I would like to convay my Thanks ReshmaG & Gilly400. My main requirement is I have a Physical file called PF1.On this there are 20-logical files are depended . I have changed some attributes on my PF1. Now I want to recompile all the Logical Files , which are depended on PF1. I am writing code like the following:

PGM DCL VAR(&LFNAM) TYPE(*CHAR) LEN(10) DCL VAR(&LL) TYPE(*CHAR) LEN(10) DCLF FILE(SARKNS/LG) DLTF FILE(SARKNS/LG) DSPDBR FILE(SARKNS/pf1) OUTPUT(*OUTFILE)+ OUTFILE(SARKNS/LG) START: RCVF RCDFMT(QWHDRDBR) MONMSG MSGID(CPF0864) EXEC(GOTO CMDLBL(END)) CHGVAR VAR(&LL) VALUE(&WHREFI) CRTLF FILE(SARKNS/&LL) SRCFILE(SARKNS/FIVE) + SRCMBR(&LL) GOTO CMDLBL(START) END: ENDPGM 
Here LG is an Outfile . Variable - LL will contain the dependent logical file name . With this I can compile all the dependent file on PF1. I don't want to recompile one-by-one. This is my requirement. Thanks in Advance.
ASKED: March 26, 2009  10:35 AM
UPDATED: August 26, 2013  4:52 PM

Answer Wiki

Thanks. We'll let you know when a new response is added.

Hi,

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.

Regards,

Martin Gilbert.

——————————————————
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.

Phil

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • BobbyOfWindsor
    Have you tried using the CHGPF command. This will let you update the file and fields without losing the data. I use it all the time and it works great. Bobby.
    80 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following