query in OVRDBF

0 pts.
Tags:
i5
iSeries
OS/400
Hi, What are the consequences of overriding multiple files to the same file? Ex: OVRDBF FILE(ABCD1) TOFILE(QTEMP/TEMP) OVRDBF FILE(ABCD2) TOFILE(QTEMP/TEMP) OVRDBF FILE(ABCD3) TOFILE(QTEMP/TEMP) Thanks in advance.
ASKED: November 26, 2004  5:43 AM
UPDATED: November 28, 2004  3:43 PM

Answer Wiki

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

There are no technical problems other than all the rules regarding file opens/updates etc still apply.
So you need to be careful about things like having say ABCD1 and ABCD2 both open in the same program and performing CHAINs and UPDATEs. Unless you specify SHARE(*NO) on the OVRDBF every record pointer change you make in ABCD1 will also occur in ABCD2. That is, if you perform a CHAIN to ABCD1 followed by a CHAIN to ABCD2 then perform an UPDATE to ABCD1 you will actually be updating the record accessed in the CHAIN to ABCD2!
Also, you have to be careful with file opens when using SHARE(*YES) since all the files are sharing the same open data path you can not perform an UPDATE on say ABCD2 if you opened ABCD1 first and you specified ABCD1 as input only.
So, generally you would always use SHARE(*NO) in your OVRDBFs and then each file would be treated as fully independent of the other. This is a good technique if you wish to say read through a file sequentially and for each record CHAIN to other records in the same file without losing your sequential read position.
There is good info on the use of OVRDBF and SHARE options in the RPG Programmers Guide. Happy reading!

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