Author Topic: When "WHEN" does not work in UniData  (Read 4403 times)

DonQuixote

  • Rock Star
  • *****
  • Posts: 204
  • To Dream the Impossible Dream...
When "WHEN" does not work in UniData
« on: October 12, 2012, 12:58:25 PM »
I had worked in UniVerse for years and when I switched to UniData v6.1.8  I was sad that the selection command using WHEN did not work.
example in UniVerse
SORT OAP.HIST BY-EXP GL.NUM WHEN GL.NUM = "5353"  GL.NUM
you would get a list of records IDs exploded out with only displaying GL 5353

In UniData you get  "Illegal attribute name: WHEN" 
But there is a way   :D

SORT OAP.HIST BY-EXP GL.NUM = "5353"  GL.NUM

But a warning, if you are doing a series of selects this would have to be the last one.

I've been doing 'work arounds' for this little command,  so for me a big discovery.   I don't see it in the manuals.   Hope this can help others.   ;D

Tom Pellitieri

  • Rock Star
  • *****
  • Posts: 224
  • Tom Pellitieri - Toledo, Ohio
Re: When "WHEN" does not work in UniData
« Reply #1 on: October 16, 2012, 09:55:29 AM »
The WHEN option is available in UniData - it just doesn't work by default under SB+

For compatibility reasons, SB+ requires ECLTYPE P (Pick) to be set.  The WHEN Keyword only works under ECLTYPE U (UniData).

In a /PD Shell Process (either >Shell Statements with /PD.SHL or SHell Wrapper with /PD.H), you can specify ECLTYPE U.  At the SB+ TCL prompt, you can use the lower-case keyword to get ECLTYPE U as well, e.g.,

sort OAP.HIST BY GL.NUM WHEN GL.NUM = "5353" GL.NUM

Note - I had to delete an outdated SORT entry in xxPROCESS to have this work.  You can use "list" instead of "sort" as well.