10.5.2.4. CALL
10.5.2.4. CALL
Explanation | Calling the assigned program. When END statement is given, data returns to the next row of the called CALL statement. Can call up to 10 times without recovering (Max. calling depth is 10) | |||
Syntax | CALL <program number>[<Note>] [(<Actual parameter>,<Actual parameter>,......)] | |||
Parameter | Program number | Arithmetic formula. Program number to call. | 1~9999 | |
Note | To be allowed only when the program number is constant. For better readability, explanation consisting of alphabetical characters and underscores can be added. Notes will be ignored during execution. The program number and notes together should not exceed 18 characters. |
| ||
Actual parameter | Value to be delivered to the sub program. Should have a blank in front of the left bracket. (Refer to 10.4.4.4 Parameter) | Max. 10 | ||
Example | Distance calculation between ‘P4 and P7. | |||
P300=P4 P301=P7 CALL 902 ‘Result output
PRINT #0, "Dist = "; V300! | REM --- subprog. 902 -------------------------------------- REM V300! = <distance between P300 and P301> REM ------------------------------------------------------------ V300! = (P300.X-P301.X)^2 + (P300.Y-P301.Y)^2 + (P300.Z-P301.Z)^2 V300! = SQR(V300!) | |||
ø Parameters cannot be used for controllers lower than version Hi5.
Max. 18 characters are allowed for the name of work file except for periods and extensions (JOB). The front side of a file name begins with the program number (1~9999) and a note string for readability can be appended. In reality, when the controller selects the JMPP statement, the Call statement or an external program, it only uses the program number of the Job file name while ignoring the appended string. In a situation shown below, all JMPP statements, presented as examples, are legitimately branched to JOB 20.
File list | 0001.JOB 0020_SUBFUNC.JOB |
0001.JOB Content | V5%=20 CALL 20 CALL 0020 CALL V5% CALL (10+10) CALL 20_SUBFUNC |