How to count variable lenght record with column type binary

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
BrianDS
Participant
Posts: 2
Joined: Mon Apr 03, 2006 7:28 am

How to count variable lenght record with column type binary

Post 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?
ray.wurlod
Participant
Posts: 54595
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
BrianDS
Participant
Posts: 2
Joined: Mon Apr 03, 2006 7:28 am

Post 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.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply