ILE RPG Programmer's Guide


Converting the FREE operation code

To replace the function of the FREE operation, you must first determine why the FREE operation was being used.

 * RPG III coding
C                     CALL 'MYPGM'
C                     PARM             P1
...
C                     FREE 'MYPGM'
...
C                     CALL 'MYPGM'
C                     PARM             P1

* Replacement RPG IV coding for the "reresolve" function of FREE 

C                   call      MYPGM_var
C                   parm                    p1
 ...
 * Cause MYPGM to initialize on the next call
C                   call      MYPGM_VAR
 ...
C                   call      MYPGM_var
C                   parm                    p1

* Modified version of MYPGM.  It ends itself when it is called with no parameters.
D                SDS
D PARMS             *PARMS
C     *ENTRY        PLIST
C                   PARM                    NAME             10
c     PARMS         IFEQ      0
C                   SETON                                        LR
C                   RETURN
C                   ENDIF
 ...
 * RPG III coding
C                     CALL 'MYPGM'
C                     PARM             P1
...
C                     FREE 'MYPGM'
...
C                     CALL 'MYPGM'
C                     PARM             P1

* Replacement RPG IV coding for the "reresolve" function of FREE 

D MYPGM_var       s             21a   INZ('MYPGM')
C                   call      MYPGM_var
C                   parm                    p1
 ...
 * Cause a reresolve to MYPGM for the next call
C                   eval      MYPGM_var = 'MYLIB/FREEPGM'
C                   call      MYPGM_VAR
C                   reset                   MYPGM_var
 ...
C                   call      MYPGM_var
C                   parm                    p1

To replace the function of the DEBUG operation, use an interactive debugger. For information on program debugging see Debugging Programs.


[ Top of Page | Previous Page | Next Page | Contents | Index ]