Operating System - OpenVMS
1753805 Members
7676 Online
108805 Solutions
New Discussion юеВ

Re: How to implement multi-line input recall?

 
SOLVED
Go to solution
Galen Tackett
Valued Contributor

How to implement multi-line input recall?

There are a number of system utilities, for example SYSMAN and LANCP, that provide the ability to scroll back through multiple lines of previous input.

The last time I checked (which I admit was years ago) the terminal driver itself provided only single line input recall.

I know that you can get 20 line input recall by using SMG$. But I'm guessing that these utilities may do it some other way. Does anyone know how?
14 REPLIES 14
Uwe Zessin
Honored Contributor

Re: How to implement multi-line input recall?

You could check with ANALYZE/IMAGE whether they are linked against SMGRTL.

$ pipe analyze/image sys$system:lancp.exe | search sys$input smg
global section name: "SMGSHR_001"
5) "SMGSHR"
$
.
Ian Miller.
Honored Contributor

Re: How to implement multi-line input recall?

I use SMG (SMG$CREATE_VIRTUAL_KEYBOARD, and SMG$READ_COMPOSED_LINE) and so does LANCP and SYSMAN.

I do have the source code to a routine which does do reading a command from the terminal and handing command line recall. I don't know the original author and its written in C.
____________________
Purely Personal Opinion
Galen Tackett
Valued Contributor

Re: How to implement multi-line input recall?

Uwe,

Thanks for your suggestion. For some reason I hadn't thought of that, though it's obvious now. But before I could try it I also read Ian's reply that made it unnecessary.

Ian,

Can you attach the code to which you refer to a reply here? If you'd rather not (since you don't know the author) we can probably arrange some other way of exchanging the details.

Way back when SMG$ was new (boy, how long ago was that??) I did quite a bit of programming with it. I can't claim to remember much now but I'm sure it would come back quickly.

Meanwhile, time allowing, I'll do some experimenting.
Uwe Zessin
Honored Contributor

Re: How to implement multi-line input recall?

If my memory hasn't degraded too much, SMG was introduced in VAX/VMS V4.4. I had put some efford to change an order of manuals to the current version, so I am fairly sure.
.
Ian Miller.
Honored Contributor

Re: How to implement multi-line input recall?

here is the code. I don't recall where I originally got it.

If you need reminding of SMG$ then my other utilities use SMG$ routines for command line recall.
____________________
Purely Personal Opinion
Galen Tackett
Valued Contributor

Re: How to implement multi-line input recall?

Ian,

My thanks. :)

I do have some of your utilities and will take a look at how they do this.

Galen
John Gillings
Honored Contributor
Solution

Re: How to implement multi-line input recall?

Galen,

Don't forget, you can use just the input side of SMG, without using any of the output functions.

I've attached a very simple program in Pascal which uses SMG$READ_COMPOSED_LINE. It also demonstrates that you can specify more than 20 lines of recall when you create the virtual keyboard.

>But I'm guessing that these utilities
>may do it some other way.

Since a good programmer is a lazy plagurist, and one of the objectives of OpenVMS is user interface consistency, I'd be hoping that everyone uses SMG for this task.

If you want to find out exactly what routines they're calling, and how, use my FAKE_RTL procedure to build a FAKE_SMGSHR and trace the arguments.

A quick check of SYSMAN shows SMG$CREATE_VIRTUAL_KEYBOARD, SMG#CREATE_KEY_TABLE and SMG$READ_COMPOSED_LINE.

(Also interesting to note that the SYSMAN programmer uses the sneaky trick of passing the string descriptor for the input line as the "RESULTANT-LENGTH" argument)
A crucible of informative mistakes
John Abbott_2
Esteemed Contributor

Re: How to implement multi-line input recall?

Slightly off subject but thought it worth posting. From DCL, $inquire p1 "" allowes recall using up arrow, but $read/prompt="" sys$command p1 doesn't (you can only recall last input). I logged this with Mr DCL (Guy), who is treating this as a bug and hopes to fix it in v8.3

John.
Don't do what Donny Dont does
Galen Tackett
Valued Contributor

Re: How to implement multi-line input recall?

John G.,

Thanks very much for our excellent suggestions and sample code, and also for FAKE_RTL. I've skimmed your journal article and found it very interesting but haven't read it thoroughly. I hope to try out this technique some time.

John A.,

I first noticed that difference between $ READ and $ INQUIRE long ago when command line recall was still pretty new. I always assumed it was just meant to be that way, so it's nice to hear that the DCL Guy :-) is treating it as a bug.

The original version of VMSLICENSE.COM used INQUIRE instead of READ. This was handy when entering multiple similar licenses. You could just up-arrow to whatever field changed between such licenses (often just the authorization and checksum), edit them, and hit for all the others (since they defaulted to the last value entered in that field.)

Later VMSLICENSE.COM was changed to use READ (among other changes) and multi line recall stopped working. I quickly made a modified version of the new procedure that still used INQUIRE. But that was long ago in another life...

Galen