Page 1 of 1

How to count variable lenght record with column type binary

Posted: Thu Oct 11, 2007 6:15 am
by BrianDS
How to count the bytes in a variable length record in a parallel job in v7.5, when the input sequenial file has record level and record type set as varying when column type binary?

Posted: Thu Oct 11, 2007 2:45 pm
by ray.wurlod
Welcome aboard.

Why do you want to do this? The Len() function will return the number of characters in a string, which will be the same as the number of bytes if you are using a single-byte character set. Simply (temporarily if necessary) convert the binary to a string data type first.

If you have NLS enabled, then you might need to investigate the ByteLen() function. This is only available in the BASIC Transformer stage as far as I am aware.

Posted: Fri Oct 12, 2007 6:39 am
by BrianDS
Thanks for the welcome!, Our tricky part is that we are downloading a Mainframe File which first 11 columns are fixed length columns, then the 12th column is a variable length column.(data in last column is not consistent in length and type is binary). In DataStage the LEN function has not worked for us in this scenario.

Our requirement is to read the file and count the fixed and variable length then put total length for that record in a new column.



(FL + VL) , FL, VL
the first column above is the new column total count, the next (FL) is the 11 fixed length columns and the last(VL) is the variable lenght column.

If more detail required please provide e-mail and we can send DataStage screen shots.

Posted: Fri Oct 12, 2007 7:03 am
by chulett
BrianDS wrote:In DataStage the LEN function has not worked for us in this scenario.

What exactly doesn't work about it? Can you provide some specific examples? Is NLS enabled or are you using something other than a single-byte character set?

BrianDS also wrote:If more detail required please provide e-mail and we can send DataStage screen shots.

There are plenty of free hosting sites available for images of any type. Upload them there and then post a link to them here, if you really think it would help. Most will automatically create the forum tags for you as well.