ALGOL Client Program #1

The following ALGOL client program invokes the ALGOL dynamic library in the previous example, OBJECT/FILEMANAGER/LIB. This client program reads information from the file MYFILE by assigning a value of “MYFILE” to the LIBPARAMETER library attribute and then invoking the procedure READFILE. The client program then writes information to a file called OTHERFILE by canceling the library, changing the LIBPARAMETER library attribute to “OTHERFILE”, and invoking the WRITEFILE procedure.

BEGIN
LIBRARY L (TITLE = “OBJECT/FILEMANAGER/LIB.”);
PROCEDURE READFILE;
  LIBRARY L;
PROCEDURE WRITEFILE;
  LIBRARY L;

L.LIBPARAMETER:= “MYFILE”;

READFILE;

CANCEL (L);

L.LIBPARAMETER:=“OTHERFILE”; % LIBPARAMETER CAN BE CHANGED
                               % BECAUSE THE LIBRARY HAS BEEN
                               % CANCELED.

WRITEFILE;
END PROGRAM.