ASSIGN is the equivalent to the OPEN command in other computer languages.
10 ASSIGN @Io TO "C:\bin\script.BAT";FORMAT ON,RETURN S
20 IF S THEN
30 PRINT "Oops, Error";S;"opening the file"
40 PAUSE
50 END IF
60 OUTPUT @Io;"cd \"
70 OUTPUT @Io;"alt",END
80 ASSIGN @Io TO *
90 EXECUTE "script"
100 END
This example shows the ASSIGN command being used to access a file called "script.BAT". (The file must already exist. Use CREATE to create a new file.) If the ASSIGN takes place correctly, then OUTPUT is used to send some data to the file. The END in the last OUTPUT causes the file to be truncated at that point. This is useful if the old file contents were longer than the new contents. Finally, "ASSIGN ... *" is used to close the I/O path associated with the @Io variable.