Toshiba STE 58762 Welding System User Manual


 
STE 58762
2-22
2.8.2 Subprograms
You can call up a subprogram by just writing its name in the main program.
Example:
Here is a main program which calls a subprogram called SUB1.
PROGRAM MAIN
REMARK *** SAMPLE 1 ***
SUB1
END
Here is the subprogram which has been named SUB1.
PROGRAM SUB1
REMARK *** SUBPROGRAM NO. 1 ***
Body of subprogram
RETURN
END
A RETURN command should inserted in subprograms to send control back to the main program.
If you forget to write RETURN, SCOL will forgive you and pretend that there is a RETURN
command in front of the END statement.
When wishing to pass data between subprograms and the main program, you have to first specify
arguments for the subprogram. Arguments are like little "mailboxes"
to which values passed
between the programs are sent and received. And, before using these mailboxes, you have to put
a name on each one so the postman knows whose mail goes where. When writing a subprogram
(not a main program), the program statement should be written like this:
PROGRAM <program name> (<names of arguments>)
After writing the program name, write the names of the arguments inside of brackets. Use
commas to separate the names of the arguments. (You cannot specify more than ten arguments
for a single subprogram.) For example, the main program will have the statement:
SUB EXAMPLE (A, B, C)