[Info-vax] Basic again

Dave Froble davef at tsoft-inc.com
Sun Mar 10 21:53:46 EDT 2024


On 3/10/2024 9:04 PM, Arne Vajhøj wrote:
> My lack of skills in VMS Basic are back to haunt me.
>
> $ type z.pas
> program z(input,output);
>
> begin
>    writeln('XXX');
>    writeln('YYY' + chr(13) + chr(10));
>    writeln('ZZZ');
> end.
> $ pas z
> $ link z
> $ r z
> XXX
> YYY
>
> ZZZ
> $ type z.bas
> program z
>
> print "XXX"
> print "YYY" + chr$(13) + chr$(10)
> print "ZZZ"
>
> end program
> $ bas z
> $ link z
> $ run z
> XXX
> YYY
> ZZZ
>
> Why are there no empty line between YYY and ZZZ in the Basic
> example??
>
> (VMS Basic 1.8 on VMS Alpha)
>
> Arne

Interesting behavior ...

So, some delimiters to see what is happening.  One could also write to a file, 
then open it with EDT and see the actual characters.

print "(ZZZ)"; "("; CR; ")"; "("; LF; ")"
)(ZZ)(
   )

So, what happens above, up to the CR the data is printed, then the CR does just 
that, moves the cursor back to the left, then data up to the LF is printed, then 
the LF happens, and the last character is displayed.  Note, the LF will advance 
the line, but does not return the cursor to the left.

Ok, this program writes to a file, then the data is displayed in EDT, then the 
file is typed.

1       Open "Y.Y" For Output as File #1%

         Print #1%, "<"; "ZZZ"; ">"; "<"; CR; ">"; "<"; LF; ">"

         Close #1
         End

<ZZZ><<CR>><<LF>>

Note that the CR is depicted as <CR> and the LF is depicted as <LF> in EDT.

$ type y.y
 ><ZZ><
   >

The first 6 characters are displayed <ZZZ><
Then the CR happens, cursor is then at column 1
Then the >< is displayed, cursor is now in column 3
Then the LF happens
Then the last character, >, is displayed

Funny things happen when CR and LF are embedded in text on a display.

:-)

In your example, the CR can return the cursor to column 1, but it appears the LF 
doesn't give you the extra blank line.  I can only guess that the print 
statement might not add a second LF.  A bit strange.

-- 
David Froble                       Tel: 724-529-0450
Dave Froble Enterprises, Inc.      E-Mail: davef at tsoft-inc.com
DFE Ultralights, Inc.
170 Grimplin Road
Vanderbilt, PA  15486



More information about the Info-vax mailing list