LeRoi,

Your interpretation is mostly right.

UniVerse allows syntax "@ID[1]" instead of "@ID[LEN(@ID),1]" for "the
last character of @ID".
You are using that in some but not other of the formulas.  To simplify a
bit
*  the 2-part file could be "@ID[1]; IF @1 LT 5 THEN 1 ELSE 2", and
*  the 10-part "INTERNAL @ID[1]+1"

For consistency alone, you could use the same syntax for all these types
of distribution:
"@ID[1]; IF NUM(@1) THEN MOD(@1,<number of parts>)+1 ELSE <dumping
ground>"
Although the use of CONVERT does allow specific numbers to be spread
amongst specific parts
E.g. 4-part "@ID[1]; IF NUM(@1) THEN MOD(@1,4)+1 ELSE 2"
Note that this gives a different distribution, though!

And part files start with 1, not 0: your last example is "INTERNAL
"@ID[LEN(@ID),1]+1" - note the '+1' on the end, giving a part number
from (0+1) to (9+1) i.e. 1 to 10


Hope this helps


Mike

-----Original Message-----
> From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of LeRoi Keiller
> Sent: Tuesday, 7 September 2004 13:39
> To: U2-Users (E-mail)
> Subject: [U2] Part file algorithms - am I correct?
> 
> Hi
> 
> I've been trying to make sense of part file algorithms for some
distributed file work 
> I'm doing.  In so doing, I've come up with the following
"micro-explanations" and examples.
> 
> Can anyone in the know please say whether the following is correct?
...
> 
> 
> If a file has [EMAIL PROTECTED] records consisting mainly of numbers (or more
specifically, 
> ending with a number), algorithms like the following can be used to
spread 
> incoming data across the parts:
> 
> For a...
> 
> 2-part file:  "INDEX('01234',@ID[LEN(@ID),1],1); IF @1 THEN 1 ELSE 2"
>   (Records ending 0-4 go into one file, all else (eg 5-9) go into the
other)
> 
> 4-part file:  "@ID[1]; IF NUM(@1) THEN
CONVERT("0123456789","1122333444",@1) ELSE 2"
>   (A compromise, as the 10 digits (0-9) don't go evenly into 4 groups
or parts.)
>   (The ELSE 2 just puts anything non-conforming into part 2)
> 
> 5-part file:  "@ID[1]; IF NUM(@1) THEN
CONVERT("0123456789","1122334455",@1) ELSE 1"
>   (Puts records ending 0-1 into part 1, records ending 2-3 into part
2, etc.)
>   (All else, ie non-numeric, go into part 1.)
> 
> 10-part file: "INTERNAL "@ID[LEN(@ID),1]+1"
>   (Looks to me like this simply puts records ending 0-9 into the
same-numbered part 
>   file, ie  records ending with 0 go into part 0.  CAUTION: Obviously
this means the 
>   part files must start  their numbering from 0.)
>
> 
> Thanks,
> LeRoi
> 
> LeRoi Keiller
> Technical Support
> 
> Ultradata - Vision to Reality
> +61 3 9291 1700
> www.ultradata.com.au
-------
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/
The information contained in this Internet Email message is intended
for the addressee only and may contain privileged information, but not
necessarily the official views or opinions of the New Zealand Defence Force.
If you are not the intended recipient you must not use, disclose, copy or 
distribute this message or the information in it.

If you have received this message in error, please Email or telephone
the sender immediately.
-------
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to