Passing parameters to a Email Stage from Table

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
chillblue
Premium Member
Premium Member
Posts: 13
Joined: Mon Sep 19, 2011 11:58 pm
Location: Michigan

Passing parameters to a Email Stage from Table

Post by chillblue »

Hi All,

The Email parameters like FROM , TO and Subject will be stored in a table and i need to Read the content from the table and pass the values to the Notification Stage (at the sequence Job level).

How to implement this in DS ?



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

Post by chulett »

Use a Server job to capture that information and store it (delimited) in USERSTATUS. The sequence can easily extract it from there and you can use Field() in the paramater assignment to split them back out.

A User Variables stage can also be handy here. If you'd rather not use USERSTATUS then a flat file can be leveraged as well for intermediate storage.
-craig

"You can never have too many knives" -- Logan Nine Fingers
chillblue
Premium Member
Premium Member
Posts: 13
Joined: Mon Sep 19, 2011 11:58 pm
Location: Michigan

Post by chillblue »

Thanks Lot for your reply.

I cant use a server job so went in for the below approach.


Wrote the parameters to 3 different files. From , To and subject.

Read them separately via command output stage.

passed the parameters to the Email stage.


Thanks.
Thanks
Chillblue
ankursaxena.2003
Participant
Posts: 96
Joined: Mon May 14, 2012 1:30 pm

Post by ankursaxena.2003 »

Even if you write a parallel job, you don't need to have 3 stages to read and 3 files.

Read the data from Oracle and write on a single file.
For example,
Test.txt

abc@gmail.com~def@gmail.com~Test Mail

And then read the file using CAT command in unix.
And later using FIELD() in the parameter assignment to split them where '~' will be delimiter.

This way you need

Oracle Extract ----> Execute Stage ------> User Variable Activity ----> Mail Notification
ankursaxena.2003
Participant
Posts: 96
Joined: Mon May 14, 2012 1:30 pm

Post by ankursaxena.2003 »

You don't even need to put User Variable Activity.
You can directly use $CommandOutput to read the output from cat command.

#ExecCommand.$CommandOutput#
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Many ways to skin this cat. You could put three records in the file, cat them and then use array notation to get the 1st, 2nd and 3rd values. For example:

ExecCommand.$CommandOutput<2>

would contain the contents of the second record.
-craig

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