Products Downloads


French version


 

 

ADELIA

      

      

      

      

(I/B)

 

 

 

 

 

Section for use

End of PROCEDURE section

 

Syntax

END_PROCEDURE VarId

 

VarId

VarId | None

 

Description

This instruction marks the end of a program's internal procedure (internal subprogram).

A procedure can be placed anywhere in the program.

 

However:

Every END_PROCEDURE instruction must correspond to a BEGIN_PROCEDURE instruction which must precede it.

Program control returns to the line following the instruction which called the procedure "PROCESS_PROC ProcedureName".

 

If the END_PROCEDURE instruction terminates:

    • either a procedure of the type *PSSR (only possible in RPG):
      BEGIN_PROCEDURE *PSSR,

    • or a procedure of the type *INFSR (possible in RPG to define a declaration procedure):
      BEGIN_PROCEDURE PROFI1 where PROFI1 is a procedure of file error management (INFSR),

it is possible in these two cases to state an alphanumeric variable after the END_PROCEDURE instruction.

 

Example:

END_PROCEDURE INSTRUC_RETURN

 

This variable contains a keyword which indicates where the control must be transmitted after the procedure is executed; see the corresponding RPG IBM manuals for more details on the use of this variable associated with the ENDSR instruction.

 

Important note: As *PSSR and INFSR procedures are not supported with the C generator, this variable is ignored in case of C generation.

 

Example

IF   ITEM EXISTS

TABLE_VALUE = TAX_CODE

PROCESS_PROC CPRICE

ELSE

TABLE_VALUE = '000'

PROCESS_PROC CPRICE

END

*

*

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