Subj : close file in REXX
To : Bryan Rubingh
From : Eddy Thilleman
Date : Sat Aug 05 2000 09:52 am
Hello Bryan,
Wednesday 02 August 2000 00:00, Bryan Rubingh wrote to All:
BR> I've written a REXX program which reads one file, changes a few lines
BR> as it reads and writes to a second file, doing the above one line at a
BR> time. When it reaches the end of the first file, I want to copy the
BR> second file (the one REXX created) to another location. I've tried
BR> just doing: copy file2 file3 but I get an OS/2 error when running the
BR> program that file2 is in use. Is there any way in REXX to close the
BR> file so that the OS can copy it?
The stream function is one way:
check = stream( fname, 'C', 'close' )
I use Object REXX. There are differences in the stream function in classic REXX
and in Object REXX.
To make it easier to use, I've made a function around it:
/* function CloseFile( fname ) */
CloseFile: procedure
parse arg fname
check = stream( fname, 'C', 'close' )
if (check == 'READY') | (check == 'READY:') then
result = 1
else
do
result = 0
say "Error closing" fname":" stream( InFile, 'D' ) /* display description
about possible error */
end
return
Another way is LINEOUT('anyfile') to close 'anyfile'.
Greetings -=Eddy=-
email:
[email protected]
[email protected]
[email protected]
... Real programmers write to disks with magnets...
--- GoldED/2 3.0.1
* Origin: Warp 3, Scotty... and close those damn Windows! (2:280/5143.7)