Page 1 of 1

How to count the number of letters in a register

PostPosted: Fri Feb 21, 2014 8:48 pm
by andersoncarboni
Hy,

i need to insert a field in a DB2 VARCHAR field, but is necessary know the size of field before insert the data.

My input file has the following data:
[img]
sort.JPG
[/img]


I need count the number of caracters of the string that begins in position 41 without the spaces, in this case the answer will be 18.

thank for the help

Re: How to count the number of letters in a register

PostPosted: Fri Feb 21, 2014 10:07 pm
by dick scherrer
Hello and welcome to the forum,

Please do NOT post images - they are more difficult to work with and waste considerable forum space. To get the desired result, use copy/paste and the Code tag.

How did you arrive at 18? Did you mean 31 rather than 41? What is the max length?

Re: How to count the number of letters in a register

PostPosted: Fri Feb 21, 2014 10:48 pm
by NicC
Actually, I make it 8 - 'anderson'

Re: How to count the number of letters in a register

PostPosted: Fri Feb 21, 2014 11:04 pm
by BillyBoyo
Fixed-length or variable-length records? The techniques are different, so need to know.

Re: How to count the number of letters in a register

PostPosted: Mon Feb 24, 2014 3:58 pm
by andersoncarboni
Sorry for post images, it's my first time here...
In really the character begin in position 31 and not in the 41. The Max Length is 300
Billy Boo it's fixed-length.

Thank for all

Re: How to count the number of letters in a register

PostPosted: Mon Feb 24, 2014 5:09 pm
by BillyBoyo
Have a look at this one, it should have enough in it: dfsort-icetool-icegener/topic8981.html#p43880

Re: How to count the number of letters in a register

PostPosted: Tue Feb 25, 2014 4:29 pm
by andersoncarboni
BillyBoyo wrote:Have a look at this one, it should have enough in it: dfsort-icetool-icegener/topic8981.html#p43880


thanks for the example, I've done here and it worked correctly

Re: How to count the number of letters in a register

PostPosted: Tue Feb 25, 2014 5:34 pm
by BillyBoyo
Good work. Thanks for letting us know. Can you post the code you used, as it may help others in the future.