Handling NULLs in fixed-width column sequential file

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
Ravindar
Participant
Posts: 30
Joined: Tue Mar 23, 2004 6:14 am
Location: Chennai, India

Handling NULLs in fixed-width column sequential file

Post by Ravindar »

Hi all,

I have a fixed-width sequential file (say A.txt)

The data structure is:

columnname|length
----------------------
empno|2
empname|10

Value which I stored is:

01Ravindar**
02Vivek*****

I am using a sequential file stage to read this file.

My required output from the SF stage is a valid value for each column(means those *s should be truncated)

My question is:
How to do this in a sequential file stage?

Note:I know this can be done easily through a transformer.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Try setting the 'default padding' character in the Sequential File Stage to a "*".
-craig

"You can never have too many knives" -- Logan Nine Fingers
Ravindar
Participant
Posts: 30
Joined: Tue Mar 23, 2004 6:14 am
Location: Chennai, India

Post by Ravindar »

I had tried it but it is not working.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You want to Trim the "*" characters. Or you can convert them to "". In column derivation expressions in a Transformer stage use either of the following:

Code: Select all

Trim(InLink.empname, "*", "T")

Convert("*", "", InLink.empname)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Had you been on UNIX you would have had another possibility, to use tr as a filter command in your Sequential File stage.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Ravindar
Participant
Posts: 30
Joined: Tue Mar 23, 2004 6:14 am
Location: Chennai, India

Post by Ravindar »

Again I have follwoing doubts in SF stage.

What is the need for Missed column action when I am going to use fixed-width sequential file.(I think u can't find whether a column is missing when reading a fixed-width column sequential file.

How the Default padding and default NULL string is working when I am trying to read a fixed-width sequential file.

Plz help me with an example so that I can check it in my job.
Sreenivasulu
Premium Member
Premium Member
Posts: 892
Joined: Thu Oct 16, 2003 5:18 am

Post by Sreenivasulu »

Ravindar,

Use the EREPLACE function. With this you can replace * will "null"

Regards
Post Reply