Simpler Navigation for Servers and Operating Systems - Please Update Your Bookmarks
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
If you have bookmarked forums or discussion boards in Servers and Operating Systems, we suggest you check and update them as needed.
Operating System - OpenVMS
cancel
Showing results for 
Search instead for 
Did you mean: 

VMS BASIC program not writing out the last record in a file

jme0909
Occasional Visitor

VMS BASIC program not writing out the last record in a file

I ran into a weird problem with a BASIC program where when the program is run manually it works fine. All records in the input file are accounted for in either good output or bypass/error files. But when the same program is run within a DCL script it is omitting the last record in the file. It doesn't get written to any of the output or error/bypass files.


I've run it into debug several times and it reads every record and outputs every record. I've tried all the obvious solutions so far - recompiling, etc, with no luck. Any ideas why this would be working manually but not within a script?  Is it possibly system-related?

3 REPLIES
Steven Schweda
Honored Contributor

Re: VMS BASIC program not writing out the last record in a file

 
Hein van den Heuvel
Honored Contributor

Re: VMS BASIC program not writing out the last record in a file

 

 

>> - recompiling,

 

Hmm, you call is "obvious solutions", I call it "Insanity" as per Einstein's defintion:

'doing the same thing over and over again and expecting different results.'

 

>>  All records in the input file are accounted for in either good output or bypass/error files. 

 

The is precious litle information to go on here.

 

How is the input read? INPUT or GET statements?

Through  a process permanent file (file opened by DCL, for example SYS$INPUT)

What kinda inpu file? (If you don't understand the question, attach DIRECTORY/FULL output)

Is the last record special, for example for a stream-lf input file the last record sometimes does NOT have a formal terminator (Compare DUMP/BLOCK=START=...  with DUMP/RECORD=START=...)

 

Surely the program has a loop, which likely terminates on an EOF condition.

Does that last record trigger an EOF pre-maturely.

How about adding a simple record count + display after the loop.

 

How it the output written? PRINT? PUT? Regular 'OPEN'ed file?  Need a final CLOSE (or FLUSH) ?

Deferred write? Write-behind?

 

Show us some core code? OPEN, Loop, GET, eof-test, CLOSE?

Hein

 

Highlighted
Tom Wetty
Advisor

Re: VMS BASIC program not writing out the last record in a file

Hi as Hein says is this an RMS record or SQL or Stream file ?

 

Do you move the mapped buffer to another in order to display it ?  Is the display a print statement ?  Especially on error handling.

 

Does the program do a system call to the DCL error on end of file, is end of file status hard coded or do you use a library value for the error code ?  This is most important since it would explain interactive vs command procedure driven behavior.

 

Please provide much more info about the file access, and error handling in the code; perhaps code samples or mock up if necessary

 

Without this it is not possible to answer your questions.

 

Thanks!