0% found this document useful (0 votes)
237 views

Looping in Datastage

The document discusses using looping activities in IBM InfoSphere DataStage sequencer to read multiple file IDs from a file and pass them as parameters to a parallel job. It describes counting the number of lines in the file, using a start loop activity to iterate that number of times, and executing commands within each loop to extract a file ID from the file and pass it to the parallel job.

Uploaded by

Csvv Vardhan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
237 views

Looping in Datastage

The document discusses using looping activities in IBM InfoSphere DataStage sequencer to read multiple file IDs from a file and pass them as parameters to a parallel job. It describes counting the number of lines in the file, using a start loop activity to iterate that number of times, and executing commands within each loop to extract a file ID from the file and pass it to the parallel job.

Uploaded by

Csvv Vardhan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Looping in Datastage | InfoSphere DataStage - IBM https://datastage4u.wordpress.

com/2011/12/14/looping-in-datastage/

InfoSphere DataStage – IBM


Uma Katru – IBM Certified Solution Developer – InfoSphere DataStage v8.0 & WebSphere IIS DataStage
Enterprise Edition V7.5

Home
Uma Maheswara Rao Katru

Home > Sequence Activities > Looping in Datastage

Looping in Datastage
December 14, 2011 ukatru Leave a comment Go to comments

In this article i will explain how to use datastage looping acitvities in sequencer.

I have a requirement where i need to pass file id as parameter reading from a file.In Future
file id’s will increase so that i don’t have to add job or change sequencer if I take
advantage of datastage looping.

Contents in the File:

1|200

2|300

3|400

I need to read the above file and pass second field as parameter to the job.I have created
one parallel job with pFileID as parameter.

Step:1 Count the number of lines in the file so that we can set the upper limit in the
datastage start loop activity.

sample routine to count lines in a file:

Argument : FileName(Including path)

Deffun DSRMessage(A1, A2, A3) Calling “*DataStage*DSR_MESSAGE”


Equate RoutineName To “CountLines”

Command = “wc -l”:” “:FileName:”| awk ‘{print $1}'”

Call DSLogInfo(“Executing Command To Get the Record Count “,Command)


* call support routine that executes a Shell command.
CallPrivacy
DSExecute(“UNIX”,
& Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
Close and accept
To find out more, including how to control cookies, see here: Cookie Policy
* Log any and all output as an Information type log message,

1 of 7 18-11-2018, 09:40:06
Looping in Datastage | InfoSphere DataStage - IBM https://datastage4u.wordpress.com/2011/12/14/looping-in-datastage/

* unless system’s return code indicated that an error occurred,


* when we log a slightly different Warning type message.
vOutput=convert(char(254),””,Output)
If (SystemReturnCode = 0) And (Num(vOutput)=1) Then
Call DSLogInfo(“Command Executed Successfully “,Command)
Output=convert(char(254),””,Output)
Call DSLogInfo(“Here is the Record Count In “:FileName:” = “:Output,Output)
Ans = Output
*GoTo NormalExit
End Else
Call DSLogInfo(“Error when executing command “,Command)
Call DSLogFatal(Output, RoutineName)
Ans = 1

End

Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
Close and accept
To find out more, including how to control cookies, see here: Cookie Policy

2 of 7 18-11-2018, 09:40:06
Looping in Datastage | InfoSphere DataStage - IBM https://datastage4u.wordpress.com/2011/12/14/looping-in-datastage/

Now we use startLoop.$Counter variable to get the file id by using combination of grep
and awk command.

for each iteration it will get file id.

Finally the seq job looks like below.

I hope every one likes this post.

Thanks
Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
Close and accept
UmaTo find out more, including how to control cookies, see here: Cookie Policy

3 of 7 18-11-2018, 09:40:06
Looping in Datastage | InfoSphere DataStage - IBM https://datastage4u.wordpress.com/2011/12/14/looping-in-datastage/

Share this:

Be the first to like this.

Related

Use of the tunable parameters Reading File using Sequential Important Technotes -- IBM
in the UVCONFIG file File Stage Infosphere Information Server
8.5/8.7

Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
Categories: Close and accept
To find out(0)
Comments more, including how to control cookies, see here: Cookie Policy

4 of 7 18-11-2018, 09:40:06
Looping in Datastage | InfoSphere DataStage - IBM https://datastage4u.wordpress.com/2011/12/14/looping-in-datastage/

1. No comments yet.

1. No trackbacks yet.

Leave a Reply

Infosphere Information Server 8.7–Monitoring Datastage Jobs Operations console


Connector Migration Tool — IBM InfoSphere Information Server, Version 8.5
RSS feed

Recent Posts

Use of the tunable parameters in the


UVCONFIG file
InfoSphere DataStage parallel jobs:
Understanding the content of the
APT_DUMP_SCORE report
Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
Close and accept
To find out more, including how to control cookies, see here: Cookie Policy
dsadmin Command for

5 of 7 18-11-2018, 09:40:06
Looping in Datastage | InfoSphere DataStage - IBM https://datastage4u.wordpress.com/2011/12/14/looping-in-datastage/

administering Projects
DSXImportService.sh — Infosphere
Information Server 8.x
JR42922: PROBLEMS WITH
TRANSFORMER NULL TESTING
EXPRESSIONS WHEN RUNNING
WITH
APT_TRANSFORM_COMPILE_OLD_NULL_HANDLING
is set
Issues with NULL values in input columns
in Parallel Engine Transformer stage
Important Technotes — IBM Infosphere
Information Server 8.5/8.7
Environment Variables and using
Parameter Sets — Infosphere information
Server 8.5
Vertica database Installation steps on two
node cluster(Redhat 5.8x86_64)

Categories

Command Line Interface


Datastage Common Errors-Warnings
Datastage-Best Practices
Datastage-Connector Stages
Datastage-Stages
Datastage-Unix Scripts
Datastage8.5-New features
InfosphereDatastage-Installation
Sequence Activities
vertica

Blogroll

Discuss
Get Inspired
Get Polling
Get Support
Learn WordPress.com
WordPress Planet
WordPress.com News

Archives

October 2012
September 2012
July 2012
May 2012
Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
Close and accept
To find out more, including how to control cookies, see here: Cookie Policy

6 of 7 18-11-2018, 09:40:06
Looping in Datastage | InfoSphere DataStage - IBM https://datastage4u.wordpress.com/2011/12/14/looping-in-datastage/

December 2011
November 2011
August 2011
June 2011
May 2011
April 2011

Meta

Register
Log in

Top
Blog at WordPress.com.

Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
Close and accept
To find out more, including how to control cookies, see here: Cookie Policy

7 of 7 18-11-2018, 09:40:06

You might also like