Related CL Commands............................................................................................................128
Binding Modules into a Program.................................................................................................. 128
Using the CRTPGM Command................................................................................................ 130
Binding Multiple Modules..................................................................................................131
Additional Examples............................................................................................................... 132
Related CL Commands............................................................................................................132
Using a Binder Listing................................................................................................................... 133
Changing a Module or Program.................................................................................................... 133
Using the UPDPGM Command................................................................................................ 134
Changing the Optimization Level............................................................................................ 134
Removing Observability.......................................................................................................... 135
Reducing an Object's Size.......................................................................................................135
Creating a Service Program................................................................................................................135
Service Program Overview........................................................................................................... 135
Strategies for Creating Service Programs.................................................................................... 136
Creating a Service Program Using CRTSRVPGM..........................................................................137
Changing A Service Program...................................................................................................137
Related CL commands............................................................................................................ 137
Sample Service Program.............................................................................................................. 138
Creating the Service Program................................................................................................. 141
Binding to a Program...............................................................................................................141
Updating the Service Program................................................................................................143
Sample Binder Listing............................................................................................................. 144
Running a Program.............................................................................................................................144
Running a Program Using the CL CALL Command.......................................................................145
Passing Parameters using the CL CALL Command................................................................ 145
Running a Program From a Menu-Driven Application................................................................. 147
Running a Program Using a User-Created Command................................................................. 148
Replying to Run-Time Inquiry Messages..................................................................................... 149
Ending an ILE Program................................................................................................................. 149
Managing Activation Groups........................................................................................................ 150
Specifying an Activation Group...............................................................................................150
Running in the OPM Default Activation Group....................................................................... 151
Maintaining OPM RPG/400 and ILE RPG Program Compatibility.......................................... 151
Deleting an Activation Group.................................................................................................. 151
Reclaim Resources Command................................................................................................152
Managing Dynamically-Allocated Storage................................................................................... 152
Managing the Default Heap Using RPG Operations............................................................... 154
Heap Storage Problems.......................................................................................................... 158
Managing Your Own Heap Using ILE Bindable APIs.............................................................. 159
Calling Programs and Procedures..................................................................................................... 165
Program/Procedure Call Overview...............................................................................................166
Calling Programs..................................................................................................................... 166
Calling Procedures.................................................................................................................. 166
The Call Stack..........................................................................................................................167
Recursive Calls........................................................................................................................ 167
Parameter-Passing Considerations........................................................................................170
Using a Prototyped Call................................................................................................................ 171
Using the CALLP Operation.....................................................................................................172
Calling within an Expression................................................................................................... 172
Examples of Free-Form Call................................................................................................... 173
Passing Prototyped Parameters...................................................................................................173
Parameter Passing Styles....................................................................................................... 173
Passing by Reference........................................................................................................ 174
Passing by Value................................................................................................................ 174
Passing by Read-Only Reference......................................................................................174
Advantages of passing by value or read-only reference.................................................. 174
Choosing between parameter passing styles .................................................................. 175
v