Products Downloads


French version


 

 

ADELIA

      

      

      

      

(I/B)

 

 

 

 

 

Section for use

All

 

Syntax

BEGIN_PROCEDURE ProcedureName

 

Description

This instruction marks the beginning of a program's internal procedure (subroutine).

A procedure can be placed anywhere in the program.

 

The name of the procedure cannot exceed 6 characters, the first character being alphabetical.

However:

    • Two procedures cannot be nested.

    • A procedure cannot be nested in an IF or DO_WHILE loop.

    • Procedures cannot be located in TOTAL_PROCEDURE, BREAK_PROCEDURE, CHANGE_PAGE, MANAGE_SFL or ADD_SFL sections.

    • Every BEGIN_PROCEDURE must have an END_PROCEDURE instruction to terminate subroutine instruction.

    • All program procedures must have different names.

    • A procedure is always called from a PROCESS_PROC instruction, except *PSSR that is automatically called in case of program errors.

    • There might be several PROCESS_PROC to call the same procedure.

Important note: The use of the *PSSR reserved word is permitted for those who generate RPG only. This deals with the routine of management of program errors detected during the execution; for more details on the use of the *PSSR subprogram, see the corresponding IBM manuals.

 

Example

IF ITEM EXISTS

TABLE_VALUE = TAX_CODE

ELSE

TABLE_VALUE = '000'

END

PROCESS_PROC CPRICE

*

BEGIN_PROCEDURE CPRICE

TABLE_KEY = 'TAX'

CHAIN TABLE_FILE

TOTAL_PRICE = ( ITEM_PRICE * QTY - DISCOUNT ) * TAX_RATE

END_PROCEDURE

*

BEGIN_PROCEDURE *PSSR

IF   *PGM_STATUS <> 0

PSSR_END_CODE = '*CANCL'

END

JOB_IN_ERROR = *JOB

USER_ERROR = *USER

TIME ERROR_TIME

PGM_IN_ERROR = *PGM_NAME

CALL ERROR_LOG JOB_IN_ERROR USER_ERROR ERROR_TIME PGM_IN_ERROR

END_PROCEDURE PSSR_END_CODE

 

See also the list of 4GL instructions by topic

↑ Top of page

  • Aucune étiquette