views:

353

answers:

2

I'm new to the world of UniObjects as I've been in .NET land since it debuted. After building a simple app to return the select list of a UniCommand statement I noticed that there are some major differences in how UniData and how UniObjects parses the UniCommand statments. From what I've found it looks like it is differences in the flavors of PICK used.

What I'm asking is for other UniObjects programmers (UniVerse or UniData) that know of the differences or know of commands that can be executed to list them here. I'm asking this because the documentation of what can and cannot be a command is very hard to find.

Here is an example: (both return the same results from the same source)

What we would enter into UniData: (parser error if given in UniCommand)

  • SELECT COLORS = "BLU]"

What should be entered into UniObject's UniCommand:

  • SELECT COLORS WITH @ID LIKE "BLU..."

Notice how UniData's wildcard is "]" (square bracket) where UniCommand is the "..." (elipsis). Also notice how UniData accepts the equality operator and how UniCommand uses the LIKE operator and WITH.

Also if anyone has a link to a document on all the commands available, they can post it here as well.

+2  A: 

The problem is that your Unidata environment is set up to parse commands with the PICK parser, but the UniCommand object is executing Unidata's native parser. (The LIKE and ... syntax is from Unidata's native mode, which is modeled from Prime Information.)

I looked for a property on UniSession or UniCommand that would change the parser that's used for the Execute method, but didn't find one. However, the documentation of UniCommand says that it is equivalent to the EXECUTE basic statement. This, and a few UDT.OPTIONS commands, may open the door for a workaround that will let you use PICK command syntax even though UniObjects doesn't support it directly.

Unidata's EXECUTE command can take multiple commands, separated by @AMs, and will execute them one after another, returning only after all have been processed. (It's sort of like a mini-proc.) So, build your command with at least a "UDT.OPTIONS 2 ON" command in attribute 1, followed by any others that you may need, and finally your desired PICK command in the last attribute. Then send the whole bunch at once via your UniCommand object's Execute method.


The docs for UDT.OPTIONS 2 is as follows:

Determines the parser the system uses to interpret UniQuery commands.
    ON System uses the Pick® parser.
    OFF System uses the UniData parser.

There are several other UDT.OPTIONS related to PICK compatibility. Look in the docs, specifically udto.pdf, in the "Pick® Compatibility" section.


All that said, when I've use UniObjects, I've only used it to call basic subroutines, and handle everything else in server-side routines.

EDIT: C# code sample

UniSession s = UniObjects.OpenSession("machine", "user", "password", "/path/to/account", "udcs");
UniCommand c = s.CreateUniCommand();
c.Command = "UDT.OPTIONS 2 ON" + "\xfe" + "SELECT COLORS = \"BLU]\"";
c.Execute();

The "\xfe" is the attribute mark. (That's CHAR(254) in Pick-speak.) Hope this helps.

JeffK
I don't seem to have the udto.pdf. Is that in the UniData Client Tools or is that downloaded from the web? What you say does make since and I too could not find a way using UniObjects to change the parser. We're not moving away from UniData but holy cow talking about lock in as the documentation is hard to find.
thames
I have gone through the UniData's UniBasic Reference Guides from 1993 however their syntax is the one we've been using. (from my knowledge and from what I've asked around)
thames
BTW when I use @AM UniObjects says it isn't a verb. Also, when I go into the terminal to UniData it also says the same thing. Maybe it isn't correct syntax? I also do not see it in the reference book mentioned above.
thames
The docs were placed on our network share by our sysadmins. I don't know where to find them on the distribution CDs. Oh, and I just wasted 10 minutes trying to find the docs on IBM's website. That's a horrible site: search doesn't work, and even when it displays results, the links are dead. Embarrassing. I know they are there somewhere, which doubles the frustration.I'll work up a code sample and edit my answer.
JeffK
When did this go community wiki? Seems like a legit question to me.
JeffK
That was me accidentally when I created the question. If someone can change it from a Wiki that would be good. I did try yours and it executed like "UDT.OPTIONS 2 ONþSELECT IR = \"BLU]\"". I did however change the \xfe to Convert.ToChar(254). Still doesn't work. Parser error at "=" sign.
thames
Note: I did first try it as \xfe and then the Convert.ToChar(254) both produced the same result and both didn't work.
thames
Yeah, it doesn't work. Interestingly, doing the same thing from a basic program in a terminal doesn't work either, in that the parser still throws the error, but the ECLTYPE **is** actually changed: immediately entering the exact same command at the ":" prompt then works correctly. Yet, running the program that executes it still fails. Very weird. I think you're stuck with learning the native Unidata syntax. It's really not that bad. Good luck!
JeffK
Thanks for the help. Just need to find the documentation for the native UniData syntax as all the UniData books we have does not have this syntax.
thames
I wonder if UniData changed to a "native UniData" syntax AFTER (1993) we purchased UniData because ALL of the books we got with the UniData purchase does not contain the syntax that is wanted by UniObjects. Is there any documentation/pdf/site/etc that is available to see what this syntax is?
thames
Isn't it funny what difference a day makes? I immediately found the link to the documentation on IBM's website today, after not being able to find a thing yesterday...http://www-01.ibm.com/software/data/u2/pubs/library/
JeffK
In my Stackoverflow question on where to download "UniObjects", I mentioned how horrible the IBM site is and how hard it is to find something twice! IBM really needs figure out a better site design and the ability to find documents/downloads/etc. a lot easier.
thames
+2  A: 

The differences you are describing are differences in ECLTYPE in UniData which is completely independent of UniObjects. If you set your UniData account's ECLTYPE to "U" it will accept the syntax:

SELECT COLORS WITH @ID LIKE "BLU..."

If you set the ECLTYPE to "P" it will accept the syntax:

SELECT COLORS = "BLU]"

The UniObjects for .NET documentation states:

"On UniData systems, ECLTYPE U is best. You may encounter variations with other ECLTYPE or UDT.OPTIONS settings."

It's not clear to me from the documentation whether UniCommands are invariably executed using ECLTYPE "U" or whether there is a parameter to let you configure the parser type. You could try executing an ECLTYPE "P" command from your UniObjects session and then see whether subsequent UniCommands with "P" syntax are parsed as such.

Rob Sobers
I did try to execute ECLTYPE "P" inline with SELECT COLORS = "BLU]" as well as seperate statements without much luck. UniObjects must have its own parser??
thames