Operating System - OpenVMS
1752577 Members
4665 Online
108788 Solutions
New Discussion юеВ

Returning Output From TPU

 
Robert Atkinson
Respected Contributor

Returning Output From TPU

The attached TPU code is designed to allow a line of text to be selected from within TPU, which is then returned in a logical back to the calling process.

I've now found that captive users can't create the spawned process required to create a logical name.

One solution would be to create a file and write the line to that, so that it can be read back in by the process, but that's a pretty awful way of achieving the end result.

I've had a look through the TPU docs, but can't find a function for creating symbols or logicals, so I'm stuck there.

Can anyone else think of a better way of doing this, preferably within memory rather than disk IO?

Rob.
9 REPLIES 9
Hoff
Honored Contributor

Re: Returning Output From TPU

The spawn operation needs to be marked as trusted.

Look around for (or write) a direct TPU routine calling sys$set_logical.

Here's something pretty close, with the calluser stuff:

http://www.polarhome.com/vms/vms_sw_ftplist_smallprograms.html

And worries around elegance? Um, why? You're using TPU and a DCL menu system, after all. Those choices would tend to belie any particular goal of elegance, right? (Get it working and get it out the door, and optimize for elegance later?)

John Gillings
Honored Contributor

Re: Returning Output From TPU

Rob,

Unless this is an exercise in using TPU, I'd say this would be much simpler and easier to manage rewritten using SMG. The program would be little more than a call to SMG$CREATE_MENU and then SMG$SELECT_FROM_MENU.

All the navigation logic is done for you by SMG, and you can easily return the result as a symbol (or logical name, if that's what you really want - but I suspect not).

Even if you don't have a compiler, this would be fairly simple to code in MACRO32. Depending on how often your selections change, you might even be able to write it as a .MACRO that generates the code, rather than reading a file from within the program.
A crucible of informative mistakes
Robert Atkinson
Respected Contributor

Re: Returning Output From TPU

Hoff - I'm currently unable to check out those code extracts, as Arne's FTP site is down.
Robert Atkinson
Respected Contributor

Re: Returning Output From TPU

I think given the examples in the two links below, I should be able to come up with some code to set a symbol from TPU using CALL_USER.

http://www.eight-cubed.com/examples/framework.php?file=lib_set_symbol.c

http://h71000.www7.hp.com/doc/731final/4493/4493pro_012.html


I'd still rather not get into a reliance on languages where we have no internal skills to support (that's how I've got into this problem in the first place), but it looks like I don't really have a choice.

Rob.
Hein van den Heuvel
Honored Contributor

Re: Returning Output From TPU

Rob,

If the end result is just a selected line, no user edits, then can you overload the exit status to indicate which line was selected?

It is not clear to me whether this TPU excercise is called from a DCL procedure or a program. I suspect a DCL procedure. If it is called from a program, then consider calling TPU directly not as spawned process.
Assuming this is done more than once, you will save plenty IOs on the image activations.

In the called case a regular logical will suffice, but that does not help as there is no build in for that either anyway.


Writing a temp file, as ugly as that is, doesn't compare too poorly with spawning a process IMHO.

How about using the TPU CALL_USER function?
http://h71000.www7.hp.com/doc/83final/4493/4493pro_012.html

Or as John suggests, replace the whole thing with a little program written in the langues of your choice to call SMG$MENU and have the program call the create logical directly without having to spawna process to do so.

fwiw,
Hein.

Robert Atkinson
Respected Contributor

Re: Returning Output From TPU

Hein, unfortunately, using the VMS exit status won't work because I return the text of the line rather than the line number.

I agree that performance isn't much different with the file method. It's not a good option for us though, given the the extra complexity of opening up and reading a file, and problems that could encounter.

I've already looked at the CALL_USER option (see above) and will probably go for that. Although I'd like to write the SMG method, the reality is that I probably don't have the skills. Even if I did, we still wouldn't have the in-house skills to support it if I got knocked down by a bus, so it isn't a viable option for us.

Rob.
John Gillings
Honored Contributor

Re: Returning Output From TPU

Rob,

>unfortunately, using the VMS exit status
>won't work because I return the text of the
>line rather than the line number.

If this is DCL, you can play all kinds of tricks with $STATUS. For example, read your input file and define a symbol for each line:

$ i=1
$ loop: read/end=endloop input line
$ line'i'=line
$ i=i+1
$ GOTO loop
$ endloop:


Now in your program find the line you want by number and return it as a status. Reserve the low byte for success/fail, and set STS$V_INHIB to prevent DCL from generating a message. Return your line number in the middle word of $STATUS:

$ RUN your program
$ stat=$STATUS
$ IF stat
$ THEN
$ ln=(stat.AND.%XFFFF00)/%X100
$ result=line'ln'
$ ELSE
$ ! deal with error
$ ENDIF
A crucible of informative mistakes
Wim Van den Wyngaert
Honored Contributor

Re: Returning Output From TPU

Probably useless but TPU does understand
write node::"task=wim.com"

It will start wim.com, that can read the data passed from sys$net. And then set logicals with it.

fwiw

Wim
Wim
Robert Atkinson
Respected Contributor

Re: Returning Output From TPU

I'm almost there with this.

All I need is for someone to help me take the function input parameter, split it in 2 and pass it to these calls :-

static $DESCRIPTOR (symbol_d, "LIB_SET_SYMBOL_TEST");
static $DESCRIPTOR (value_d, "Test Complete");

Code is attached - any takers?

Rob.