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



Adam's suggestion is the only way I can think of to accomplish your
desired functionality without opening and closing files to change
libraries. If you want to pretty it up some, you could hide the select
logic in a subprocedure so that it is out of the mainline. Something
like:

Fdetail IF E K DISK EXTFILE('LIB1/detail')
F RENAME(detail:L1det)
F PREFIX('L1')
Fdetail IF E K DISK EXTFILE('LIB2/detail')
F RENAME(detail:L2det)
F PREFIX('L2')

Then, your read logic would look like
do %eof(masterfile)
Read masterfile
Myfield = GetDetailFileField(........)


StartSubprocedure GetDetailFileField

select
when library = 'LIB1'
chain L1Det
when library = 'LIB2'
chain L2Det
endsl

EndSubprocedure


Of course, this only works if the # of libraries involved is relatively
constant. If # of libraries is completely variable (eg. library = item
and user can create items at will), I have an idea that may work, but
would require a little bit of thought before I post it.


Brian May
Project Lead
Management Information Systems
Garan, Incorporated
Starkville, Mississippi

Young i Professionals
http://www.youngiprofessionals.com

David FOXWELL wrote:

First read of masterfile :
ovrdbf to detailfile in lib1 or addlible lib1 in correct position
Chain to detailfile reads file in lib1

Second read of masterfile
ovrdbf to detailfile in lib2 or addlible lib2 in correct position
Chain to detailfile still reads file in lib1 because still open

[W]e are on V5R4.


I can think of a way of doing this, but it isn't particularly pretty. Nor
is it tested, but I've done something similar before. You could define a
different F-spec for each library's detail file, renaming the record
formats and prefixing the fields as appropriate.

Fdetail IF E K DISK EXTFILE('LIB1/detail')
F RENAME(detail:L1det)
F PREFIX('L1')
Fdetail IF E K DISK EXTFILE('LIB2/detail')
F RENAME(detail:L2det)
F PREFIX('L2')

Then, your read logic would look like
do %eof(masterfile)
Read masterfile
select
when library = 'LIB1'
chain L1Det
when library = 'LIB2'
chain L2Det
endsl
Myfield = detail file field

Hope this helps,
Adam

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.