[Date Prev][Date Next][Subject Prev][Subject Next][
Date Index][
Subject Index]
Re: XPL questions
- Subject: Re: XPL questions
- From: Carl Distefano cld@xxxxxxxx
- Date: Sun, 12 Mar 2006 15:08:40 -0500
Reply to note from "Patricia M. Godfrey" Sat,
11 Mar 2006 19:03:33 -0500
Patricia:
> How come U2 repeatedly uses ≪sx01,≪IS50≫≫, but when I try
> it I'm told "SX requires a number"? (Yes, I've read
> PARSEFRM.DOC, but I'm still not sure if I have to call some
> other frame to get what is typed on the CommandLine into SG 50;
> TESTPRS doesn't seem to, but...)
What do you mean by "get[ting] what is typed on the CommandLine into
SG 50"? What are you trying to do in your code? Several
possibilities come to mind. Do you want to:
1) Stuff the contents of the CMline -- whatever happens to be there
-- into a S/G?
2) Capture user input that is typed on the CMline at runtime?
3) Pass the contents of the CMline to a U2 routine as an argument?
4) Execute the current CMline as FRAMENAME ARGUMENT?
Remarks:
1) Stuff the CMline into a S/G
As Robert explained, the convention we've adopted for U2 is that
_arguments_are_passed_to_U2_frames_ via S/G 50. Not all of "what is
typed on the CMline", only the argument portion; the command portion
(the first word of the sentence) must be parsed away. But if your
code isn't calling a U2 frame as a child process -- if all you want
to do is capture the current contents of the CMline and manipulate
it yourself -- there is no need to use S/G 50. The following, for
example, puts the current CMline into S/G 02:
.
You can then do what you like with S/G 02.
2) Capture user input typed on the CMline
Here, again, there is no need to use S/G 50. You can concatenate
'd or 'd keystrokes into any Save/Get. There is a generic
U2 frame, GetCMinput, that will capture user keystrokes typed on the
CMline to a S/G. As it happens, GetCMinput saves that input to S/G
50; there are good reasons for this choice, as you'll see when you
read example 3) below. The usage is
JM 2.GetCMinputQ2 . For example,
JM 2.GetCMinputQ2 ;*;
When the user presses Enter, the contents of the CMline (i.e., what
the user typed) are saved to S/G 50. You can then proceed as you
like. For example, to issue a PRompt that confirms what
the user entered: .
3) Pass the _entire_ CMline to another U2 frame as an argument
This is a variant of 1). But here, since you're passing data (an
argument) to a child frame, it IS necessary to use S/G 50:
JM 2.childframeQ2 . See that? SUb 01
puts the CMline (the *entire* CMline) into S/G 50, then childframe
operates on it. But it can also be a variant of 2) -- if the
argument that is passed to childframe is to be supplied by the user
at runtime. So, for example, you might have:
JM 2.GetCMinputQ2 ;*;
JM 2.reverseQ2 ;*; String in 50 is reversed and restuffed into 50
.
4) Execute the current CMline as FRAMENAME ARGUMENT
This one's easy. Frame PrsCMline, the frame, does it. In
XPL, you call it with JM 2.PrsCMlineQ2 . The other Prs* frames do
exactly the same thing; the only difference is the source of the
input. For example, JM 2.PrsDeFineQ2 executes the current DF block
_as though_ it were typed on the CMline and launched with .
Or are you asking....
5) None of the above?
--
Carl Distefano
cld@xxxxxxxx