execute command for readinging sequentialfile in looping

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
roshanearly
Participant
Posts: 27
Joined: Thu Aug 09, 2012 4:55 am
Location: bangalore

execute command for readinging sequentialfile in looping

Post by roshanearly »

What is the execute command i should write in execute command stage in sequence looping for reading a sequential file and if i find it empty it returns false.please reply as soon as possible
ROSHAN
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

How about "wc -l" to count the lines, assuming the file you are checking is one delimited by line feeds.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Or "test -s" and make sure it fails. :wink:

Note that these assume you have the MKS Toolkit installed and can thus run UNIX commands. DOS commands to check filesize are... trickier.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

But we know you have MKS Toolkit - Although the conspiracy theorists might believe thata DataStage offers a portal into your system (all your data are belong to us), wiser heads will note that MKS Toolkit is installed as part of DS on Windows systems :wink:

p.s. were those answers fast enough for you? Please, next time, don't ask for speedier help since this is a volunteer site and will generally answer as fast as they feel like and demanding quicker support usually gets exactly the opposite reaction.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You posted at 00:11 my time. I was not paying a whole lot of attention at that time.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
bhasds
Participant
Posts: 79
Joined: Thu May 27, 2010 1:49 am

execute command for readinging sequentialfile in looping

Post by bhasds »

Hi Roshan,

If I have understood your question correctly, you are asking-

1.How to get record count of a file through execute command?

2.How to pass the records to the loop in sequence and the count should determine the number of time the loop should run?

3. How to prevent the loop from running if there is no data?

Please confirm if above three are exact question.
Post Reply