Null file Handling

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
Ambuj743
Premium Member
Premium Member
Posts: 8
Joined: Mon Sep 12, 2005 2:44 pm

Null file Handling

Post by Ambuj743 »

I want to pass a null sequential file in the datastage job and want to generate a new sequential file with one row. The same file will be used to compare another sequential file.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

What exactly do you mean by "a null file"?

The design is easy enough, but needs a specification of what must be in the one row of your output file. For example you could use a Row Generator stage to produce that. But what should be done with the "null file", whatever that is?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Ambuj743
Premium Member
Premium Member
Posts: 8
Joined: Mon Sep 12, 2005 2:44 pm

File which contains zero record.

Post by Ambuj743 »

I am passing a file which contains zero record (blank file) and trying to insert one row.Please suggest me the steps.

ray.wurlod wrote:What exactly do you mean by "a null file"?

The design is easy enough, but needs a specification of what must be in the one row of your output file. For example you could use a Row Generator stage to produce that. But what should be done with the "null file", whatever that is?
roy
Participant
Posts: 2598
Joined: Wed Jul 30, 2003 2:05 am
Location: Israel

Post by roy »

Hi,
So you want to read an empty file and produce 1 row that contains what?

IHTH,
Roy R.
Time is money but when you don't have money time is all you can afford.

Search before posting:)

Join the DataStagers team effort at:
http://www.worldcommunitygrid.org
Image
Ambuj743
Premium Member
Premium Member
Posts: 8
Joined: Mon Sep 12, 2005 2:44 pm

Post by Ambuj743 »

That contains 1 record with all the values zero.
roy wrote:Hi,
So you want to read an empty file and produce 1 row that contains what?

IHTH,
Ambuj743
Premium Member
Premium Member
Posts: 8
Joined: Mon Sep 12, 2005 2:44 pm

Post by Ambuj743 »

That contains 1 record with all the values zero.
roy wrote:Hi,
So you want to read an empty file and produce 1 row that contains what?

IHTH,
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Reading an 'empty' file will produce exactly zero rows of output.

If you want to create a job that writes out one row, then build a Server job that starts with a Transformer and outputs to your desired 'all values zero' file. Add a stage variable to the Transformer so the compiler doesn't bark. Add a constraint to the Transformer of @OUTROWNUM=1 so it stops after writing one row. Hard code the values in all derivations to zero. Run. Done. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

A Row Generator stage would be more efficient. Again specify to generate one row. Put zero into each column. You don't need an input file, null or otherwise.

Why not just

Code: Select all

echo '0,0,0,0,0,0,0' > filepath 
as a command?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

ray.wurlod wrote:A Row Generator stage would be more efficient.
Really? More efficient? Or just more PX'ian? :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

More efficient. No overhead in calling the library created by compiling the Transformer stage, which would be significant in a one-row job.

I think the echo approach would be the most efficient of all.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
dsxdev
Participant
Posts: 92
Joined: Mon Sep 20, 2004 8:37 am

Generate a dummy record reading by reading an empty file.

Post by dsxdev »

Hi Ambuj,
I hope your case is to use a job which will read an empty file and generate a new file with a record containing default values.

Since you are using this job to compare with another file, this job would be run conditionally. More precise run this job only when the input file for this job is empty.

Any way if you want to do it you can do this in an After job routine which would be a simple way to do it.

Check the link statistics or line count of the file and just write a new record.
This would work fine.
Happy DataStaging
Post Reply