1753797 Members
7372 Online
108799 Solutions
New Discussion юеВ

run a file

 
SOLVED
Go to solution
Taulant Shamo
Frequent Advisor

run a file

Hello

How can I make a file that automatically runs the command mmi after that Choices predefined.
Choices needs to press return to be excecuted.
See below:
{MMI
1
1
35569222



etc.. }


BEP1->mmi ! Is a command


1: DECnet connections
2: X25 connections
3: TCP/IP connections
99: Return
Choice: 1 ! Choice 1 mus be selected and then Return
Calling smsc_r_api_init() at 21-SEP-2004 10:16:34.53
smsc_r_api_init() returned status of 1 and error code of 0 at 21-SEP-2004 10:16:34.54

1: Send submit SM
2: Send replace SM
3: Send delete SM
4: Send delete all SMs
5: Send cancel status report request
6: Send alert SME request
7: Send retrieve request
19: Send update SM
20: Send ext submit SM
99: Return
Choice: 1 ! Choice 1 mus be selected and then Return
Input MSISDN: 35569 ! Input MSISDN must be 35569222 and then pres return

etc..

9 REPLIES 9
Ian Miller.
Honored Contributor

Re: run a file

If you are trying to run a DCL command from a program then look at the RTL routines LIB$DO_COMMAND (to exit your program and run a command) or LIB$SPAWN (to create a sub-process to run a command).

Otherwise I'm confused about whatyou are trying to do.
____________________
Purely Personal Opinion
Antoniov.
Honored Contributor

Re: run a file

Hi,
if MMI read from standard input you can:
$ TYPE SYS$INPUT /OUT=MMI.COM
$ MMI="$MMI.EXE"
$ MMI
1
1
35569222
Z
$ @MMI.COM

1.st line give you write a file from standard input (keyboard) until you press Z
2.nd line define a command that runs your executable
3.th line run your executable with standard input redirect from command file; all lines until $ (dollar) are the standard input for your file.

H.T.H.
Antonio Vigliotti

Antonio Maria Vigliotti
Taulant Shamo
Frequent Advisor

Re: run a file

Hi

attached I have send a file that explain what i intend to do. Just that entered choices to excecute automatically when file.com is excecuted. See attached file:
Antoniov.
Honored Contributor
Solution

Re: run a file

Hi,
this could be work!
$ TYPE SYS$INPUT /OUT=MMI.COM
$ MMI="$MMI.EXE"
$ MMI
1
1
35569222
n
0
n
94222
n
4
0
0
Z
$ @MMI.COM

H.T.H.
Antonio Vigliotti
Antonio Maria Vigliotti
Jan van den Ende
Honored Contributor

Re: run a file

Taulant,

Antonio's answer will work just fine, if you activate it interactively.

But, What is the real gain over just running interactively?

If you want to run it unattended, just
vreat the file MMI.com:

$! MMI.COM; Run MMI with fixed input:
$ MMI="$MMI.EXE"
$ MMI
1
1
35569222
n
0
n
94222
n
4
0
0

And any time you need it @MMI

(btw, Antonio: I stick to your example, but I HATE Billywhere terminology! Please next time call a directory or something like that!)


If my guess about the problem you are trying to solve, part of your input is somehow coming from another application, and you want to feed THAT into MMI??

In that case, you probably have that value in some symbol, say "eightdigits" = "35569222"

Now, you can write a temporary file. Starting from VMS 7.3-2, you can use F$UNIQUE, but getting your own processes' PID or the current date-time are also usual.
.
.
$ open/write mmifi :mmi.'unique'
$ write mmifi "$ MMI:=$MMI.EXE"
$ write mmifi "$ MMI"
$ write mmifi "1"
$ write mmifi "1"
vvvvvvvvvvv
$ write mmifi eightdigits
^^^^^^^^^^^
$ write mmifi "n"
.
etc
.
.
$ close mmifi
$ @:mmifi.'unique'
$ delete sys$scratch:mmifi.'unique';*

Please note that the one line between vvv & ^^^ does NOT have the quotes, it writes the VALUE of eightdigits into the file.


hth


Jan
Don't rust yours pelled jacker to fine doll missed aches.
Robert Atkinson
Respected Contributor

Re: run a file

Taulant,
you need to use parameters! When you run a DCL command file, VMS automatically passes the first 8 parameters into variables P1 to P8.

Your code would look something like this :-

ACTION = P1
OPTION = P2
VALUE = P3

IF ACTION .EQS. "1" THEN GOTO DECNET
......
DECNET:
IF OPTION .EQS. "1" .AND. VALUE .EQS. "35569222" THEN do_something

You can then think about replacing numbers with proper names to make it more user friendly, i.e.

$ MMI DECNET SUBMIT_SM 35569222

Rob.
Jan van den Ende
Honored Contributor

Re: run a file

Robert


IF OPTION .EQS. "1" .AND. VALUE .EQS. "35569222" THEN do_something


you are assuming that VALUE can have only a very limited number of values. That might be the case, and than you can do with that number of "do_somethings"'s.
In the case where VALUE might have much more different values, or perhaps is determined only at run time, then your "do_something" would have to be something very much in the line of my procedure above.

Remember, parameter substitution is only done in command lines (lines beginning with "$" ), so if you want to feed parameters into data lines, you will HAVE to go the way around, and fill in the value of the parameter in a command line that is used in building a temporary procedure in which it is hardcoded; to be executed and discarded.


Jan
Don't rust yours pelled jacker to fine doll missed aches.
Robert Atkinson
Respected Contributor

Re: run a file

Jan - It's pointless getting picky about this, even if you do, I don't have the time.

I was simply trying to show Taulant how to pass parameters to a DCL command file, which appears to me what his problem is.

If I've misunderstood his problem, then I apologise.

Robert.
Jan van den Ende
Honored Contributor

Re: run a file

Robert, no hard feelings, we all have the same goal!

Jan
Don't rust yours pelled jacker to fine doll missed aches.