If you read the article I wrote for Spectrum within the last 2 years and for
Datastream in the early 1980's, I have a very powerful quick way to do this
and virtually every databasic thing from tcl. It eliminates all of the
stupid 3-5 lines 'test' programs that clutter so many of my client's
systems.
It borrows from Dartmouth Basic where their TCL was always in 'Basic' and
not outside of it (interpeted). It is so damn simple that it should come
with all flavors of the MV databases.
I call it PRINT and will summarize it here and offer any reprints of the
Spectrum Article. It basically takes the entire TCL line and considers it a
databasic program. Here it goes:
EDIT MD PRINT (Hopefully new item)
NEW ITEM
001 PQN
002 HRUN BP PRINT
003 P
EDIT BP PRINT (Unidata version. D3 should use TCLREAD and MCD should use
PROCREAD)
NEW ITEM
***
* PRINT SINGLE LINE PROGRAM
* MAJ 010281
***
[EMAIL PROTECTED]
OPEN "BP" ELSE STOP
DELETE "%PRINT%"
DELETE "_%PRINT%"
CONVERT CHAR(254) TO " " IN TEST
WRITE TEST ON "%PRINT%"
EXECUTE "BASIC BP %PRINT%"
PRINT
EXECUTE "RUN BP %PRINT%"
END
So you can type
PRINT 5+5
or
PRINT OCONV("12345","MTHS")
or
PRINT ; FOR I=1 TO 10 ; PRINT I,I*10 ; NEXT I
or for the sake of this original posting:
PRINT ; CALL SUBROUTINENAME(VAL1, VAL2, VAL3)
Anything that can be written on a single line of basic code will work. The
word PRINT is simply the VOC verb to process the rest of it.
2 Caveats:
1. You cannot have an active list as my program processes some other TCL
commands that may cause the list to be mis-processed.
2. Be careful of any hanging ELSE or THEN statements as everything is on one
line.
Here's an example of working forward in an ELSE environment.
PRINT ; OPEN "MD" TO F.MD THEN READ REC FROM F.MD, "FRED" THEN REC<3>="BOB"
; WRITE REC ON "BILL"
This is probably my most favorite utility as I am constantly testing for
tiny code snippets.
Hopefully this works for many of you.
Mark Johnson
----- Original Message -----
From: "Shawn Waldie" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, October 15, 2004 6:59 PM
Subject: [U2] [UD] running a subroutine
> Wondering if there is a way to execute a subroutine from the colon
> prompt.
>
> Let's say I have a subroutine that is defined as having 2 input args
> like:
>
> SUBROUTINE subr.name(arg1,arg2).
>
>
> I would like to test it from the colon prompt without having to
> hard-code the values of arg1/arg2...something like:
>
> :RUN BP subr.name "value.of.arg1" "value.of.arg2"
>
> Is something like this possible? What I've tried so far hasn't worked.
>
> ************************************************
> * Shawn Waldie San Juan College *
> * Programmer/Analyst 4601 College Blvd *
> * Phone: (505)566-3072 Farmington, NM 87402 *
> * email: [EMAIL PROTECTED] *
> * *
> * HP-UX 11.11 UniData 6.0.4 Colleague R17 *
> ************************************************
> -------
> u2-users mailing list
> [EMAIL PROTECTED]
> To unsubscribe please visit http://listserver.u2ug.org/
-------
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/