Call

This instruction is used to call a subroutine executed with its own local variables class.
No value is returned by this instruction. Parameters can be transmitted as values or as references; so that the parameters transmitted by reference can be modified by the subroutine.

Syntax

Call SUBPROGRAMCall SUBPROGRAM From LIBRARYCall SUBPROGRAM(ARGUMENT_LIST)Call SUBPROGRAM(ARGUMENT_LIST) From LIBRARYCall SUBPROGRAM From =EXPRESSION_LIBRARYCall SUBPROGRAM(ARGUMENT_LIST) From =EXPRESSION_LIBRARYCall =EXPRESSION_CALLCall =EXPRESSION_CALL From LIBRARYCall =EXPRESSION_CALL With (ARGUMENT_LIST)Call =EXPRESSION_CALL With (ARGUMENT_LIST) From LIBRARYCall =EXPRESSION_CALL With (ARGUMENT_LIST) From =EXPRESSION_LIBRARYCall =EXPRESSION_CALL With (ARGUMENT_LIST) From =EXPRESSION_LIBRARY

Examples

 # Call of a routine that increments a valueLocal Integer II=314 : Call ADD_ONE(I)I=314 : Call TRY_TO_ADD_ONE(I)I=315 : Call FAIL_TO_ADD_ONE(I)# The value of I found here depends on how the parameter has been declared in the routine# After the first call, I=315# After the second call, I=314# The third call will raise an error...# Case 1 : the argument is declared as a referenceSubprog ADD_ONE(J)Variable Integer JJ+=1 : # J is equal to 315, but J is a reference to I in the calling script, so I is equal to 315I=316 : # I is a local variable that does not refer to the I variable in the calling scriptEnd# Case 2 : the argument is declared as a valueSubprog TRY_TO_ADD_ONE(J)Value Integer JJ+=1 : # J is equal to 315, but J is a local copy of I that is not sent back, so I remains equal to 314End# Case 3 : the argument is declared as a constant referenceSubprog FAIL_TO_ADD_ONE(J)Value Integer JJ+=1 : # Raises an error : J is read-onlyEnd# Call of a subroutine with parameters in another processLocal Integer MATRIX(1..10,1..20,1..30)...# Only a subarray is transmitted (even if it is sent as a reference)Call COMPUTE_SUM(MATRIX(5..6,2..4,1..20),RESULT) FROM MATRIX_LIBRARY...# In the MATRIX_LIBRARY script, the arguments areSubprog COMPUTE_SUM(MATRIX,RESULT)Const Integer MATRIX(,,)Variable Integer RESULTRESULT=sum(MATRIX)End# A subprogram that returns the data type of the argumentSubprog RETURN_TYPE(ARGUMENT,DATA_TYPE)Variable Integer DATA_TYPEDATA_TYPE=type(ARGUMENT)End# Example of sub-program with a variable type of argumentLocal Integer DATA_TYPELocal Char MY_STRING(20),TEXT(10)MY_STRING="abcdefghijklmnopqrst"Call RETURN_TYPE(pi,DATA_TYPE,TEXT): # Will return 7 (decimal) and "3.14159265"Call RETURN_TYPE([1/1/2013],DATA_TYPE,TEXT) : # Will return 3 (date) and "01/01/2013"Call RETURN_TYPE(100,DATA_TYPE,TEXT) : # Will return 4 (integer) and "100"Call RETURN_TYPE("text sent",DATA_TYPE,TEXT) : # Will return 523 (clob) and "text sent"Call RETURN_TYPE(MY_STRING,DATA_TYPE,TEXT) : # Will return 20 (string 10) and "abcdefghij"End# ARGUMENT has not be declared because it has a variable typeSubprog RETURN_TYPE(ARGUMENT,DATA_TYPE,TEXT)Variable Integer DATA_TYPEVariable Char TEXT()DATA_TYPE=type(ARGUMENT) : # returns the data type of the argumentTEXT=num$(ARGUMENT) : # returns a string representation of the argument regardless of its typeEnd

Comments

Associated Errors

Error codeDescription
10The expression giving the script name does not return a string value.
20The process does not exist.
39The label does not exist.
55Number of dimensions invalid.
69Number of parameters does not correspond.
70Transmission mode incompatible.