Good idea.
I'll have to test it later.

Thanks,

Kurt 

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of
MWalter@xxxxxxxxxxxxxxx
Sent: Friday, January 07, 2005 1:24 PM
To: RPG programming on the AS400 / iSeries
Subject: Re: Open/Close of Files

Could you write a subprocedure in CLLE using the OPNDBF command?

Thanks,

Mark

Mark D. Walter
Senior Programmer/Analyst
CCX, Inc.
mwalter@xxxxxxxxxx
http://www.ccxinc.com


 

             "Kurt Anderson"

             <kjanderson@highs

             mith.com>
To 
             Sent by:                  "RPG programming on the AS400 /

             rpg400-l-bounces@         iSeries" <rpg400-l@xxxxxxxxxxxx>

             midrange.com
cc 
 

 
Subject 
             01/07/2005 02:04          Open/Close of Files

             PM

 

 

             Please respond to

              RPG programming

              on the AS400 /

                  iSeries

             <rpg400-l@midrang

                  e.com>

 

 





On the topic of file usage, is there a way to open/close a file by way
of a pointer?

(Had a hard time writing this next paragraph, but I hope it conveys what
I'm doing and why I'm doing it).
A while back I wrote a srvpgm wherein there were a bunch of
subprocedures.  Due to multiple entry points (multiple exported
procedures), they used a variety of different files, but wherein certain
subprocedures used files that may or may not be used by other
procedures.  I didn't want to open all the files, only the ones I'll be
using, so I devised an OpenFile procedure and a CloseFile procedure for
the open/close of files.

 // Procedure Interface
D OpenFile        PI              N
D  FileName                     10A   Const

The procedure would then have multiple When statements like the one
below (all w/in the same Select).

//  Customer Special Terms file
Select;
When FileName = 'FILEA';
  If Not %Open( FileA );
     Open FileA;
     FileOpened = *On;
  Else;
     FileOpened = *Off;
  EndIf;
EndSl;

Return FileOpened;

Based on the returned indicator (local to the calling procedure) the
procedure would then know if it needed to call the CloseFile procedure.


This would work so much better if I didn't have to hardcode the file
into this OpenFile (or CloseFile) procedure, hence my question of using
a pointer (or some other means).  The way it is now, whenever I added a
new file to the module I'd need to add code to the OpenFile and
CloseFile subprocs.  Side note: I'm not very knowledgeable on the use of
pointers yet.

Kurt Anderson

--
This is the RPG programming on the AS400 / iSeries (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 is the RPG programming on the AS400 / iSeries (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.



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.