IBM AS/400 Frozen Dessert Maker User Manual


 
Using Bindable APIs
A subprocedure ends abnormally and control returns to the calling procedure
when an unhandled exception occurs. Again, no further actions occur until the main
procedure ends.
If the main procedure is never called (and therefore cannot end) then any files, data
areas, etcetera, will not be closed. If you think this might arise for a subprocedure,
you should code a termination procedure that gets called when the subprocedure
ends. This is especially true if the subprocedure is in a module with NOMAIN speci-
fied on the control specification.
Returning using ILE Bindable APIs
You can end a procedure normally by using the ILE bindable API CEETREC.
However, the API will end
all
call stack entries that are in the same activation group
up to the control boundary. When a procedure is ended using CEETREC it follows
normal
termination processing as described above for main procedures and subpro-
cedures. On the next call to the procedure, a fresh copy is available for processing.
Similarly, you can end a procedure abnormally using the ILE bindable API
CEE4ABN. The procedure will then follow abnormal termination as described
above.
Note: You cannot use either of these APIs in a program created with
DFTACTGRP(*YES), since procedure calls are not allowed in these proce-
dures.
Note that if the main procedure is not active, or if there is no main, then nothing will
get closed or freed. In this case, you should enable an ILE cancel handler, using
CEERTX. If the cancel handler is in the same module, it can close the files, unlock
the data areas, and perform the other termination actions.
For more information on CEETREC and CEE4ABN refer to the
System API Refer-
ence
.
Using Bindable APIs
Bindable application programming interfaces (APIs) are available to all ILE lan-
guages. In some cases they provide additional function beyond that provided by a
specific ILE language. They are also useful for mixed-language applications
because they are HLL independent.
The bindable APIs provide a wide range of functions including:
Activation group and control flow management
Storage management
Condition management
Message services
Source Debugger
Math functions
Call management
Operational descriptor access
Chapter 10. Calling Programs and Procedures 155