File Reading

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
wong_ricky
Participant
Posts: 5
Joined: Fri Feb 22, 2008 9:36 am

File Reading

Post by wong_ricky »

I have trouble reading a simple text file that the first line contain blanks but the subsequent rows (line) have records. How do I tell Datastage to ignore the first blank line? I tried to check the box for first line is column names in the format tab of the output which I thought by checking the box it would ignore the first line but I got the error saying read_delimited() row 1 column X , required column missing..Any suggestions or help would be much appreciated.
throbinson
Charter Member
Charter Member
Posts: 299
Joined: Wed Nov 13, 2002 5:38 pm
Location: USA

Post by throbinson »

Activate filtering and put this filter in;
awk '$NF != 1'

This will skip the first line of the file.
sachin1
Participant
Posts: 325
Joined: Wed May 30, 2007 7:42 am
Location: india

Post by sachin1 »

Hello throbinson, please may i know how is it for windows system.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Usually you can install UNIX commands with MKS Toolkit or a similar product. In your case just fool DataStage and, in the sequential stage, state "File has column headers" so the first line is skipped.
sachin1
Participant
Posts: 325
Joined: Wed May 30, 2007 7:42 am
Location: india

Post by sachin1 »

yes thats very fine if my first line is blank in any case if i have subsequent blank lines, need to suppress those lines for processing in windows.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

That was not a part of your original specification!

Why not write a little routine to pre-process the file, to remove all the totally blank lines? This can be executed, for example, as a before-job subroutine, and the job reads its result (a different, but associated, file name).
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
throbinson
Charter Member
Charter Member
Posts: 299
Joined: Wed Nov 13, 2002 5:38 pm
Location: USA

Post by throbinson »

I think the OP wong_ricky said that checking the checkbox saying the first line is column headers requires that the first line still be formatted correctly. That is, contain the right number of delimiters. I assume that is correct. Is it? A blank line isn't formatted according to the file schema. Sachin I think highjacked the post and so don't need no stinkin' specifications. You're on your own for Windows functionality.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

throbinson wrote:I think the OP wong_ricky said that checking the checkbox saying the first line is column headers requires that the first line still be formatted correctly. That is, contain the right number of delimiters. I assume that is correct. Is it? A blank line isn't formatted according to the file schema.
Yes, that is correct.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Checking "first line is column names" makes DS skip that line - regardless of contents or format.
If you have multiple empty lines then pre-process as Ray suggested. You can even do a simple UNIX "sed '/^$/d' InFile.txt >OutFile.txt"
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Hmmm... I really don't think that's true Arnd. It still has to be read. :?

I believe a small test is in order.
-craig

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