Reader's Clinic - Functions and Subroutines

Published ByDateVersionKnowledge LevelKeywords
Sprezzatura Ltd01 MAY 19901.15+EXPERTFUNCTION, 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)

  • tips/revmedia/v2i1a2.txt
  • Last modified: 2024/06/19 20:20
  • by 127.0.0.1