× 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 the ACTGRP ends the files & all resources used by the activation
group are recovered (if ACTGRP(*NEW) this is done auto-magically) if you
reclaim the ACTGRP ( if a named ACTGRP then the same applies.)
 


Thanks,
Tommy Holden


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Marco Facchinetti
Sent: Wednesday, November 09, 2005 10:04 AM
To: RPG programming on the AS400 / iSeries
Subject: Re: ILE and Access Paths

Barbara, what are the risks if the activation group ends and the files
are
not yet closed?

Thanks
Marco

--- Barbara Morris <bmorris@xxxxxxxxxx> wrote:

> 
> Here's a sketch of a module with a cleanup procedure.
> 
>  * Module HDLMYFILE
> H nomain
> Fmyfile   if      e           disk usropn
>  /copy prototypes
> D p             s         *   inz(*null)
> P myproc        b             export
>  /free
>     if not %open(myfile);
>       open myfile;
>     endif;
>     read myfile;
>     if something ---
>        eval p = %alloc(10);
>     ---
>  /end-free
> P               e
> 
> P hdlMyfile_cleanup...
> P               b               export
>  /free
>    // close files
>    close *all;
>    // free allocated storage
>    if p <> *null;
>      dealloc(n) p;
>    endif;
>  /end-free
> P               e
> 
> Here's how the main procedure of the program's uep module would look,
> along with the cleanup() procedure of the uep module.
> 
>  /free
>      // enable cancel handler to ensure cleanup() is called
>      // doing parameters by memory, maybe not exactly 3
>      ceertx (%paddr(cleanup) : *omit : *omit);
> 
>      // do the function of the program
>      --- whatever ---
> 
>      // cleanup 
>      cleanup();
>      *inlr = '1';
>      return;
>  /end-free
> 
> P cleanup       b
>  /free
>    // cleanup submodules
>    hdlMyfile_cleanup();
>    queries_cleanup();
>    reports_cleanup();
>    whatever ('CLEANUP')  // say you have a submodule with a main
> procedure
>                          // and 'CLEANUP' is the special parameter
> indicating
>                          // that it should just SETON LR and RETURN
> 
>    // cleanup this module's allocated storage if necessary
>    // could also delete any temporary files or any other cleanup
> necessary
>    if somepointer <> *null;
>      dealloc(n) somepointer;
>    endif;
>  /end-free
> P               e
> 
> You might do similar processing for modules in service programs linked
> to your program, but a service program module might be "serving" more
> than just one program, so you might want a service program module to
> stay 'active' for your whole job.
> 
> But as someone already said in this thread, you can get most of the
> cleanup done just by reclaiming the activation group.
> 



        
                
__________________________________ 
Yahoo! Mail - PC Magazine Editors' Choice 2005 
http://mail.yahoo.com

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.