DB2 logical files

1150 pts.
Tags:
DB2/400
Logical Files
Physical File
HI, i wanted to know if i can add a new field to a PF via a logical file. If yes give me an example. thanks....ram

Answer Wiki

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

Hi,

What you’re asking isn’t possible. The fields in a logical are a “view” of the fields in the physical – the fields have to exist in the physical first, before they can be used in the logical.

Regards,

Martin Gilbert.

Gilbert is right, as always. But give us an idea of what you’re trying to do, perhaps we can make some recommendations.

Phil

Dido… but why not just add it to the PF and NOT COMPILE. Just do a CHGPF and specify *NO for record level check. If you compile it it will make all the other programs using that file to not work. So changing it will get your new field in the file. You might have to do it on your logical too.. I can’t remember if you have to or not.

Ten2008 —

I would agree that adding the field to the source and then doing a CHGPF to update the physical file is the best way to go. The logical files automatically get updated. But I disagree with specifying level check = *NO. It’s best to identify where those files are used and recompile all those programs once you have done your CHGPF.

Tod

>>>>>>>>>>>

I think Tod’s right on this. LVLCHK(*NO) is (in my opinion) a last resort option to get/keep things working. It’s something I would only use when I have no source for one of the programs that uses the file or for some reason can’t re-compile the program.

Regards,

Martin Gilbert.

<<<<<<<<<<<<

If you change the PF and want to use the LVLCHK(*NO) you should add the field to the end of the record format otherwise your programs wil give bad results without being compiled. I would not recommend doing this except in a have to situation.

Gary Whitten

WOW. lol.. I agree but its a solution. It all depends on the system avaialbility etc. *no level check is vert dangerouse… Be carefull.. If you only have a few programs using it then great. But if you have a few thousand using the file then it might take some time to compile.

Ron

Discuss This Question: 2  Replies

 
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
  • BigKat
    You CAN create some new fields in the logical that aren't "in" the physical. They just have to be based on fields that are. You can substring, concatenate, and rename existing fields to make new ones Kevin Affiliated
    8,350 pointsBadges:
    report
  • Vatchy
    Actually, in a way, you can. Create a new PF with the new field in it, along with the fields from the original PF that will allow you to match the two files. Then create a join logical over both files, selecting the fields you need from the original PF and the new field from the new file. Of course, this only works if no, or very few, existing programs need to access the new field; otherwise, what they said.
    1,410 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