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



That sounds like another way of doing what I'm doing now, if I'm
understanding it correctly.
The hope is to have one procedure dynamic enough to open any file, and
that procedure wouldn't require any maintenance if a new file was added.
(A procedure for each file would require a new procedure when a file is
added to the module, so that wouldn't result in less maintenance which
is what I'm looking for).

Thanks,

Kurt 

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of
Rick.Chevalier@xxxxxxxxxxxxxxx
Sent: Friday, January 07, 2005 1:22 PM
To: rpg400-l@xxxxxxxxxxxx
Subject: RE: Open/Close of Files 


You might be able to create procedures for each file and use a pointer
to the procedures to mimic what you want.  I'm not sure that would be
any better from a complexity point of view though.  Especially if you
aren't experienced with pointers.

Rick

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


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


Privileged and Confidential.  This e-mail, and any attachments there to,
is intended only for use by the addressee(s) named herein and may
contain legally privileged or confidential information.  If you have
received this e-mail in error, please notify me immediately by a return
e-mail and delete this e-mail.  You are hereby notified that any
dissemination, distribution or copying of this e-mail and/or any
attachments thereto, is strictly prohibited.

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