|
Aaron, I have a working example of the CEE4RAGE/2 thing in my book (which isn't out yet <g>) so I'm including the code here. Note that I use either CEE4RAGE or CEE4RAGE2 (the V5R3 version). The only difference is a 64-bit marker verses a 32-bit marker. Either would work on V5.3 and later. But this code works on all releases. -Bob Cozzi H BNDDIR('QC2LE') DFTACTGRP(*NO) ACTGRP(*NEW) D system PR 10i 0 extProc( 'system' ) D szCmd * VALUE OPTIONS( *String ) D myExitProc PR D ag_mark 20U 0 Const D reason 10U 0 Const D result_code 10U 0 D user_rc 10U 0 /IF DEFINED(*V5R3M0) ** 64-bit Exit Proc Registration (64-bit marker) D reg_exit_proc PR extProc('CEE4RAGE2') /ELSE ** 32-bit Exit Proc Registration (32-bit marker) D reg_exit_proc PR extProc('CEE4RAGE') /ENDIF D myExtProcPtr * PROCPTR CONST D fc 12A OPTIONS(*OMIT:*VARSIZE) // Mainline calc's. Normally you would use reg_exit_proc() // in a generic entry procedure in a service program. // But it may also be used in regular programs, like this one. C eval *INLR = *ON /free reg_exit_proc(%pAddr(myExitProc): *OMIT); // Do what you normally would do here. system('CRTPF FILE(QGPL/JUNK) RCDLEN(92)'); return; /end-free P myExitProc B EXPORT D myExitProc PI /IF DEFINED(*V5R3M0) D ag_mark 20U 0 Const /ELSE D ag_mark 10U 0 Const /ENDIF D reason 10U 0 Const D result_code 10U 0 D user_rc 10U 0 // Free up any unneeded objects /free system('DLTF FILE(QGPL/JUNK)'); return; /end-free P myExitProc E -Bob Cozzi www.iSeriesTV.com Ask your Manager to watch iSeriesTV.com -----Original Message----- From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of albartell Sent: Wednesday, September 13, 2006 8:38 AM To: 'RPG programming on the AS400 / iSeries' Subject: RPG destructor (program cleanup) was->RE: Costly PSDS Thanks for the suggestion Buck! Searches turn up this thread which looks like it will work perfectly: http://archive.midrange.com/rpg400-l/200406/msg00310.html Thanks Scott for providing the example. Aaron Bartell http://mowyourlawn.com -----Original Message----- From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Buck Sent: Wednesday, September 13, 2006 8:09 AM To: rpg400-l@xxxxxxxxxxxx Subject: Re: Costly PSDS
This is where it would be nice to have a "destructor" routine in RPG that is called when a program is ended because I am trying to figure out how to cleanup the data queues unique to each job. Sure I can code a routine that the programming calling me can call when the user exits out of their interactive app in a controlled fashion (i.e. hitting F3), but what is a best method to cleanup when the user simply closes their 5250 emulation window?
Look into the CEE4RAGE and CEERTX APIs. --buck
As an Amazon Associate we earn from qualifying purchases.
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.