Merge Sequential Files - handling missing files

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
itgirlinuk
Participant
Posts: 9
Joined: Mon Sep 07, 2009 4:12 am

Merge Sequential Files - handling missing files

Post by itgirlinuk »

Hi,

I need to merge 5 different sequential files. The 5 files have the same format.

I have created a server job with a Link Collector and the 5 sequential files form as input. The merged ouput needs to be written to another sequential file.

The job works fine if all the 5 files exist in the directory. If one of them does not exist (which is entirely possible and acceptable), the job fails.

Is there a way around this? I don't want the job to fail. I want it to merge existing files and ignore missing files. Can someone tell me how to do this?

Thanks
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Can you just add a before-job UNIX call to "touch" all the files, this would create an empty file for the ones that don't exist and just update the timestamp on those that do exist.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

You will be need some type of mechanism to identify the missing files and then using the touch command as described by ArndW.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

In other words, you cannot 'ignore' the missing ones like that. How about a simple 'cat' instead using wildcards? It won't care.
-craig

"You can never have too many knives" -- Logan Nine Fingers
dxk9
Participant
Posts: 105
Joined: Wed Aug 19, 2009 12:46 am
Location: Chennai, Tamil Nadu

Post by dxk9 »

Howa about a wait for file stage in front of each input file stage. You can specify in the wait for file stage whether to wait for the file or continue regardless of whether the file exists or not.

Regards,
Divya
roy
Participant
Posts: 2598
Joined: Wed Jul 30, 2003 2:05 am
Location: Israel

Post by roy »

Hi,
You can use a routine to build a TYPE command with the existing files and run that as a filter command and use it as the merged file or write it to a target file if that is what you need.
IHTH (I Hope This Helps),
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
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

It's a cat command on Unix, type command on Windows.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
roy
Participant
Posts: 2598
Joined: Wed Jul 30, 2003 2:05 am
Location: Israel

Post by roy »

Indeed it is Ray
Must have missed that unix for OS :oops:
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
Post Reply