In order for this site to work correctly, and for us to improve the site, we need to store a small file (called a cookie) on your computer.
By continuing to use this website, you agree to our cookies and privacy policy.
  
Home page Home page Home page Home page
Pixel
Pixel Header R1 C1 Pixel
Pixel Header R2 C1 Pixel
Pixel Header R3 C1 Pixel
Pixel

Reader's Clinic - Functions and Subroutines

Stefan Gilboy of Logix Consultants makes the interesting point that functions can be declared as both subroutine and function at the beginning of the program. This is especially useful in a function such as LOCKER (from utility diskette # 1). Here a dummy variable must be assigned a variable so that the routine can be called to perform an action that does not return anything. Thus the following code


0001   DECLARE FUNCTION LOCKER
0002   OPEN "TEST" TO TF THEN
0003     IF LOCKER(TF,1,"L") THEN
0004       DELETE TF,1
0005       DUM = LOCKER(TF,1,"U")
0006     END
0007   END

could be replaced with


0001   DECLARE FUNCTION LOCKER
0002   DECLARE SUBROUTINE LOCKER
0003   OPEN "TEST" TO TF THEN
0004     IF LOCKER(TF,1,"L") THEN
0005       DELETE TF,1
0006       LOCKER(TF,1,"U")
0007     END
0008   END

(Volume 2, Issue 1, Page 3)
Pixel
Pixel Footer R1 C1 Pixel
Pixel
Pixel
Pixel