Example of a Generic Exit Point Program

The following is an example of an RPG ILE application program that incorporates a Exit Point Manager Generic Exit Point program.

H Copyright ('Copyright (c)2015 The Powertech Group. +
H All Rights Reserved.')

This example is provided 'as is' with no warranties either expressed or implied.

H* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 
H*                                                                   */ 
H*            Copyright (c)2015 The Powertech Group.                 */ 
H*                      All Rights Reserved.                         */ 
H*           THE POWERTECH GROUP CONFIDENTIAL INFORMATION.           */ 
H*          (For the full text execute command LCOPYRIGHT).          */ H*                                                                   */ 
H* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 
H*
H* Program    : Use_Gexit
H* Description: Example of calling of the default exit program. 
H*
H* Purpose    : This module is an example of the use of the default
H*              exit program.  It is an update engine for the file
H*              TestFile.  It checks to see if the user is allowed to
H*              update or add records to the file and checks the
H*              key to be update/added against memorized transactions. 
H*
H*--------------------------------------------------------------------- 
H*
H* Compile Instructions: H*
H* This module is first compiled as a  module.  It is then bound with
H* the following modules to create program Use_Gexit. H*
H* Module Name Description
H* ----------- ----------------------- 
H* Use_Gexit   Driving module
H*
H* Command CRTPGM is used to create executable program Use_Gexit. 
H*
H* Parameter  Setting
H* ---------  --------------------------------------------------------- 
H* MODULE     Use_Gexit
H* ENTMOD     Use_Gexit
H* ACTGRP     *CALLER H*
H*--------------------------------------------------------------------- 
h
FTestFile  uf a e           k disk
D*--------------------------------------------------------------------- 
D*
D*
D*  Procedure Definition
D*
D Use_gexit       PR                  EXTPGM('USE_GEXlT') 
D  lnboundKey                   12
D  lnboundUpdate             32060
D*
D*  Procedure lnterface
D*
D Use_gexit       Pl
D  lnboundKey                   12
D  lnboundUpdate             32060
D*
D* Generic Exit Point Prototype
D*
D PLKR107GEP      PR                  ExtPgm('PLKR107GEP') 
D  ReturnAllow                   9b 0
D  ServerNameln                 10
D  SrvFunctionln                10
D  UsrProfileln               10
D  Locationln                   15
D  FormatNameln                 10
D  LengthDataln                  9b 0
D  OperDataln                32767
D  ProfileHandle              12
D*
D ReturnAllow     S              9b 0
D ServerNameln    S             10
D SrvFunctionln   S             10
D UsrProfileln  s            10
D Locationln      S             15
D FormatNameln    S             10
D LengthDataln    S              9b 0
D OperDataln      S          32767
D ProfileHandle s             12
d* copy the program status data structure d/copy @pgsds
D*--------------------------------------------------------------------- 
c*
c     lnboundKey    chain     testfile
c                   if        %found
c                   eval      SrvFunctionln = 'UPDATE' 
c                   else
c                   eval      SrvFunctionln = 'ADD   ' 
c                   endif
C
c                   eval      ServerNameln = 'TESTFlLEUP'
c                   eval      UsrProfileln = @pgusr
c                   eval      OperDataln    = %trim(lnboundKey)
c                   eval      LengthDataln  = %len(%trim(lnboundKey))
c
c                   call (E)  'PLKR107GEP'
c                   Parm                    ReturnAllow
c                   Parm                    ServerNameln
c                   Parm                    SrvFunctionln
c                   Parm                    UsrProfileln
c                   Parm                    Locationln
c                   Parm                    FormatNameln
c                   Parm                    LengthDataln
c                   Parm                    OperDataln
c                   Parm                    ProfileHandle
c*
c                   if                      ReturnAllow = 1
c                   if                      SrvFunctionln  = 'ADD    '
c                   eval                    tfkey = lnboundKey
c                   eval                    tfdata = lnboundUpdate
c                   write                   tstf
c                   else
c                   eval                    tfdata = lnboundUpdate
c                   update                  tstf
c                   endif
c                   endif
c                   return

 

Copyright © HelpSystems, LLC.
All trademarks and registered trademarks are the property of their respective owners.