script to process a file

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

India2000
Participant
Posts: 274
Joined: Sun Aug 22, 2010 11:07 am

script to process a file

Post by India2000 »

I need an idea as how to process files in the directory file by file method using pattern after listing file names in the list and retrieving each file name in the list for process.I'm stuck at this point..Once read file names how should I proceed to put the file in the specific path and how do I come to know the file processing is completed to start with the next file? Pls direct me

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

Post by chulett »

What? :?

So... you've put a list of filenames in a file and want to know how to leverage that file? If that's the case, then use File Pattern in the Sequential File stage and give it your filename.
-craig

"You can never have too many knives" -- Logan Nine Fingers
India2000
Participant
Posts: 274
Joined: Sun Aug 22, 2010 11:07 am

Post by India2000 »

Thanks..I don;t want to use the pattern method reading from seq file..In the event of failure/issues it would be difficult to trace files if I use that method. I have already used that method..But I want to know if it can be done efficiently using scripting like as each file gets processed log will show that file processes successfully.
qt_ky
Premium Member
Premium Member
Posts: 2895
Joined: Wed Aug 03, 2011 6:16 am
Location: USA

Post by qt_ky »

If you don't want to use Sequential File stage file pattern then you can parameterize a multi-instance job and still process all the files at once.
Choose a job you love, and you will never have to work a day in your life. - Confucius
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

... or a looping Sequence job.
-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 »

... or, indeed, a looping sequence job that uses the contents of your file of file names. The technique has been explained on DSXchange in the past.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
India2000
Participant
Posts: 274
Joined: Sun Aug 22, 2010 11:07 am

Post by India2000 »

for a start of loop activity list option how do I need to use list values as I have list of filenames in a column...like

File Name 1
File Name 2
...
what would be my delimiter value?
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Whatever you want it to be. When you read your file it's the line terminator character, but you can convert that you anything you like in a User Variables activity.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
India2000
Participant
Posts: 274
Joined: Sun Aug 22, 2010 11:07 am

Post by India2000 »

thanks Ray.But your answer is not clear to me.. I meant how should I give a input to the start loop activity for a list of file names.. Should I give .list as an input? or the file pattern?
kandyshandy
Participant
Posts: 597
Joined: Fri Apr 29, 2005 6:19 am
Location: Singapore

Post by kandyshandy »

This is not the answer for your question. But it would be great if you locate 'Help' button on the start loop activity ;) That will give you enough information
Kandy
_________________
Try and Try again…You will succeed atlast!!
India2000
Participant
Posts: 274
Joined: Sun Aug 22, 2010 11:07 am

Post by India2000 »

I do want to provide list file names explicitly coz..Instead is there a way that I can do this coz I'm not sure about the number of files..So need to use file pattern
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Why not simply use the File Pattern capability of the Sequential File stage and be done with this? Is there something in what you are doing that requires you to process each file one at a time? :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
India2000
Participant
Posts: 274
Joined: Sun Aug 22, 2010 11:07 am

Post by India2000 »

it would be easier track issues with files if I use this method
battaliou
Participant
Posts: 155
Joined: Mon Feb 24, 2003 7:28 am
Location: London
Contact:

Post by battaliou »

Take a look at the UNIX tr -s '\n\' ',' command.
3NF: Every non-key attribute must provide a fact about the key, the whole key, and nothing but the key. So help me Codd.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

India2000 wrote:it would be easier track issues with files if I use this method
Why? What would be easier about it? The stage can import the current filename along with the data, if that is your concern. To me, this seems like more work for zero gain. [shrug]
-craig

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