Part file numbers must be strictly positive; part number 0 is illegal.
You may find the MOD function better, for example for five parts 1+MOD(@ID[1],5)
If the final key character is non-numeric (or even if it's numeric), add a SEQ
function, for example for five parts 1+MOD(SEQ(@ID[1]),5)
----- Original Message -----
From: "LeRoi Keiller" <[EMAIL PROTECTED]>
Date: Tue, 7 Sep 2004 11:38:59 +1000
To: "U2-Users (E-mail)" <[EMAIL PROTECTED]>
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/
-------
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/