|
Hi Jameslist
Have a Look at the EXTFILE File level keyword.
You can specify File , Library in it to specifically target the library
(and even a different file name) you want. The files need to be opened
under user control
If the library name needs to change, you don't need to end the program,
Just close the file, Change the EXTFILE variable, and reopen the file.
It seems to be much faster that manipulatng the library list, but that's
just my experience.
Cheers,
Martin
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of James H. H. Lampert
Sent: 20 January 2010 17:28
To: RPG programming on the IBM i / System i
Subject: File open fails because of a level check error -- can I catch
this,and find out where it tried to open the file?
We have a situation in which an RPG program is checking the library on
an open file, to make sure it's open in the right library. If it isn't,
it closes out the "wrong" instance of the file, shells out commands to
remove the "wrong" library from the *LIBL and add the "right" one, then
reopens the file in the "right" library.
In short, to pseudocode, with LibraryWeGot derived from open feedback on
a file:
WHILE LibraryWeWant <> LibraryWeGot
close all the files
shell out "RMVLIBLE " + LibraryWeGot
shell out "ADDLIBLE " + LibraryWeWant + "*LAST"
reopen all the files
(And EXTFILE clauses on the F-specs are not an option here, for reasons
I'd rather not go into.)
At any rate, I just discovered a loophole: if the file on which we're
getting the open feedback has a level check issue, the exception stops
us before we reach the block that checks to see if we're in the right
library.
Assuming I catch the exception, is there an easy way to find out what
"LibraryWeGot" is?
--
JHHL
--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing
list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/rpg400-l.
--------------------------------------------------------
This message (including any attachments) is only for the use of the
person(s) for whom it is intended. It may contain Mattel
confidential and/or trade secret information. If you are not the
intended recipient, you should not copy, distribute or use this
information for any purpose, and you should delete this message and
inform the sender immediately.
Mattel UK Limited is incorporated in England and Wales with its
registered office at Mattel House, Vanwall Business Park, Vanwall
Road, Maidenhead, Berkshire SL6 4UB. Company Registration Number 1471442.
--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.
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.