× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hello David,

Does this parameter have any effect on a file used in an rpg by
embedded sql? I'm looking at a lot of ovrdbf in a clp that uses this
parameter, but without the opnqryf that I'm used to see following it.

I don't think it's possible to share an ODP opened by SQL. (Unfortunately, I can no longer remember where I heard that.) So unless I'm mistaken, SHARE(*YES) has no impact on embedded SQL.

As to why a CLP would use SHARE(*YES) without OPNQRYF, there are two common reasons I've encountered:

a) To improve performance. If you go many years back, when computers had only kilobytes of memory, the cost (in terms of memory and performance) of opening a file multiple times was very high. So if you had multiple programs using the same file, you'd share the ODP so they'd all share the same file open, improving performance and reducing memory footprint. IMHO, this is not a good practice today.

b) There was a common misconception that OVRDBF SHARE(*YES) in CL was the equivalent of the // FILEDISP-SHR in OCL. People translating their OCL's to CL's when converting from the S/36 would commonly replace //FILE NAME-FOO,DISP-SHR to OVRDBF FILE(FOO) SHARE(*YES).

The reason at (b) was a misconception. They do /not/ do the same thing at all. There's no need to do an equivalent of DISP-SHR on OS/400...


Sometimes the calls that follow are to SQLRPGLE programs, which is
the reason for my question. Sometimes the calls are to ordinary RPGs
and there, I don't understand why the programmer has added
share(*yes).

If the file isn't used on an F-spec (by anything that's called within the scope of the OVRDBF) or a similar mechanism to an F-spec... then I doubt the SHARE(*YES) is having any impact at all.

More likely the programmer just didn't understand that SHARE(*YES) was not required, and so kept it when converting from another technology. Since the share is ignored, it wouldn't have affected the program's ability to work or not work.

Scott Klement once did an article on OVRDBF. It showed the effect of
combining these commands at different call levels and override
scopes. Does anyone know where I might find that article?

Really? Hmmm.. I don't remember that (but then again, I don't remember much of anything these days.)


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.