Reader's Clinic - Functions and Subroutines
Published By | Date | Version | Knowledge Level | Keywords |
---|---|---|---|---|
Sprezzatura Ltd | 01 MAY 1990 | 1.15+ | EXPERT | FUNCTION, SUBROUTINE, LOCKER |
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
DECLARE FUNCTION LOCKER OPEN "TEST" TO TF THEN IF LOCKER(TF,1,"L") THEN DELETE TF,1 DUM = LOCKER(TF,1,"U") END END
could be replaced with
DECLARE FUNCTION LOCKER DECLARE SUBROUTINE LOCKER OPEN "TEST" TO TF THEN IF LOCKER(TF,1,"L") THEN DELETE TF,1 LOCKER(TF,1,"U") END END
(Volume 2, Issue 1, Page 3)