Page 1 of 1

Handling NULLs in fixed-width column sequential file

Posted: Tue Jun 22, 2004 9:20 am
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.

Posted: Tue Jun 22, 2004 10:05 am
by chulett
Try setting the 'default padding' character in the Sequential File Stage to a "*".

Posted: Wed Jun 23, 2004 12:02 am
by Ravindar
I had tried it but it is not working.

Posted: Wed Jun 23, 2004 12:17 am
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)

Posted: Wed Jun 23, 2004 12:18 am
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.

Posted: Wed Jun 23, 2004 2:25 am
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.

Posted: Wed Jun 23, 2004 5:29 am
by Sreenivasulu
Ravindar,

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

Regards