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



If performance is very important, you can try to use the c file io
function (_Ropen,...) to do what you needed.

If performance is not import, you could create a sub-proc to reopen the
detail file when needed, code would look like below:

FDETAIL IF E K DISK extfile(actualDetailFile)
F INFDS(detailInfds) usropn

D detailINFDS ds qualified
D fileLib 93 102

D actualDetailFile...
D s 21 varying

D reopenDetailFile...
D pr
D piLib 10 const varying


/free

Read masterfile
dow not %eof(masterfile)
reopenDetailFile(WhatEverLib);
CHAIN detail file
Myfield = detail file field
. . .
Enddo

*inlr = *on;
/end-free
*****************************************************************
* reopen Detail File when Necessary
*****************************************************************
P reopenDetailFile...
P B
D pi
D piLib 10 const varying


/free

// only reopen the file if the library of the current opened
// detail file is not the same as requested
if detailInfds.fileLib <> piLib;
if %open(detail);
close detail;
endif;

actualDetailFile = %trim(piLib) + '/DETAIL';
open detail;
endif;

/end-free

P reopenDetailFile...
P E

"David FOXWELL" <David.FOXWELL@xxxxxxxxx> wrote in message
news:<mailman.2447.1231860518.15060.rpg400-l@xxxxxxxxxxxx>...
Hi,

A similar problem to the one I had using activation groups but for
reasons I won't explain, I can't use ACTGRP or TFRGRPJOB.

do %eof(masterfile)
Read masterfile
CHAIN detail file
Myfield = detail file field

enddo

One masterfile, several detail files in different libraries. Program
knows which library. Program is batch.

How do I CHAIN to the right detail file, each time leaving the file open
for the next read. Lots of other programs will want to be able to access
any information from the detail file in the same way.

Thanks.
----------

As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.