Subprocedure Calculations

No cycle code is generated for a subprocedure, and so you must code it differently than you would code a cycle-main procedure. The subprocedure ends when one of the following occurs:

Figure 12 shows the normal processing steps for a subprocedure. Figure 13 shows the exception/error handling sequence.

Figure 12. Normal Processing Sequence for a Subprocedure
This figure illustrates Normal Processing Sequence for a Subprocedure
 1 
Taking the "No" branch means that another procedure has already been called since the program was activated. You should ensure that you do not make any incorrect assumptions about the state of files, data areas, etc., since another procedure may have closed files, or unlocked data areas.
 2 
If an entry parameter to the main procedure is RESET anywhere in the module, this will cause an exception. If it is possible that a subprocedure will be called before the main procedure, it is not advised to RESET any entry parameters for the cycle-main procedure.
Figure 13. Exception/Error Handling Sequence for a Subprocedure
This figure illustrates Exception/Error Handling Sequence for a Subprocedure

Here are some points to consider when coding subprocedures:



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