Page 1 of 1

Increment a number by 11 only !

PostPosted: Fri Oct 16, 2015 9:30 am
by ranga_subham
Need help on the below requirement -

I have a 12 digit number in that last 5 digits has to be incremented by +11. This needs to happen 10,000 times. Is there a way to do it using sort.
I am giving a example below -

12345678911 == example for first number based on this it should increment by 11 and generate 10, 000 numbers.
12345678922 == next number incremented by 11 (11 + 11 = 22)
12345678933 == next number incremented by 11 (22 + 11 = 33)
----
----

Please help.

Thanks.

Re: Increment a number by 11 only !

PostPosted: Fri Oct 16, 2015 11:46 am
by BillyBoyo
If there is only one record on your dataset, look at OUTFIL REPEAT= and SEQNUM on OVERLAY in your documentation.

If you have more than one record, please clarify your question.

Re: Increment a number by 11 only !

PostPosted: Fri Oct 16, 2015 12:10 pm
by ranga_subham
Hi,

Nice Idea. Thanks.
Yes. Dataset has only one record (12345678911). how to use overlay in this situation please?

Thanks.

Re: Increment a number by 11 only !

PostPosted: Fri Oct 16, 2015 1:10 pm
by BillyBoyo
OK, the OVERLAY is quite easy. The next problem, though is that 10,000 times 11 gives a six-digit result, and you only want to change five digits. The answer to that impacts the detail of the OVERLAY.

Re: Increment a number by 11 only !

PostPosted: Mon Oct 19, 2015 9:33 am
by ranga_subham
Hi,

Thanks again. I won't mind to limit it to 9999 times to avoid this risk factor.

Re: Increment a number by 11 only !

PostPosted: Mon Oct 19, 2015 11:37 am
by BillyBoyo
10,000 * 11 = 110,0000
9,999 * 11 = 10,9989
9,090 * 11 = 99.990

Even taking 9,090, unless the current number starts with nnn00000 to nnn00009 it will overflow the five low-order digits.