Re: VMS BASIC program not writing out the last record in a file (962 Views)
Reply
Occasional Visitor
jme0909
Posts: 1
Registered: ‎09-26-2013
Message 1 of 4 (1,055 Views)

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?

Honored Contributor
Steven Schweda
Posts: 9,089
Registered: ‎02-23-2005
Message 2 of 4 (1,016 Views)

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

Honored Contributor
Hein van den Heuvel
Posts: 6,588
Registered: ‎05-19-2003
Message 3 of 4 (980 Views)

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

 

Advisor
Tom Wetty
Posts: 22
Registered: ‎06-23-2005
Message 4 of 4 (962 Views)

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!

The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.