Other Content

Table Of Contents
500 Getting Started with the Program Editor
Calling One Program from Another
One program can call another program as a subroutine. The subroutine can be
external (a separate program) or internal (included in the main program).
Subroutines are useful when a program needs to repeat the same group of
commands at several different places.
Calling a Separate Program
To call a separate program, use the same syntax that you use to run the
program from the entry line.
Defining and Calling an Internal Subroutine
To define an internal subroutine, use the Define command with
Prgm...EndPrgm. Because a subroutine must be defined before it can be
called, it is a good practice to define subroutines at the beginning of the main
program.
An internal subroutine is called and executed in the same way as a separate
program.
Define subtest1()=
Prgm
local subtest2À
Define subtest2(x,y)=Á
Prgm
Disp x,y
EndPrgm
©Beginning of main program
For i,1,4,1
subtest2(i,I*1000) Â
EndFor
EndPrgm