Computing.Net > Forums > OpenVMS > append a file

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

append a file

Reply to Message Icon

Name: athena123
Date: January 29, 2003 at 23:51:20 Pacific
OS: VMS 7
CPU/Ram: alpha
Comment:

Hi,
How do we append a file in a procedure? the file is created by the procedure itself.
Thank you :)



Sponsored Link
Ads by Google

Response Number 1
Name: Jo
Date: January 30, 2003 at 03:21:54 Pacific
Reply:

Hi,

If a file already exsist but needs to be opened you should use OPEN/APPEND.
To write records to the file you should use the WRITE command
Here's an example, first loop creates a new file, second loop opens an existing file.

$ !
$ ! CREATE NEW OUTPUT FILE
$ !
$ OPEN/WRITE/ERROR=OPEN_ERROR OUTPUT_FILE TEMP.OUT
$ COUNT = 0
$ WRITE_LOOP1:
$ COUNT = COUNT + 1
$ IF COUNT .EQ. 11 THEN GOTO ENDIT1
$ WRITE OUTPUT_FILE "Count is ''COUNT'."
$ GOTO WRITE_LOOP1
$ ENDIT1:
$ CLOSE OUTPUT_FILE
$ !
$ ! APPEND EXISTING FILE
$ !
$ OPEN/APPEND/ERROR=OPEN_ERROR OUTPUT_FILE TEMP.OUT
$ COUNT = 0
$ WRITE_LOOP2:
$ COUNT = COUNT + 1
$ IF COUNT .EQ. 11 THEN GOTO ENDIT2
$ WRITE OUTPUT_FILE "Count is ''COUNT'."
$ GOTO WRITE_LOOP2
$ ENDIT2:
$ CLOSE OUTPUT_FILE
$ EXIT
$ !
$ OPEN_ERROR:

Greetz,

Jo!



0

Response Number 2
Name: ME
Date: January 31, 2003 at 11:06:56 Pacific
Reply:

Use the APPEND command ?


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


KZPDA on as400 + VMS6.2-1... Problem with 'scanf'



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to OpenVMS Forum Home


Sponsored links

Ads by Google


Results for: append a file

how to check if a file exists using www.computing.net/answers/openvms/how-to-check-if-a-file-exists-using/336.html

to write system errors into a file www.computing.net/answers/openvms/to-write-system-errors-into-a-file/324.html

changing chars in a file from DCL www.computing.net/answers/openvms/changing-chars-in-a-file-from-dcl/529.html