OPNDBF

20 pts.
Tags:
AS/400
Database
DB2 Universal Database
RPG
This may sound stupid but I have not used OPNDBF command till now. I tried to use it thinking it will perform the same function as opening a database file in a COBOL program. I issued OPNDBF in a CL program and then tried to read records within a COBOL program without opening it in the COBOL program and I got the usual message wait when you try to perform operation in a database file without opening it - MCH3601. So now I am not sure in which all conditions OPBDBF is used. Can anyone give me some examples along with some code so that I can make out better how this is used. For your information, I have not even used any OVRDBF (though I had a notion that it may be required).
ASKED: October 20, 2005  4:49 AM
UPDATED: November 16, 2009  12:51 AM

Answer Wiki

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

You’ll have to do an OVRDBF with SHARE(*YES) and then the COBOL will still need the OPEN. It’s just that the OPEN won’t really have to do anything when it’s executed. i.e., no open data path (OPD) will be created.

==============================================================

The OPNDBF will create an ODP. If shared, the COBOL OPEN can use the same ODP, so a second full-open won’t have to be done. Full opens are relatively expensive (performance) operations.

OPNDBF can be used to create an ODP for any number of programs that will be called later in the job. That includes programs that might be called many times in a loop.

OPNDBF can also be used to create an ODP that can handle all types of opens — input only, output only or both. That means the later programs can still use the same ODP even if they’re doing different kins of operations.

For jobs that need to do many OPENs of particular files, setting the ODP early in the job, high in the call stack, performance can be significantly improved. Elements such as positioning in the file must be watched because a single ODP can only maintain a single position. Programs need to be sure that the next record to read or the record being updated will be the intended one.

Tom

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