Reject Empty Rows

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
Emilio
Participant
Posts: 17
Joined: Wed Jan 28, 2004 2:18 pm
Location: Frederick, MD

Reject Empty Rows

Post by Emilio »

Hello, :P
I have a sequential file that is showing empty but is really not empty, the file shows having empty rows like this:
,,,,,,,,,,
,,,,,,,,,,
for one or more rows.
How can I reject a row if is empty? :? :?:
Thanks,
Emilio :)
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

The first help is to point out you are posting in the wrong forum. (editor's note: Topic has now been relocated)

The second help is to suggest putting a constraint in place in a transformer to throw away any rows that have a blank value where one isn't allowed. You can't really avoid reading those rows, the best thing to do is send them to an exception file or just throw away.
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
Emilio
Participant
Posts: 17
Joined: Wed Jan 28, 2004 2:18 pm
Location: Frederick, MD

Post by Emilio »

Thank You,
Should I check each field for null or is it possible to check if the entire row is empty? :)
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You need to check every column. The Format tab of your Sequential File stage specifies that "" is to be understood as NULL, so you need either to change this or to check using the IsNull() function.

Another possibility is to read the file as if it contains just one large string column, and then to use a constraint such as

Code: Select all

inLink.TheRecord <> ",,,,,,,,"
In the same Transformer stage you can then parse "good" rows into appropriate columns.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
pavanns
Participant
Posts: 27
Joined: Wed Sep 28, 2005 8:00 pm
Location: ca

Post by pavanns »

how abt using reject rows tab ON in transformer
pavan
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

I hate that. It generates a warning in the job log. My idea of best practice is that no job that executes successfully generates a warning.
Prefer a second output link whose constraint expression is the logical inverse of the constraint expression on the "good rows" output link.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
srinagesh
Participant
Posts: 125
Joined: Mon Jul 25, 2005 7:03 am

Post by srinagesh »

How about stripping the file of the blank records using unix command .

This will solve the problem I guess..

what say ?
Emilio
Participant
Posts: 17
Joined: Wed Jan 28, 2004 2:18 pm
Location: Frederick, MD

Post by Emilio »

I am in the windows enviroment but I was able to do it using the following contraint. Perhaps someone have a better way to do it:
trim(NullToEmpty(xfmMissCode1.ArmConvOpt)) <> "" OR trim(NullToEmpty(xfmMissCode1.ArmIndexCode)) <> "" OR trim(NullToEmpty(xfmMissCode1.ArmNegAmrFlag)) <> "" OR trim(NullToEmpty(xfmMissCode1.ArmRoundFlag)) <> "" OR trim(NullToEmpty(xfmMissCode1.BorrSelfEmpFlag)) <> "" OR trim(NullToEmpty(xfmMissCode1.BorrSex)) <> "" OR trim(NullToEmpty(xfmMissCode1.CoBorrSex)) <> "" OR trim(NullToEmpty(xfmMissCode1.DocumentCode)) <> "" OR trim(NullToEmpty(xfmMissCode1.DwellTypeCode)) <> "" OR trim(NullToEmpty(xfmMissCode1.LimitDocFlag)) <> ""
er :)
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Nothing wrong with that. Whatever you do, if you've read multiple columns you have to test them all.

The only other approach is to read the file as if it contains just one column, and only allow it to pass if it contains more than just commas (you could test its length, for example Len(InLink.TheSingleColumn) > 9). Then use output column derivation expressions using the Field() function to parse that single column into the requisite number of discrete columns.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply