Add a field in existing file in DB2/400

265 pts.
Tags:
AS/400 DB2
CHGPF
DB2
Physical File
I need add a field in existing Physical file without impacting any other file? I know the CHGPF command but I'm not sure about which parameter needs to be update. Please advice.

Answer Wiki

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

There’s no way you don’t impact something

1. Add field to DDS – generally fields are added to the end of files, this my avoid a few errors.
and
1.1 CHFPF pointing at the lib/QDDSSRC/Member
or
1.2. Add the field using SQL ALTER Table command

2. The Format Level Identifier will be changed and this means that every RPG program that includes the file in an ‘F’ spec with External format will need to be recompiled. Also CL programs and cobol programs

3. Every other RPG program that uses the file as a datastructure should also be compiled

4. Any SQL’s that use the file may need to be altered
– if they do an insert without a value list the new field needs to be added
– if they do a select * the field needs to be added to the receiving datastructure

I think the CHFPF adds the field to the logicals, unless the logicals contain a field list — items 3-5 apply to the logicals

Every query/400 that uses the file needs to be opened for change so it will pick up the new format level.

Good Luck
Phil

Discuss This Question:  

 
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

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