Or... 
0001       VERB="TRY"   ;* Or whatever you called this program
0002       SENT=@SENTENCE
0003       PTR=INDEX(SENT,VERB,1) ; LLEN=LEN(SENT)-PTR-LEN(VERB)
0004       SENT=SENT[PTR+LEN(VERB)+1,LLEN]
0005 * 
0006       F.FILE=FIELD(SENT," ",1) ; LLEN =LLEN-LEN(F.FILE)-1
0007       SENT=SENT[LEN(F.FILE)+2, LLEN]
0008 * you now have a clean sentence...
0009       CRT DQUOTE(F.FILE)
0010       CRT DQUOTE(SENT)
0011 *
0012    END
... david ...

David L. Wasylenko
President, Pick Professionals, Inc
w) 314 558 1482
d...@pickpro.com


-----Original Message-----
From: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Wjhonson
Sent: Friday, August 24, 2012 5:55 PM
To: u2-users@listserver.u2ug.org; donr_w...@yahoo.com
Subject: Re: [U2] Variable Interpolation


Oops there's a bug.
Right after the line that starts OFFSET += 1 should be yet another OFFSET += 1 
so the corrected version should read

       IF VERB = 'RUN' OR VERB = 'RAID' THEN
          OFFSET += 1 ; N.FILE = FIELD(SENT,' ',OFFSET)
          OFFSET += 1
       END ELSE OFFSET += 2 ; N.FILE = 'BP'


-----Original Message-----
From: Wjhonson <wjhon...@aol.com>
To: donr_work <donr_w...@yahoo.com>; u2-users <u2-users@listserver.u2ug.org>
Sent: Fri, Aug 24, 2012 3:40 pm
Subject: Re: [U2] Variable Interpolation



FFT.BP 'TRY' BASIC 27 lines  Level: 9
 *
 * Run any BASIC code typed at TCL
 * Writen Aug 2012 by Will Johnson based on a comment by Don Robinson
 * Released under CC-BY-2.0 license
 *
       SENT = @SENTENCE
       OFFSET = 1 ; VERB = FIELD(SENT,' ',OFFSET)
       IF VERB = 'RUN' OR VERB = 'RAID' THEN
          OFFSET += 1 ; N.FILE = FIELD(SENT,' ',OFFSET)
       END ELSE OFFSET += 2 ; N.FILE = 'BP'
       OPEN N.FILE TO F.FILE ELSE
          DISPLAY 'Cannot open file "':N.FILE:'"'
       END
       OFFSET += 1 ; WHAT = FIELD(SENT,' ',OFFSET) ; C.WHAT = COL2()+1
       L.SENT = LEN(SENT) ; WHAT = SENT[C.WHAT,L.SENT]
       WRITE WHAT:@AM:"END" ON F.FILE,'TRYCODE'
       EXECUTE 'BASIC ':N.FILE:' TRYCODE'
       EXECUTE 'RUN ':N.FILE:' TRYCODE'
 *
    END



-----Original Message-----
From: Don Robinson <donr_w...@yahoo.com>
To: U2 Users List <u2-users@listserver.u2ug.org>
Sent: Fri, Aug 24, 2012 12:20 pm
Subject: Re: [U2] Variable Interpolation


Guys,
 
I may be way off base but I have a program that takes basic code from the 
command line, compiles and runs it.
 
For example:
 >01 RUNBASIC CRT SYSTEM(2) ; CRT SYSTEM(3) 
 >====================================================
79
24
>
 
RUNBASIC is the program and CRT SYSTEM(2) ; CRT SYSTEM(3) is the code in this 
example. 79 and 24 are the answers.
 
The string of = signs are just for looks.
 
This could be EXECUTEd from within a program but why?
It is quite handy for testing bits of code at TCL and might be useful in a proc.
 
RUNBASIC will do anything you can do with one line of code using ; to separate 
statements including FOR ... NEXT and LOOP ... REPEAT.
 
Code is free as long as you don't critisize it.
 
Don Robinson

From: Wjhonson <wjhon...@aol.com>
To: u2-users@listserver.u2ug.org
Sent: Friday, August 24, 2012 1:38 PM
Subject: Re: [U2] Variable Interpolation


The impression I get from this thread is something like

Oh I've just read on the HELP pages that System(2) tells me the width of my CRT 
screen.
Let me ask my process what it has as the value for System(2).
Oops I have to write a program just to tell me that.... that's too much trouble.
Why can't it just have a way to *tell* me ?


Why!!!!




-----Original Message-----
From: Martin Phillips <martinphill...@ladybridge.com>
To: 'U2 Users List' <u2-users@listserver.u2ug.org>
Sent: Fri, Aug 24, 2012 10:11 am
Subject: Re: [U2] Variable Interpolation


Hi,

I am intrigued by this thread, mostly because I have not understood why I would 
want it.

If I can write
  CALL @"SUB FOO(X,Y);Y=X+1;RETURN"( 3, VAL )
as suggested, why don't I just write the code inline in my program. What have I 
missed?


Martin Phillips
Ladybridge Systems Ltd
17b Coldstream Lane, Hardingstone, Northampton NN4 6DB, England
+44 (0)1604-709200

_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users
_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users

 
_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users

 
_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users
_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users

Reply via email to