Products Downloads


French version


 


      

VADELIA

SADELIA

WADELIA

EADELIA


(I/B) (C/S)

(B) (S)

(I/B) (C/S)

(B) (C/S)


Section for use

All


Syntax

CALL PgmNameOrAlphaVarId SeriesParameters NonUnicode ParametersCheckingMode

CALL PgmNameOrAlphaVarId DynParam ParametersCheckingMode

CALL PgmNameOrAlphaVarId.ProcedureName SeriesParameters


PgmNameOrAlphaVarId

PgmName | &AlphaVarId




ProcedureName

ProcedureName | &ProcAlphaVarId

SeriesParameters

SeriesParameters Parameter | None

NonUnicode

*NON_UNICODE | None

DynParam

*DYN_PARAM(ParametersAlphaVariable)

ParametersCheckingMode

*MODE_PARAMCTRL (MinorErrorMode, MajorErrorMode) | None

MinorErrorMode

IntegerNumericVariable | Numerical constant {0, 1, 2}

MajorErrorMode

IntegerNumericVariable | Numerical constant {0, 1, 2}


Description

First case: CALL PgmNameOrAlphaVarId SeriesParameters

This instruction calls the program whose Adelia name is PgmName or the program whose object file name is held in the alphanumeric variable AlphaVarId.

The program name can be followed by parameters. Apart from variables, these parameters can be constants or reserved words (of the following types: ALPHA, NUM_E, NUM_P, NUM_BIN_2, NUM_BIN_4 or NUM_BIN_8), but only if the program is explicitly referenced (via PgmName).

When the CALL instruction is placed in the AS/400 server part of a program generated in Unicode, the *NON_UNICODE option can be used to convert ALPHA ("unicode") parameters to "single-byte" parameters. This parameter is ignored in Windows and Java server parts, and when the program is generated in non-Unicode mode.


The default rules for ALPHA parameters in a program generated in Unicode and in an AS/400 server part are:

Static call (CALL MYPGM):

  Parameters called by a SADELIA program are left in Unicode.

  Input and output parameters called by a program other than a SADELIA program are converted to simple ALPHA parameters.

Dynamic call (CALL &VARPGM):

  By default, parameters are defined in Unicode.


The *MODE_PARAMCTRL option can be used to temporarily specify (for the current call only, and as such with no effect on any sub-calls) the parameter checking mode (for major and minor errors).

The possible values for the two modes are:

0: Message but no execution,

1: Message and execution,

2: Execution but no message.


Notes:

- If the value of MinorErrorMode or MajorErrorMode is not valid at the time of execution, the value specified in the Runtime setup will be used.

- This parameter can only be used if the called program was generated with Adelia Studio version 11 or later.

- The *MODE_PARAMCTRL option is not compatible with AS/400 server parts.

- The dynamic call (via an alphanumeric variable AlphaVarId) of an AS/400 SADELIA program with at least one public procedure is not possible.


Second case: CALL PgmNameOrAlphaVarId DynParam

This instruction calls the program with the Adelia name PgmName or the program whose object file name is contained in the alphanumerical variable AlphaVarId.

The *DYN_PARAM option can be used to call a program using a string to set all the parameters (via ParametersAlphaVariable). These will only be input parameters. They will be separated by spaces, and any ALPHA parameters that contain spaces will need to be enclosed in quotes.


Notes:

- This option is not compatible with AS/400 server parts.

- The parameters are still checked when the program is run.

- The variable containing the list of parameters (ParametersAlphaVariable) will only support alpha and numerical parameters (as it is a dimensionless variable).

- Numerical parameters will accept the two decimal separators ("."  and ",").


The *MODE_PARAMCTRL option can also be used (see details in the "First case" section).


abcdefghijklmnopqrstuvwxyz


abcdefghijklmnopqrstuvwxyz


1 parameter

"abcdefghijklmnopqrstuvwxyz"


abcdefghijklmnopqrstuvwxyz


1 parameter

abcde  fghij


abcde puis fghij


2 parameters

"abcde  fghij"


abcde   fghij


1 parameter

abcde"fghij


error!


error

abcde\"fghij


abcde"fghij


1 parameter

"abc de\"fg hijklmnopqrstuvwxyz"


abc de"fg hijklmnopqrstuvwxyz


1 parameter


Third case: CALL PgmNameOrAlphaVarId.ProcedureName SeriesParameters

This instruction calls the (public, external) procedure ProcedureName of the program PgmName or the procedure whose name is contained in the ProcAlphaVarId variable of the program whose name is contained in the AlphaVarId variable; see also the PROCESS_PROC instruction.

The parameters can be constants or variables entered by reference.


Warning: If the program's DLL has already been loaded into memory using the LOAD_DLL instruction, it will neither be reloaded nor unloaded.


Notes:

A called program that executes a window will only terminate (and any instructions located after the CALL instruction will only be executed) if its own windows and any other windows that are executed modally or otherwise (by the program itself or by other programs in the same process) after its window is executed have been closed.

When the CALL instruction is used to call a VADELIA program named PGM1, the call return is not sent until all of PGM1's windows have finished running. Therefore, if the program PGM1 contains any windows that are executed non-modally, the execution point will remain at the end of PGM1's INIT_PGM block while the windows are open, and any Adelia code located after the CALL instruction will not be executed.

In this situation, if another program, PGM2 is called, everything is treated as if the second CALL instruction was located at the end of PGM1's INIT_PGM block. This means that even if the user closes PGM1's windows, the program is not terminated while PGM2 is still running. In this scenario, calls to other programs, PGM3, PGM4, etc. may stack up.

In addition, the user may want to call a program whose windows have been closed a second time, but the program may not actually have ended, having been blocked by a subsequent call. Adelia language does not allow two simultaneous calls to the same program (it is not reentrant). We recommend referring to the PGMXX example programs in the knowledge base in order to handle such cases correctly.


Where the CALL instruction is placed in the client part of a VADELIA program, only VADELIA programs can be called. Additionally, in the case the calling program is a WADELIA program, the VADELIA called program must have been generated with a Java client part.

Where the CALL instruction is placed in the server part of a program, only SADELIA programs can be called.

To check whether the call has been made successfully, you can test the *RETURN_CODE reserved word.

Possible values:

0: The called program has been found and run.

1: - The called program has not been found
- The called program has not been regenerated and does not contain any entry point to be called via *DYN_PARAM.

2: The called program has been found but not run, as the parameter control stopped execution (mode without execution).


However, in the AS/400 server parts with an "exception" procedure, if the "Manage I/O errors" mode is other than "Yes", for any call errors, *RETURN_CODE is not updated and the "exception" procedure is started.


If an AS/400 SADELIA program which formerly had no public procedure has been subsequently regenerated with at least one public procedure, you must regenerate all the programs calling this AS/400 SADELIA program (programs which had been called while they had no public procedure).


Example

CALL CUSTOMER_LIST


CALL ITEM_UPD ZZ_ORD_COD ZZ_ITEM_COD P_ACTION_COD P_RETURN_COD


PGM_NAME = 'ITEMUPD'


CALL &PGM_NAME ZZ_ORD_COD ZZ_ITEM_COD P_ACTION_COD P_RETURN_COD


CALL CONVERT_SRV.PROC_EUR_USD  895,55  ZW_MT_USD


ParametersVariable = '123 "ab cd" ghij 17.42 166,41'

ProgramNameVariable = 'MYPGM'

CALL &ProgramNameVariable *DYN_PARAM(ParametersVariable)


CALL ITEM_UPD ZZ_ORD_COD ZZ_ITEM_COD P_ACTION_COD P_RETURN_COD *MODE_PARAMCTRL(1, 0)


↑ Top of page

  • Aucune étiquette