× 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.



Hi Scott,

I *did* have OPNDBF in an earlier rendition of the app, but it didn't seem
to offer any improvement, so I took it out. I think the killer was not
specifying SHARE(*YES) on the OVRDBF. So, now, the POSDBF works.

However, I am still getting an error because the CPYF issues a CPF4123
("Open options ignored for shared open of member E2VAULTDIR.") three times
for type codes 2, 10, 6, and then fails on CPF2859 ("Shared open data path
not allowed.")

Also, the ReGen2 app deletes and recreates the E2VAULTDIR, and once I
restored the OPNDBF and kept the file open, the statement to delete the file
after it was opened failed. Since ReGen2 is already in production, I am
unable to change it, so this problem renders the current idea of using this
CLLE framework dead. I will have to rewrite this in RPG.

Thanks for getting me over the POSDBF hump!

- Dan

On Wed, Apr 28, 2010 at 1:24 PM, Scott Klement
<midrange-l@xxxxxxxxxxxxxxxx>wrote:

Hi Dan,

You're missing something fundamental. POSDBF has *no* direct impact on
a file you declare in your CL program with DCLF. Seriously. POSDBF can
*only* be used to affect files opened in the background with the OPNDBF
or OPNQRYF commands. Not files declared with DCLF.

If you don't understand the difference between opening a file in your
program, and opening it with OPNDBF or OPNQRYF, then you need to take a
step back and learn that part now, or you'll never really understand how
this technique works.

Anyway... with that in mind do the following before your ReadLoop:

OPNDBF FILE(E2VAULTDIR) OPTION(*INP) OPNID(DIR)
OVRDBF FILE(e2VaultDir) TOFILE(QTEMP/e2VaultDir) SHARE(*YES)

ReadLoop: /*existing */
Rcvf OpnID( dir ) /*existing */

When your CL program calls the first RCVF in the program, it will open
the file in your CL program. Since SHARE(*YES) has been defined, that
means it'll share the same ODP as the one opened with OPNDBF.

When you do the POSDBF later, it positions the one you opened with
OPNDBF -- but since the ODP is shared, that'll also position your CL's
copy -- letting you read it again.

At the end of the program (the EndOfFile: tag) you need to insert a CLOF
statement to close the copy of the file you opened with OPNDBF.

Good luck




On 4/28/2010 12:00 PM, Dan wrote:
Clumps of hair on floor. I found references in the archive that allows
multiple RCVF cycles of the same physical file in the same CLLE program
by
retrieving the number of records in the file and only attempting that
number
of reads so that CPF0864 is not triggered. However, in my attempt to
develop an app to use this technique, POSDBF is failing with CPF5230 "No
file open with OPNID(DIR)." The thing is that I'm stepping through this
in
debug mode, and I'm seeing that the POSDBF is being executed when my
record
read count =&NBRCURRCD from RTVMBRD. When I "Display Open Files" on the
job, the file is open and sitting at the last Relative Record Number. If
I
ignore CPF5230 and continue, the next RCVF triggers the CPF0864 error.

I've pasted below the source to the testing app I've created to debug
this.
The call to ReGen2 would normally change the data in the e2VaultDir file,
but I've swapped that out for the seven lines that follow for the purpose
of
testing this. The DLTF, CRTPF,& CPYF mimic the behavior of what happens
to
the e2VaultDir file in ReGen2. The following commands should be executed
before compiling and running the application:
CrtPF qtemp/e2VaultDir RcdLen(40)
CrtPF qtemp/e2VaultDi$ RcdLen(40)

TIA!
- Dan

Pgm
Dclf e2VaultDir OpnId( dir )
Dcl&NbrCurRcd *dec ( 10 0 )
Dcl&ReadCount *dec ( 10 0 )

Loop1:
/* Call ReGen2<=== disable for test */
DBU qtemp/e2VaultDi$ /* test */
DltF qtemp/e2VaultDir /* test */
MonMsg CPF2105 /* File not found */ /* test */
CrtPF qtemp/e2VaultDir RcdLen(40) /* test */
cpyf qtemp/e2VaultDi$ qtemp/e2VaultDir /* test */ +
MBROPT(*add) FMTOPT(*NOCHK) /* test */

RtvMbrD qtemp/e2VaultDir NbrCurRcd(&NbrCurRcd )
OvrDbf e2VaultDir qtemp/e2VaultDir
ChgVar&ReadCount 0
ReadLoop:
Rcvf OpnID( dir )
ChgVar&ReadCount (&ReadCount + 1 )
If (&ReadCount>=&NbrCurRcd ) Then( Do )
PosDBF OpnID( dir ) Position( *Start )
Goto EndOfFile
Enddo
Goto ReadLoop
EndOfFile:
DltOvr e2VaultDir
Goto Loop1
EndPgm

--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.



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.