BASIC, print at line, column?


Topic author
fim
Contributor
Posts: 19
Joined: Wed Jan 04, 2023 5:14 am
Reputation: 0
Status: Offline

BASIC, print at line, column?

Post by fim » Tue Jan 17, 2023 10:36 am

Is there a way in Basic to place print on screen at a specific row and column?
I can't find it in the Basic manual.
/Fim W.


tim.stegner
VSI Expert
Active Contributor
Posts: 28
Joined: Wed Jul 21, 2021 9:14 am
Reputation: 0
Status: Offline

Re: BASIC, print at line, column?

Post by tim.stegner » Tue Jan 17, 2023 11:01 am

appears you have two options.
1) use terminal escape codes to position the cursor to write at l,c. Terminal escape codes can easily be found using the VT100 search term.
2) use SMG$ run-time-library subroutines to establish a virtual screen, write to it, then display on your terminal. Recommend looking these up in the VMS Run-Time Library manual available on the VMSsoftware website.


Topic author
fim
Contributor
Posts: 19
Joined: Wed Jan 04, 2023 5:14 am
Reputation: 0
Status: Offline

Re: BASIC, print at line, column?

Post by fim » Tue Jan 17, 2023 11:42 am

Didn't think about the SMG routines.
I have used them before for "input".
Now I will use them for "output"
Thanks for the help.

/Fim W.

User avatar

martin
Contributor
Posts: 15
Joined: Tue Mar 22, 2022 6:47 pm
Reputation: 0
Location: England
Status: Offline

Re: BASIC, print at line, column?

Post by martin » Tue Jan 17, 2023 5:58 pm

They're called "smug" for a good reason. They were an excellent way of showing off on VT220s before graphics terminals came in. :-)
Retired System Manager VMS/UNIX/Linux. Started on a VAX 11/782 with VMS 3.6.

User avatar

arne_v
Valued Contributor
Posts: 85
Joined: Fri Apr 17, 2020 7:31 pm
Reputation: 0
Location: Rhode Island, USA
Status: Offline
Contact:

Re: BASIC, print at line, column?

Post by arne_v » Tue Jan 17, 2023 7:30 pm

1) direct escape code
2) SMG$
3) curses (C API but can be called from other languages)
4) find a third party library

I was very impressed by SMG$ in the late 80's. Not so much after that.

And curses besides the language issue is even worse.

So direct escape code or a third party library.

Added in 18 minutes 13 seconds:
Example direct escape code:

Code: Select all

program box1

declare integer i

external sub clrscr
external sub print_abs(integer, integer, string)

call clrscr
call print_abs(10, 20, "This is a test")
call print_abs(23, 1, "")

end program
!
sub clrscr

print chr$(155) + "2J"

end sub
!
sub print_abs(integer row, integer col, string txt)

print chr$(155) + str$(row) + ";" + str$(col) + "H" + txt

end sub
Added in 20 minutes 25 seconds:
Example using my old scr.mar code:

Code: Select all

program box2

external sub scr_clr
external sub scr_put_txt(integer, integer, string, integer)
external sub scr_exit

call scr_clr
call scr_put_txt(10, 20, "This is a test", 0)
call scr_put_txt(23, 1, "", 0)
call scr_exit

end program
Just say if you want a copy.

It got some goodies:

; SCR_APP ( )
; SCR_ASCIIFONT ( )
; SCR_BEL ( )
; SCR_BOX ( ROW , COL , HEIGTH , WIDTH )
; SCR_CLR ( )
; SCR_CUR_OFF ( )
; SCR_CUR_ON ( )
; SCR_DEL_LIN ( ROW )
; SCR_DEVTYP ( TYP )
; SCR_FLU_TXT ( ROW , COL , TXT_STR , ATTR )
; SCR_GET_KEY ( ROW , COL , KEY )
; SCR_GET_LIN ( LIN_STR , ACTLEN , PMT_STR )
; SCR_GET_MSG ( MSG , MSGLEN , OK )
; SCR_GET_PW ( LIN_STR , ACTLEN , PMT_STR )
; SCR_GET_TXT ( ROW , COL , LIN_STR , ACTLEN , PMT_STR )
; SCR_HIT ( )
; SCR_HOR_LIN ( ROW , COL , LENGTH )
; SCR_NOTRAP ( )
; SCR_PUT_BIGTXT ( ROW , COL , TXT_STR , ATTR )
; SCR_PUT_LIN ( LIN_STR )
; SCR_PUT_TXT ( ROW , COL , TXT_STR , ATTR )
; SCR_RETRAP ( HANDL )
; SCR_SCROLL ( NLIN )
; SCR_SETSCROLL ( FIRST , LAST )
; SCR_SOFTFONT1 ( )
; SCR_SOFTFONT2 ( )
; SCR_TRAP ( HANDL )
; SCR_VER_LIN ( ROW , COL , LENGTH )
; SCR_WHERE ( ROW , COL )
; SCR_WID_132 ( )
; SCR_WID_80 ( )

Added in 5 minutes 47 seconds:
BTW, I am curious why you picked Basic.

It is a pretty good Basic and people who used Basic on PDP-11 or VAX know it, but it is very different from various MS Basic (GW Basic, QBasic, VB6/VBA/VBS, VB.NET etc.).

Fortran, Pascal and C is more "like on other platforms" (even though Pascal was missing on the student system last I checked - which is a shame)
Arne
arne@vajhoej.dk
VMS user since 1986


Topic author
fim
Contributor
Posts: 19
Joined: Wed Jan 04, 2023 5:14 am
Reputation: 0
Status: Offline

Re: BASIC, print at line, column?

Post by fim » Wed Jan 18, 2023 3:56 am

COBOL is my native language (2 million lines) and Basic (0.5 million lines) is my second language.
Normally I worked with a smaller ERP system in PoweBasic in Windows.
PowerBasic has "everything" and therefore I thought I'd take a look at Basic in OpenVms. But a little further study, I see that it is probably not what I had in mind. So it will probably be COBOL instead.
Pascal is now included in the student system.
But thanks anyway for the advice.


tim.stegner
VSI Expert
Active Contributor
Posts: 28
Joined: Wed Jul 21, 2021 9:14 am
Reputation: 0
Status: Offline

Re: BASIC, print at line, column?

Post by tim.stegner » Wed Jan 18, 2023 8:19 am

COBOL, last i looked, does have intrinsic cursor positioning syntax.

User avatar

arne_v
Valued Contributor
Posts: 85
Joined: Fri Apr 17, 2020 7:31 pm
Reputation: 0
Location: Rhode Island, USA
Status: Offline
Contact:

Re: BASIC, print at line, column?

Post by arne_v » Wed Jan 18, 2023 8:44 am

fim wrote:
Wed Jan 18, 2023 3:56 am
COBOL is my native language (2 million lines) and Basic (0.5 million lines) is my second language.
Normally I worked with a smaller ERP system in PoweBasic in Windows.
PowerBasic has "everything" and therefore I thought I'd take a look at Basic in OpenVms. But a little further study, I see that it is probably not what I had in mind. So it will probably be COBOL instead.
Pascal is now included in the student system.
But thanks anyway for the advice.

I have never used PowerBasic but I believe it is providing functionality like VB6 and Delphi. In which case VMS Basic is not what you want.

You could go for Cobol. VMS Cobol is a nice Cobol compiler and I believe pretty standard (pre-2002 standards that is!). If you know Cobol well then I don't think you will have any problems working with VMS Cobol. UI wise it would be text based though.

If you want graphical then you could go for a web server and PHP maybe interfacing with CGI scripts in Cobol.

I suspect that the student system has too little memory for X to be any fun. But you could do X code in C or install Java and do Swing code (which do work with X on VMS).
Arne
arne@vajhoej.dk
VMS user since 1986


Topic author
fim
Contributor
Posts: 19
Joined: Wed Jan 04, 2023 5:14 am
Reputation: 0
Status: Offline

Re: BASIC, print at line, column?

Post by fim » Wed Jan 18, 2023 9:45 am

I know COBOL in OpenVms well. Many years ago I wrote a small ERP system (280,000 lines).
Now I start all over again with COBOL.

One thing I can't find in the manual is to write a comment at the end of the line.
In AcuCobol you can write like this.
20 IDENT-CRT-COM OCCURS 24 PIC X(40). | Bör förlängas

Is there something similar to COBOL in OpenVms?
/Fim W.

User avatar

arne_v
Valued Contributor
Posts: 85
Joined: Fri Apr 17, 2020 7:31 pm
Reputation: 0
Location: Rhode Island, USA
Status: Offline
Contact:

Re: BASIC, print at line, column?

Post by arne_v » Wed Jan 18, 2023 10:02 am

Not that I am aware of (but then I am not really a Cobol person) - only * at the beginning.

Added in 5 minutes 37 seconds:
Regarding Cobol on VMS and data storage.

VMS and VMS Cobol got excellent support for indexed files. Standard Cobol syntax.

For access to relational databases via embedded SQL you have support for:
- Rdb on VMS
- Mimer on VMS
- SQLRelay running on Linux or Windows connecting to practically any database on any OS (last I checked there were some problems with parameters for anything but Oracle, but maybe that has been resolved since then)
Arne
arne@vajhoej.dk
VMS user since 1986

Post Reply