How to get out the Null row in a 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

shrek7577
Participant
Posts: 62
Joined: Thu Sep 28, 2006 6:53 am
Location: France, Paris

Post by shrek7577 »

The file has 17 columns.
In the bottom, there is a copy/paste of 5 rows

=============
;3247970;1;1;415;0;1;2;1;1901,55;0;26,74;0;0;0,88;30;56,74
;3248231;1;1;415;0;1;2;1;1866,72;0;33,39;52,4;0,19;1,24;30;115,98
;3248651;1;1;415;0;1;2;1;6533,54;0;116,86;175,62;0,65;4,22;30;323,13
TOTAL CEPME ;;;;;;;;;21441638,65;116531,57;1397625,56;310038,34;1982,58;97040,82;75297,71;1784944,19
;;;;;;;;;;;;;;;;
=============
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

That looks fine to me. It has 17 columns which means 16 delimiters(;). Make sure your specifying ; as the delmiter.
Also to take care of missing rows, go to the columns tab and for the first column specify YES to "Contains Terminators". This will enable the stage to read the file. In the constraint of the transformer, check for length > 0 of a column that cannot be null.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
shrek7577
Participant
Posts: 62
Joined: Thu Sep 28, 2006 6:53 am
Location: France, Paris

Post by shrek7577 »

Thanks DSguru2B for your help !
:P

But, if the line is NULL (The 2nd row is null : no value, no separator) :

=============
;3247970;1;1;415;0;1;2;1;1901,55;0;26,74;0;0;0,88;30;56,74

;3248651;1;1;415;0;1;2;1;6533,54;0;116,86;175,62;0,65;4,22;30;323,13
TOTAL CEPME ;;;;;;;;;21441638,65;116531,57;1397625,56;310038,34;1982,58;97040,82;75297,71;1784944,19
;;;;;;;;;;;;;;;;
=============

What would you do ?
narasimha
Charter Member
Charter Member
Posts: 1236
Joined: Fri Oct 22, 2004 8:59 am
Location: Staten Island, NY

Post by narasimha »

Try this

Input file - in.txt

Code: Select all

Data1;Data2;Data3

Data4;Data5;Data6
Data7;Data8;Data9

Data10;Data11;Data12

Use this

Code: Select all

findstr /v /r "^$" in.txt
Output

Code: Select all

Data1;Data2;Data3
Data4;Data5;Data6
Data7;Data8;Data9
Data10;Data11;Data12
Narasimha Kade

Finding answers is simple, all you need to do is come up with the correct questions.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Thats a good solution narasimha. Shrek7577, put narasimha's command (just the findstr /v /r "^$") in the filter command after enabling "Stage uses filter commands" in the sequential file stage. That will work for getting rid of the blank lines.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
shrek7577
Participant
Posts: 62
Joined: Thu Sep 28, 2006 6:53 am
Location: France, Paris

Post by shrek7577 »

Thanks DSGuru2B and narasimba !
You help me a lot !

:P
Post Reply