Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi am new to VMS platform
I have one file which conatins "EOF" as a Keyword at the end of File.
e.g aaaa
ansnans
"EOF"
If I found the "EOF" word then do some process.
else throw an error message.
Is anybody will help me.Sanjay.

Welcome to OpenVMS.
The method you need for this search depends on whether you want to do this from in a command, a command file (or script), or a program. I'll assume a command file.
One way is to use the DCL commands OPEN, READ, and CLOSE to read each record in the file. For instance, write a command file called EOF.COM (watch out for word-wrapping):
$ on error then goto exit
$ open myfile 'p1'
$ myrecord = " "
$ doread:
$ lastrecord = myrecord
$ read myfile myrecord /end_of_file=done
$ goto doread
$ done:
$ if (f$locate ("EXIT", lastrecord) .lt. f$length(lastrecord))
$ then
$ ! do some processing here
$ else
$ write sys$error "No keyword found"
$ endif
$ exit:
$ close myfilethen execute this command file and pass it the name of the data file:
$ @eof data_file.dat
If you just want to check the file manually, you can use the TYPE command:
$ type data_file.dat /tail=1
You should probably read the manual on the command language, DCL, at http://h71000.www7.hp.com/doc/83FINAL/9996/9996PRO.HTML
It is just one manual in an extensive doc set. The HELP command is also very useful. For the "f$" functions, enter HELP LEXICAL.Hope this helps,
Kelly

...or...
$ search datafile.dat "EOF" /nooutput/nowarning
$ if $status .eqs. "%X08D78053" then goto no_eof
$ ! execute commands for a correct datafile.
$ exit
$
$ no_eof:
$ ! execute commands indicating failing EOF test
$ exit

![]() |
![]() |
![]() |
| Login or Register to Reply | |
| Login | Register |
| Ads by Google |