David,
I'm not sure what you are trying to accomplish by having the "duplicate"
procedures for each detail file. Here is how I would do it:
If there are only 8 libraries involved (which I think you mentioned)
fMaster if e k Disk
fDetail1 if e k Disk ExtFile('LIB1/DETAIL')
f Rename(DETAILREC:DETAIL1REC)
fDetail2 if e k Disk ExtFile('LIB2/DETAIL')
f Rename(DETAILREC:DETAIL2REC)
fDetail3 if e k Disk ExtFile('LIB3/DETAIL')
f Rename(DETAILREC:DETAIL3REC)
fDetail4 if e k Disk ExtFile('LIB4/DETAIL')
f Rename(DETAILREC:DETAIL4REC)
fDetail5 if e k Disk ExtFile('LIB5/DETAIL')
f Rename(DETAILREC:DETAIL5REC)
fDetail6 if e k Disk ExtFile('LIB6/DETAIL')
f Rename(DETAILREC:DETAIL6REC)
fDetail7 if e k Disk ExtFile('LIB7/DETAIL')
f Rename(DETAILREC:DETAIL7REC)
fDetail8 if e k Disk ExtFile('LIB8/DETAIL')
f Rename(DETAILREC:DETAIL8REC)
/Free
Read Master ;
Dow Not %EOF(Master) ;
GetDetailFileRecord(Library : RefID) ;
Read Master ;
EndDo;
Procedure GetDetailFileRecord
/Free
Select ;
When Library = 'LIB1' ;
Chain Key Detail1 ;
When Library = 'LIB2' ;
Chain Key Detail2 ;
When Library = 'LIB3' ;
Chain Key Detail3 ;
When Library = 'LIB4' ;
Chain Key Detail4 ;
When Library = 'LIB5' ;
Chain Key Detail5 ;
When Library = 'LIB6' ;
Chain Key Detail6 ;
When Library = 'LIB7' ;
Chain Key Detail7 ;
When Library = 'LIB8' ;
Chain Key Detail8 ;
EndSl;
Now if new libraries and detail files are created frequently, I can help
you off list with a more flexible solution.
As for your question about %OPEN, you would use the name defined in the
program, not the actual name of the file when checking so there would be
no confusion. In my example I could use if %OPEN(DETAIL4).
HTH,
Brian May
Project Lead
Management Information Systems
Garan, Incorporated
Starkville, Mississippi
Young i Professionals
http://www.youngiprofessionals.com
As an Amazon Associate we earn from qualifying purchases.