ADELIA |
|
|
|
|
(I/B) |
Section for use
Main Body of Program
Syntax
RECEIVE SeriesVarId
SeriesVarId |
→ |
SeriesVarId VarId | None |
Description
This instruction gives the list of parameters SeriesVarId external to the program. With the RECEIVE instruction, the parameters are received by the called program and automatically sent back to the calling program when the end of the called program is reached.
It can be placed anywhere, but for reasons of readability, it is suggested that the instruction be placed at the beginning of the program.
Only one RECEIVE instruction per program is permitted.
Association of the parameters between the calling program and the called program is done by their position in the CALL and RECEIVE instructions.
Important note: The variables set as parameters cannot be data structure (DS) subfields.
Example
* 3 parameters are exchanged: |
the name |
the customer code |
|
and a return code |
* (PROGRAM ORDER_ENTRY) |
* |
CALL CUST_WINDOW W_CUST_NAME W_CUST_CODE W_RETURN_CODE |
* |
IF W_RETURN_CODE <> 'N' |
ZZ_CUST_CODE = W_CUST_CODE |
ZZ_CUST_NAME = W_CUST_NAME |
END |
* (PROGRAM CUST_WINDOW) |
RECEIVE R_NAME R_CUSTOMER_CODE R_RETURN_CODE |
R_RETURN_CODE = *BLANK |
PROCESS 01 |
TRANSACTION 01 |
IF *F03 |
R_RETURN_CODE = 'N' |
TERMINATE |
END |
* ... |
Other example:
* Let's assume that you have a program variable PW_RET_COD
* declaration of a memory list at the beginning of the program
DECL LIST PW_LST_MEMO EM_EMPL_NAME EM_EMPL_FIRST_NAME EM_EMPL_CODE EM_EMPL_CITY
* declare the memory list and return code as parameters
RECEIVE PW_LST_MEMO PW_COD_RET