Navigation: Templates > Template Language Reference > Complete Alpha Listing >====== #CLOSE (close source file) ====== | |
#CLOSE( [file] ) [, READ ]
#CLOSE | Closes an open generated source code disk file. |
file | A string constant, template symbol, or expression containing a DOS file specification. This may be a fully qualified DOS pathname. If omitted, the current disk file receiving generated source code is closed. |
READ | Closes the read-only input file. |
The #CLOSE statement closes an open disk file receiving the generated source code. If the file is omitted, the current disk file receiving generated source code is closed. If the file does not exist, or is already closed, a source generation error is produced.
Example:
#SET(%NewProgramFile,(%Application & '.$$$')) #!Temp new program filename
#CREATE(%NewProgramFile) #!Create new program file
#GENERATE(%Program) #!Generate main program header
#CLOSE(%NewProgramFile) #!Create new program file
#OPEN(%ProgramFile),READ #!Open it in read-only mode
#DECLARE(%ASCIIFileRecord)
#LOOP
#READ(%ASCIIFileRecord)
#! Parse the line and do something with it
#IF(%ASCIIFileRecord = %EOF)
#BREAK
#ENDIF
#ENDLOOP
#CLOSE(%ProgramFile),READ #!Close the read-only file