Re: [U2] [AD] UniBasic Program with arguments

2005-02-05 Thread Mark Johnson
Obviously my PRINT process will have its limitations. The major success is
not cluttering the BP's with so many stupid 1 or 2 line test programs. As I
acquire new clients with their prior programmers programs, I see way too
many of these. Virtually all can be replaced with my PRINT process.

As far as return arguments, I agree. If you have a major sub to a major
primary program, you would type way too much at the command line to test
that sub. But, you can have return arguments.

Case in point. One client had a price lookup process that was hand coded in
8-10 programs. Basically the same 80 lines in each. I wrote a single sub
called GET.PRICE(CUSTNO, PRODNO, PRICE) to corral the wild horses. And, yes,
I can type this at TCL:

PRINT ; CALL GET.PRICE("001385", "WINGNUT", PRICE) ; PRINT
OCONV(PRICE,"MD2")

Except for complex subs, the only other downside would be a READNEXT or
complex ELSE scenario, COMMONS, GOTOs or GOSUBs or if it just got to be too
much typing. I tend not to use any INPUT statements as well.

Bottom line is that roughly 85% of the stupid test programs can be replaced
with PRINT including testing most simple subs..

Thanks.
My 3 cents.
- Original Message -
From: "Chauhan, Savita" <[EMAIL PROTECTED]>
To: 
Sent: Thursday, February 03, 2005 9:09 AM
Subject: RE: [U2] [AD] UniBasic Program with arguments


> That's a good idea if the program doesn't have return arguments.
>
>
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of David Jordan
> Sent: Thursday, February 03, 2005 12:52 AM
> To: u2-users@listserver.u2ug.org
> Subject: RE: [U2] [AD] UniBasic Program with arguments
>
> You can run a program with arguments from the command line as below
>
> RUN BP PROG ARG1 ARG2 ARG3
>
> In the program use SEEK(ARG.,..) or GET(ARG.,...) to get the arguments
> from
> the command line.  Don't forget to quote the arguments if there are
> spaces
> in them.
>
> You can run the program with parameters from within a BASIC Program
> EXECUTE "RUN BP PROG ":arg1:" ":arg2:"  ":arg3
>
>
> Regards
> David Jordan
> Founding U2UG Board Member
>
>
>
> -Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Chauhan, Savita
> Sent: Thursday, 3 February 2005 1:59 AM
> To: u2-users@listserver.u2ug.org
> Subject: RE: [U2] [AD] UniBasic Program with arguments
>
> Thanks all you guys for all your replies.
> This list has come to my rescue so many times. I have so much more to
> learn.
>
> I realized that I can run my program (with args) only as one of the
> following (without any external utitlity) :
> 1. as a subroutine (with no args, but can use @COMMAND to read the
> command line)
> 2. as an external subroutine (with args)
>
> If I make it a subroutine, then I cannot call it from another pgm and
> pass it args.
> If I make external subroutine, I cannot run it from TCL.
>
> Thanks again.
>
> Savita Chauhan,
> Programmer/Analyst
> x:1754 Central Texas College.
> ---
> ---
> u2-users mailing list
> u2-users@listserver.u2ug.org
> To unsubscribe please visit http://listserver.u2ug.org/
> ---
> u2-users mailing list
> u2-users@listserver.u2ug.org
> To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


Re: [U2] [AD] UniBasic Program with arguments

2005-02-03 Thread Michael Blum
This is actually pretty simple in UniData - UniBasic. The call to 
'SYSTEM(17)' tells you whether you're running from the command line or 
as a called routine. Here's a program I wrote along these lines.

SUBROUTINE GET.UDT.OPTION(RES, OPTNO)
* GET.UDT.OPTION - Get the value of one specific UDT.OPTION
* May be invoked either as a Subroutine or from the command line.
* M. Blum, 12/7/2004
FROM.CMD = SYSTEM(17) = 0 ;* Invoked from the Command Line
IF FROM.CMD THEN ;* Invoked from Command Line
 SENT = CONVERT(' ', @FM, TRIM(@SENTENCE))
 OPTNO = SENT<2>
END
EXECUTE 'UDT.OPTIONS' CAPTURING XX.OUT
XX.OUT = TRIM(XX.OUT)
OPT.LINE = ''
LOOP
 REMOVE A.LINE FROM XX.OUT SETTING DELIM
 IF FIELD(A.LINE,' ',1) = OPTNO THEN
   OPT.LINE = A.LINE
   EXIT
 END
WHILE DELIM DO
REPEAT
IF FROM.CMD THEN
 IF OPT.LINE = '' THEN OPT.LINE = 'Not Found!'
 PRINT OPT.LINE
END ELSE
 RES = FIELD(OPT.LINE, ' ', 3)
 RETURN
END
END
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] [AD] UniBasic Program with arguments

2005-02-03 Thread Chauhan, Savita
That's a good idea if the program doesn't have return arguments.


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of David Jordan
Sent: Thursday, February 03, 2005 12:52 AM
To: u2-users@listserver.u2ug.org
Subject: RE: [U2] [AD] UniBasic Program with arguments

You can run a program with arguments from the command line as below

RUN BP PROG ARG1 ARG2 ARG3

In the program use SEEK(ARG.,..) or GET(ARG.,...) to get the arguments
from
the command line.  Don't forget to quote the arguments if there are
spaces
in them.

You can run the program with parameters from within a BASIC Program 
EXECUTE "RUN BP PROG ":arg1:" ":arg2:"  ":arg3


Regards
David Jordan
Founding U2UG Board Member



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Chauhan, Savita
Sent: Thursday, 3 February 2005 1:59 AM
To: u2-users@listserver.u2ug.org
Subject: RE: [U2] [AD] UniBasic Program with arguments

Thanks all you guys for all your replies. 
This list has come to my rescue so many times. I have so much more to
learn.

I realized that I can run my program (with args) only as one of the
following (without any external utitlity) :
1. as a subroutine (with no args, but can use @COMMAND to read the
command line)
2. as an external subroutine (with args)

If I make it a subroutine, then I cannot call it from another pgm and
pass it args.
If I make external subroutine, I cannot run it from TCL.

Thanks again.

Savita Chauhan, 
Programmer/Analyst
x:1754 Central Texas College.
---
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


Re: [U2] [AD] UniBasic Program with arguments

2005-02-03 Thread Peter D Olson
"Clever but not quite there... 
That would only work if the subroutine used arg 1 as a return argument."

the orig. post was to run subroutine from command line ???
exactly what does the user expect this subroutine to do ???

This e-mail, including attachments, may include confidential and/or 
proprietary information, and may be used only by the person or entity to 
which it is addressed. If the reader of this e-mail is not the intended 
recipient or his or her authorized agent, the reader is hereby notified 
that any dissemination, distribution or copying of this e-mail is 
prohibited. If you have received this e-mail in error, please notify the 
sender by replying to this message and delete this e-mail immediately.
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


Re: [U2] [AD] UniBasic Program with arguments

2005-02-03 Thread Mats Carlid
True - sorry.   :^(
I have worked too much with functions, haven't I?.
-- mats
Brian Leach wrote:
Mats,
Clever but not quite there... 
That would only work if the subroutine used arg 1 as a return argument.

Brian
 

-Original Message-
From: [EMAIL PROTECTED] 
[mailto:[EMAIL PROTECTED] On Behalf Of Mats Carlid
Sent: 03 February 2005 10:22
To: u2-users@listserver.u2ug.org
Subject: Re: [U2] [AD] UniBasic Program with arguments

Well,
actually you can, sort of :
LIST VOC SAMPLE 1 EVAL  "SUBR('your.subroutine', arg1 , arg2 )"
Then we can argue forever if this is really running from TCl 
or what.  ;^)

And  IIRC  this has been mentioned on the list before.
-- mats
Chauhan, Savita wrote:
   

Thanks all you guys for all your replies. 
This list has come to my rescue so many times. I have so 
 

much more to 
   

learn.
I realized that I can run my program (with args) only as one of the 
following (without any external utitlity) :
1. as a subroutine (with no args, but can use @COMMAND to read the 
command line) 2. as an external subroutine (with args)

If I make it a subroutine, then I cannot call it from 
 

another pgm and 
   

pass it args.
If I make external subroutine, I cannot run it from TCL.
Thanks again.
Savita Chauhan,
Programmer/Analyst
x:1754 Central Texas College.
---
Change is the only Constant.
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Mark Johnson
Sent: Wednesday, February 02, 2005 8:18 AM
To: u2-users@listserver.u2ug.org
Subject: Re: [U2] [AD] UniBasic Program with arguments
Here it is, pretty quickly.
Create a Databasic Program, I call mine PRINT (losing regard 
 

for PRINT 
   

being there). That is a simple program that takes the @COMMAND or 
PROCREAD or TCLREAD line you just typed as the first line in a Basic 
program, throw an END at the end, compile and run itself.

Thus, you can have this or virtually any single line program 
 

run from 
   

TCL.
This is the absolutely best and simplest method. I use this 100's of 
time a day for testing the OCONV's, simple math, anything. Its only 
limitation is multiple line IF statements or anything with an ELSE.

PRINT ; CALL MY.SUB(ARG1, ARG2, WHATEVER) ; PRINT WHATEVER
PRINT 5+5
PRINT OCONV("12345","DMA")
PRINT ; OPEN "MD" THEN READ X FROM "YOUR.ID" THEN WRITEV "A" ON 
"SOMETHING",
2
PRINT ; FOR I=1 TO 15 STEP 2 ; PRINT I,I*11 ; NEXT I

ED MD PRINT
001 PQN
002 HRUN BP PRINT.PROG
003 P
ED BP PRINT.PROG
001 PROCREAD TEST ELSE STOP
OR
001 TCLREAD TEST
OR
001 [EMAIL PROTECTED]
001+ CONVERT CHAR(254) TO " " IN TEST
002 OPEN "BP" TO F.BP ELSE STOP
003 TEST<2>="END"
004 ID="PRINTTT"
005 WRITE TEST ON F.BP, ID
006 EXECUTE "DECATALOG BP ":ID
007 EXECUTE "BASIC BP ":ID
008 EXECUTE "RUN BP ":ID
That's it. I created this in 1978 and have written 2 
 

articles about it, 
   

one in Datastream and the other for Spectrum. It should be 
     

part of the 
   

MV OS.
My 3 cents.
- Original Message -
From: "Chauhan, Savita" <[EMAIL PROTECTED]>
To: 
Sent: Tuesday, February 01, 2005 5:48 PM
Subject: [U2] [AD] UniBasic Program with arguments

 

Hi,
I am trying to run a unibasic program (external subroutine) 
   

that takes 
   

two arguments.
I don't know how do I pass it the arguments if I run it 
   

directly from 
   

shel prompt instead of calling it from another program.
I have gone through the manual, but can't find anything. Pls help.
Thanks
Savita.
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
  

   

---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
 

---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
   

---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] [AD] UniBasic Program with arguments

2005-02-03 Thread Brian Leach
Mats,

Clever but not quite there... 
That would only work if the subroutine used arg 1 as a return argument.

Brian

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Mats Carlid
> Sent: 03 February 2005 10:22
> To: u2-users@listserver.u2ug.org
> Subject: Re: [U2] [AD] UniBasic Program with arguments
> 
> Well,
> 
> actually you can, sort of :
> 
> LIST VOC SAMPLE 1 EVAL  "SUBR('your.subroutine', arg1 , arg2 )"
> 
> Then we can argue forever if this is really running from TCl 
> or what.  ;^)
> 
> And  IIRC  this has been mentioned on the list before.
> 
> -- mats
> 
> 
> Chauhan, Savita wrote:
> 
> >Thanks all you guys for all your replies. 
> >This list has come to my rescue so many times. I have so 
> much more to 
> >learn.
> >
> >I realized that I can run my program (with args) only as one of the 
> >following (without any external utitlity) :
> >1. as a subroutine (with no args, but can use @COMMAND to read the 
> >command line) 2. as an external subroutine (with args)
> >
> >If I make it a subroutine, then I cannot call it from 
> another pgm and 
> >pass it args.
> >If I make external subroutine, I cannot run it from TCL.
> >
> >Thanks again.
> >
> >Savita Chauhan,
> >Programmer/Analyst
> >x:1754 Central Texas College.
> >---
> >Change is the only Constant.
> >
> >
> >-Original Message-
> >From: [EMAIL PROTECTED]
> >[mailto:[EMAIL PROTECTED] On Behalf Of Mark Johnson
> >Sent: Wednesday, February 02, 2005 8:18 AM
> >To: u2-users@listserver.u2ug.org
> >Subject: Re: [U2] [AD] UniBasic Program with arguments
> >
> >Here it is, pretty quickly.
> >
> >Create a Databasic Program, I call mine PRINT (losing regard 
> for PRINT 
> >being there). That is a simple program that takes the @COMMAND or 
> >PROCREAD or TCLREAD line you just typed as the first line in a Basic 
> >program, throw an END at the end, compile and run itself.
> >
> >Thus, you can have this or virtually any single line program 
> run from 
> >TCL.
> >This is the absolutely best and simplest method. I use this 100's of 
> >time a day for testing the OCONV's, simple math, anything. Its only 
> >limitation is multiple line IF statements or anything with an ELSE.
> >
> >PRINT ; CALL MY.SUB(ARG1, ARG2, WHATEVER) ; PRINT WHATEVER
> >
> >PRINT 5+5
> >PRINT OCONV("12345","DMA")
> >PRINT ; OPEN "MD" THEN READ X FROM "YOUR.ID" THEN WRITEV "A" ON 
> >"SOMETHING",
> >2
> >PRINT ; FOR I=1 TO 15 STEP 2 ; PRINT I,I*11 ; NEXT I
> >
> >ED MD PRINT
> >001 PQN
> >002 HRUN BP PRINT.PROG
> >003 P
> >
> >ED BP PRINT.PROG
> >001 PROCREAD TEST ELSE STOP
> >OR
> >001 TCLREAD TEST
> >OR
> >001 [EMAIL PROTECTED]
> >001+ CONVERT CHAR(254) TO " " IN TEST
> >002 OPEN "BP" TO F.BP ELSE STOP
> >003 TEST<2>="END"
> >004 ID="PRINTTT"
> >005 WRITE TEST ON F.BP, ID
> >006 EXECUTE "DECATALOG BP ":ID
> >007 EXECUTE "BASIC BP ":ID
> >008 EXECUTE "RUN BP ":ID
> >
> >That's it. I created this in 1978 and have written 2 
> articles about it, 
> >one in Datastream and the other for Spectrum. It should be 
> part of the 
> >MV OS.
> >
> >My 3 cents.
> >
> >- Original Message -
> >From: "Chauhan, Savita" <[EMAIL PROTECTED]>
> >To: 
> >Sent: Tuesday, February 01, 2005 5:48 PM
> >Subject: [U2] [AD] UniBasic Program with arguments
> >
> >
> >  
> >
> >>Hi,
> >>
> >>I am trying to run a unibasic program (external subroutine) 
> that takes 
> >>two arguments.
> >>I don't know how do I pass it the arguments if I run it 
> directly from 
> >>shel prompt instead of calling it from another program.
> >>I have gone through the manual, but can't find anything. Pls help.
> >>
> >>Thanks
> >>Savita.
> >>---
> >>u2-users mailing list
> >>u2-users@listserver.u2ug.org
> >>To unsubscribe please visit http://listserver.u2ug.org/
> >>
> >>
> >---
> >u2-users mailing list
> >u2-users@listserver.u2ug.org
> >To unsubscribe please visit http://listserver.u2ug.org/
> >---
> >u2-users mailing list
> >u2-users@listserver.u2ug.org
> >To unsubscribe please visit http://listserver.u2ug.org/
> ---
> u2-users mailing list
> u2-users@listserver.u2ug.org
> To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


Re: [U2] [AD] UniBasic Program with arguments

2005-02-03 Thread Mats Carlid
Well,
actually you can, sort of :
LIST VOC SAMPLE 1 EVAL  "SUBR('your.subroutine', arg1 , arg2 )"
Then we can argue forever if this is really running from TCl or what.  ;^)
And  IIRC  this has been mentioned on the list before.
-- mats
Chauhan, Savita wrote:
Thanks all you guys for all your replies. 
This list has come to my rescue so many times. I have so much more to
learn.

I realized that I can run my program (with args) only as one of the
following (without any external utitlity) :
1. as a subroutine (with no args, but can use @COMMAND to read the
command line)
2. as an external subroutine (with args)
If I make it a subroutine, then I cannot call it from another pgm and
pass it args.
If I make external subroutine, I cannot run it from TCL.
Thanks again.
Savita Chauhan, 
Programmer/Analyst
x:1754 Central Texas College.
---
Change is the only Constant.

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Mark Johnson
Sent: Wednesday, February 02, 2005 8:18 AM
To: u2-users@listserver.u2ug.org
Subject: Re: [U2] [AD] UniBasic Program with arguments
Here it is, pretty quickly.
Create a Databasic Program, I call mine PRINT (losing regard for PRINT
being
there). That is a simple program that takes the @COMMAND or PROCREAD or
TCLREAD line you just typed as the first line in a Basic program, throw
an
END at the end, compile and run itself.
Thus, you can have this or virtually any single line program run from
TCL.
This is the absolutely best and simplest method. I use this 100's of
time a
day for testing the OCONV's, simple math, anything. Its only limitation
is
multiple line IF statements or anything with an ELSE.
PRINT ; CALL MY.SUB(ARG1, ARG2, WHATEVER) ; PRINT WHATEVER
PRINT 5+5
PRINT OCONV("12345","DMA")
PRINT ; OPEN "MD" THEN READ X FROM "YOUR.ID" THEN WRITEV "A" ON
"SOMETHING",
2
PRINT ; FOR I=1 TO 15 STEP 2 ; PRINT I,I*11 ; NEXT I
ED MD PRINT
001 PQN
002 HRUN BP PRINT.PROG
003 P
ED BP PRINT.PROG
001 PROCREAD TEST ELSE STOP
OR
001 TCLREAD TEST
OR
001 [EMAIL PROTECTED]
001+ CONVERT CHAR(254) TO " " IN TEST
002 OPEN "BP" TO F.BP ELSE STOP
003 TEST<2>="END"
004 ID="PRINTTT"
005 WRITE TEST ON F.BP, ID
006 EXECUTE "DECATALOG BP ":ID
007 EXECUTE "BASIC BP ":ID
008 EXECUTE "RUN BP ":ID
That's it. I created this in 1978 and have written 2 articles about it,
one
in Datastream and the other for Spectrum. It should be part of the MV
OS.
My 3 cents.
- Original Message -
From: "Chauhan, Savita" <[EMAIL PROTECTED]>
To: 
Sent: Tuesday, February 01, 2005 5:48 PM
Subject: [U2] [AD] UniBasic Program with arguments
 

Hi,
I am trying to run a unibasic program (external subroutine) that takes
two arguments.
I don't know how do I pass it the arguments if I run it directly from
shel prompt instead of calling it from another program.
I have gone through the manual, but can't find anything. Pls help.
Thanks
Savita.
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
   

---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] [AD] UniBasic Program with arguments

2005-02-02 Thread David Jordan
You can run a program with arguments from the command line as below

RUN BP PROG ARG1 ARG2 ARG3

In the program use SEEK(ARG.,..) or GET(ARG.,...) to get the arguments from
the command line.  Don't forget to quote the arguments if there are spaces
in them.

You can run the program with parameters from within a BASIC Program 
EXECUTE "RUN BP PROG ":arg1:" ":arg2:"  ":arg3


Regards
David Jordan
Founding U2UG Board Member



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Chauhan, Savita
Sent: Thursday, 3 February 2005 1:59 AM
To: u2-users@listserver.u2ug.org
Subject: RE: [U2] [AD] UniBasic Program with arguments

Thanks all you guys for all your replies. 
This list has come to my rescue so many times. I have so much more to
learn.

I realized that I can run my program (with args) only as one of the
following (without any external utitlity) :
1. as a subroutine (with no args, but can use @COMMAND to read the
command line)
2. as an external subroutine (with args)

If I make it a subroutine, then I cannot call it from another pgm and
pass it args.
If I make external subroutine, I cannot run it from TCL.

Thanks again.

Savita Chauhan, 
Programmer/Analyst
x:1754 Central Texas College.
---
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


Re: [U2] [AD] UniBasic Program with arguments

2005-02-02 Thread Mark Johnson
Trevor: You gave up too easily. See my posts on PRINT that I've been using
for over 20 years.
My 1 cent
- Original Message -
From: "Trevor Ockenden" <[EMAIL PROTECTED]>
To: 
Sent: Wednesday, February 02, 2005 10:51 PM
Subject: RE: [U2] [AD] UniBasic Program with arguments


> In short - you can't.
>
> That is, you need to call it from another program... something like...
>
> 0001: CALL XYZ (ARG1, ARG2)
> 0002: END
>
> Depending upon how you have written this routine it may be possible to
> call it from a Dictionary item also but that is for another e-mail.
>
> Cheers
>
> Trevor Ockenden
> m: 0414 731 634
> e:  [EMAIL PROTECTED]
>
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Behalf Of Chauhan, Savita
> Sent: Wednesday, 2 February 2005 9:48 AM
> To: u2-users@listserver.u2ug.org
> Subject: [U2] [AD] UniBasic Program with arguments
>
> Hi,
>
> I am trying to run a unibasic program (external subroutine) that takes
> two arguments.
> I don't know how do I pass it the arguments if I run it directly from
> shel prompt instead of calling it from another program.
> I have gone through the manual, but can't find anything. Pls help.
>
> Thanks
> Savita.
> ---
> u2-users mailing list
> u2-users@listserver.u2ug.org
> To unsubscribe please visit http://listserver.u2ug.org/
>
> --
> No virus found in this incoming message.
> Checked by AVG Anti-Virus.
> Version: 7.0.300 / Virus Database: 265.8.3 - Release Date: 31/01/2005
>
>
> __
> << ella for Spam Control >> has removed Spam messages and set aside
> Newsletters for me
> You can use it too - and it's FREE!  http://www.ellaforspam.com
>
> --
> No virus found in this outgoing message.
> Checked by AVG Anti-Virus.
> Version: 7.0.300 / Virus Database: 265.8.3 - Release Date: 31/01/2005
> ---
> u2-users mailing list
> u2-users@listserver.u2ug.org
> To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] [AD] UniBasic Program with arguments

2005-02-02 Thread Trevor Ockenden
In short - you can't.

That is, you need to call it from another program... something like...

0001: CALL XYZ (ARG1, ARG2)
0002: END

Depending upon how you have written this routine it may be possible to
call it from a Dictionary item also but that is for another e-mail.

Cheers

Trevor Ockenden
m: 0414 731 634
e:  [EMAIL PROTECTED]

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Chauhan, Savita
Sent: Wednesday, 2 February 2005 9:48 AM
To: u2-users@listserver.u2ug.org
Subject: [U2] [AD] UniBasic Program with arguments

Hi,

I am trying to run a unibasic program (external subroutine) that takes
two arguments.
I don't know how do I pass it the arguments if I run it directly from
shel prompt instead of calling it from another program.
I have gone through the manual, but can't find anything. Pls help.

Thanks
Savita.
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/

--
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.8.3 - Release Date: 31/01/2005


__
<< ella for Spam Control >> has removed Spam messages and set aside
Newsletters for me
You can use it too - and it's FREE!  http://www.ellaforspam.com

--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.8.3 - Release Date: 31/01/2005
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] [AD] UniBasic Program with arguments

2005-02-02 Thread Chauhan, Savita
Thanks all you guys for all your replies. 
This list has come to my rescue so many times. I have so much more to
learn.

I realized that I can run my program (with args) only as one of the
following (without any external utitlity) :
1. as a subroutine (with no args, but can use @COMMAND to read the
command line)
2. as an external subroutine (with args)

If I make it a subroutine, then I cannot call it from another pgm and
pass it args.
If I make external subroutine, I cannot run it from TCL.

Thanks again.

Savita Chauhan, 
Programmer/Analyst
x:1754 Central Texas College.
---
Change is the only Constant.


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Mark Johnson
Sent: Wednesday, February 02, 2005 8:18 AM
To: u2-users@listserver.u2ug.org
Subject: Re: [U2] [AD] UniBasic Program with arguments

Here it is, pretty quickly.

Create a Databasic Program, I call mine PRINT (losing regard for PRINT
being
there). That is a simple program that takes the @COMMAND or PROCREAD or
TCLREAD line you just typed as the first line in a Basic program, throw
an
END at the end, compile and run itself.

Thus, you can have this or virtually any single line program run from
TCL.
This is the absolutely best and simplest method. I use this 100's of
time a
day for testing the OCONV's, simple math, anything. Its only limitation
is
multiple line IF statements or anything with an ELSE.

PRINT ; CALL MY.SUB(ARG1, ARG2, WHATEVER) ; PRINT WHATEVER

PRINT 5+5
PRINT OCONV("12345","DMA")
PRINT ; OPEN "MD" THEN READ X FROM "YOUR.ID" THEN WRITEV "A" ON
"SOMETHING",
2
PRINT ; FOR I=1 TO 15 STEP 2 ; PRINT I,I*11 ; NEXT I

ED MD PRINT
001 PQN
002 HRUN BP PRINT.PROG
003 P

ED BP PRINT.PROG
001 PROCREAD TEST ELSE STOP
OR
001 TCLREAD TEST
OR
001 [EMAIL PROTECTED]
001+ CONVERT CHAR(254) TO " " IN TEST
002 OPEN "BP" TO F.BP ELSE STOP
003 TEST<2>="END"
004 ID="PRINTTT"
005 WRITE TEST ON F.BP, ID
006 EXECUTE "DECATALOG BP ":ID
007 EXECUTE "BASIC BP ":ID
008 EXECUTE "RUN BP ":ID

That's it. I created this in 1978 and have written 2 articles about it,
one
in Datastream and the other for Spectrum. It should be part of the MV
OS.

My 3 cents.

----- Original Message -
From: "Chauhan, Savita" <[EMAIL PROTECTED]>
To: 
Sent: Tuesday, February 01, 2005 5:48 PM
Subject: [U2] [AD] UniBasic Program with arguments


> Hi,
>
> I am trying to run a unibasic program (external subroutine) that takes
> two arguments.
> I don't know how do I pass it the arguments if I run it directly from
> shel prompt instead of calling it from another program.
> I have gone through the manual, but can't find anything. Pls help.
>
> Thanks
> Savita.
> ---
> u2-users mailing list
> u2-users@listserver.u2ug.org
> To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


Re: [U2] [AD] UniBasic Program with arguments

2005-02-02 Thread Mark Johnson
Here it is, pretty quickly.

Create a Databasic Program, I call mine PRINT (losing regard for PRINT being
there). That is a simple program that takes the @COMMAND or PROCREAD or
TCLREAD line you just typed as the first line in a Basic program, throw an
END at the end, compile and run itself.

Thus, you can have this or virtually any single line program run from TCL.
This is the absolutely best and simplest method. I use this 100's of time a
day for testing the OCONV's, simple math, anything. Its only limitation is
multiple line IF statements or anything with an ELSE.

PRINT ; CALL MY.SUB(ARG1, ARG2, WHATEVER) ; PRINT WHATEVER

PRINT 5+5
PRINT OCONV("12345","DMA")
PRINT ; OPEN "MD" THEN READ X FROM "YOUR.ID" THEN WRITEV "A" ON "SOMETHING",
2
PRINT ; FOR I=1 TO 15 STEP 2 ; PRINT I,I*11 ; NEXT I

ED MD PRINT
001 PQN
002 HRUN BP PRINT.PROG
003 P

ED BP PRINT.PROG
001 PROCREAD TEST ELSE STOP
OR
001 TCLREAD TEST
OR
001 [EMAIL PROTECTED]
001+ CONVERT CHAR(254) TO " " IN TEST
002 OPEN "BP" TO F.BP ELSE STOP
003 TEST<2>="END"
004 ID="PRINTTT"
005 WRITE TEST ON F.BP, ID
006 EXECUTE "DECATALOG BP ":ID
007 EXECUTE "BASIC BP ":ID
008 EXECUTE "RUN BP ":ID

That's it. I created this in 1978 and have written 2 articles about it, one
in Datastream and the other for Spectrum. It should be part of the MV OS.

My 3 cents.

----- Original Message -
From: "Chauhan, Savita" <[EMAIL PROTECTED]>
To: 
Sent: Tuesday, February 01, 2005 5:48 PM
Subject: [U2] [AD] UniBasic Program with arguments


> Hi,
>
> I am trying to run a unibasic program (external subroutine) that takes
> two arguments.
> I don't know how do I pass it the arguments if I run it directly from
> shel prompt instead of calling it from another program.
> I have gone through the manual, but can't find anything. Pls help.
>
> Thanks
> Savita.
> ---
> u2-users mailing list
> u2-users@listserver.u2ug.org
> To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


Re: [U2] [AD] UniBasic Program with arguments - utility available

2005-02-01 Thread Cliff Bennett
Hi again, Savita.  Oops.  Solution to wrong problem.  I do have a handy 
program that lets you call any cataloged subroutine with simple args 
(i.e. strings & numbers) from TCL.  It displays the return value of each 
arg afterward.

Let me know if you want a copy emailed to you (or anyone else). Regards, 
Cliff

[previous reply snipped]
Chauhan, Savita wrote:
Hi,
I am trying to run a unibasic program (external subroutine) that takes
two arguments.
I don't know how do I pass it the arguments if I run it directly from
shel prompt instead of calling it from another program.
I have gone through the manual, but can't find anything. Pls help.
Thanks
Savita.
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] [AD] UniBasic Program with arguments

2005-02-01 Thread Bob Woodward
In Universe you can not run a program that is created as an external
subroutine.  That is, any program that has the first executable line as:
SUBROUTINE MYPROG(PARAM1, PARAM2)

If you try to run it, directly or indirectly through a catalog entry in
the VOC you get the following message:

"Cannot RUN a subroutine that has arguments."

If the program does not have arguments, THEN you could use the @SENTENCE
variable to see what other command line options were typed in.

BobW


> -Original Message-
> From: [EMAIL PROTECTED] [mailto:owner-u2-
> [EMAIL PROTECTED] On Behalf Of Cliff Bennett
> Sent: Tuesday, February 01, 2005 4:05 PM
> To: u2-users@listserver.u2ug.org
> Subject: Re: [U2] [AD] UniBasic Program with arguments
> 
> Hi, Savita.  I presume you mean running the program from TCL (:), the
U2
> command prompt.
> 
> In UniData there are two built-in variables, synonyms actually, named
> @SENTENCE and @COMMAND.  These contain the raw command line used to
> invoke your subroutine.
> 
> I usually TRIM this (to eliminate multiple blanks) and then convert
> blanks to a U2 dynamic array delimiter.  I can then count and extract
> these arguments, sort of like argv and argc in C.  A snippet ...
> 
> SUBROUTINE TEST.ARGS
> CMD.LINE = TRIM(@COMMAND)
> CONVERT ' ' TO @AM IN CMD.LINE
> NUM.CMD = DCOUNT(CMD.LINE, @AM)
> SUB.NAME = CMD.LINE<1>
> ARG1 = CMD.LINE<2>
> ARG2 = CMD.LINE<3>
> 
> I believe UniVerse has @SENTENCE also; not sure about @COMMAND.
> 
> Regards, Cliff
> 
> Chauhan, Savita wrote:
> 
> > Hi,
> >
> > I am trying to run a unibasic program (external subroutine) that
takes
> > two arguments.
> > I don't know how do I pass it the arguments if I run it directly
from
> > shel prompt instead of calling it from another program.
> > I have gone through the manual, but can't find anything. Pls help.
> >
> > Thanks
> > Savita.
> > ---
> > u2-users mailing list
> > u2-users@listserver.u2ug.org
> > To unsubscribe please visit http://listserver.u2ug.org/
> ---
> u2-users mailing list
> u2-users@listserver.u2ug.org
> To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


Re: [U2] [AD] UniBasic Program with arguments

2005-02-01 Thread Cliff Bennett
Hi, Savita.  I presume you mean running the program from TCL (:), the U2 
command prompt.

In UniData there are two built-in variables, synonyms actually, named 
@SENTENCE and @COMMAND.  These contain the raw command line used to 
invoke your subroutine.

I usually TRIM this (to eliminate multiple blanks) and then convert 
blanks to a U2 dynamic array delimiter.  I can then count and extract 
these arguments, sort of like argv and argc in C.  A snippet ...

SUBROUTINE TEST.ARGS
CMD.LINE = TRIM(@COMMAND)
CONVERT ' ' TO @AM IN CMD.LINE
NUM.CMD = DCOUNT(CMD.LINE, @AM)
SUB.NAME = CMD.LINE<1>
ARG1 = CMD.LINE<2>
ARG2 = CMD.LINE<3>
I believe UniVerse has @SENTENCE also; not sure about @COMMAND.
Regards, Cliff
Chauhan, Savita wrote:
Hi,
I am trying to run a unibasic program (external subroutine) that takes
two arguments.
I don't know how do I pass it the arguments if I run it directly from
shel prompt instead of calling it from another program.
I have gone through the manual, but can't find anything. Pls help.
Thanks
Savita.
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] [AD] UniBasic Program with arguments

2005-02-01 Thread Bob Woodward
You can not run it directly from the command prompt.  There were a
number of options that were given in this list not that long ago that
would let you test external subroutines but they all require some kind
of priming process. 

BobW


> -Original Message-
> From: [EMAIL PROTECTED] [mailto:owner-u2-
> [EMAIL PROTECTED] On Behalf Of Chauhan, Savita
> Sent: Tuesday, February 01, 2005 2:48 PM
> To: u2-users@listserver.u2ug.org
> Subject: [U2] [AD] UniBasic Program with arguments
> 
> Hi,
> 
> I am trying to run a unibasic program (external subroutine) that takes
> two arguments.
> I don't know how do I pass it the arguments if I run it directly from
> shel prompt instead of calling it from another program.
> I have gone through the manual, but can't find anything. Pls help.
> 
> Thanks
> Savita.
> ---
> u2-users mailing list
> u2-users@listserver.u2ug.org
> To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


Re: [U2] [AD] UniBasic Program with arguments

2005-02-01 Thread Jerry Banker
@SENTENCE, commons, or run the program that calls the subroutine.

- Original Message - 
From: "Chauhan, Savita" <[EMAIL PROTECTED]>
To: 
Sent: Tuesday, February 01, 2005 4:48 PM
Subject: [U2] [AD] UniBasic Program with arguments


Hi,

I am trying to run a unibasic program (external subroutine) that takes
two arguments.
I don't know how do I pass it the arguments if I run it directly from
shel prompt instead of calling it from another program.
I have gone through the manual, but can't find anything. Pls help.

Thanks
Savita.
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] [AD] UniBasic Program with arguments

2005-02-01 Thread Kevin King
You'll have to write a wrapper that translates the two command line
parameters into subroutine arguments. 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Chauhan,
Savita
Sent: Tuesday, February 01, 2005 3:48 PM
To: u2-users@listserver.u2ug.org
Subject: [U2] [AD] UniBasic Program with arguments

Hi,

I am trying to run a unibasic program (external subroutine) that takes
two arguments.
I don't know how do I pass it the arguments if I run it directly from
shel prompt instead of calling it from another program.
I have gone through the manual, but can't find anything. Pls help.

Thanks
Savita.
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


[U2] [AD] UniBasic Program with arguments

2005-02-01 Thread Chauhan, Savita
Hi,

I am trying to run a unibasic program (external subroutine) that takes
two arguments.
I don't know how do I pass it the arguments if I run it directly from
shel prompt instead of calling it from another program.
I have gone through the manual, but can't find anything. Pls help.

Thanks
Savita.
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/