Page 1 of 1

Row by row processing in sequence job

Posted: Mon Apr 02, 2007 12:28 am
by sjordery
Hi All,

please give me solution regarding this.
From the following data I have to send e mail

supplier,flag1,flag2
a,1,0
b,0,1

my reqierment
if flag1=1 then send email to supplier a that the flag1=1
if flag1=0 then send email to supplier a that flag1=0

same for flag2

for this definitely I have to perform sequence job as the email notification is avaliable only in sequence job.
but i have to refer each row from the main job.

please let me know how I will refer each row from the main job in the sequence job.

looking for your valuable suggestions.

Posted: Mon Apr 02, 2007 3:20 am
by kumar_s
Do you need to send individual mails for each record and for each field to supplier or you wish to accumulate the content and send in a single mail. If you wish to accumulate, what is the format that you are expecting?

Posted: Mon Apr 02, 2007 4:38 am
by sjordery
Hi ,

Actually I want to send two mails for each record(for each supplier).
For example

sname,flag1,flag2
--------------------
a,1,0
b,0,1

============
for these two records I have to send 4 mails to 2 suppliers
like to supplier a I have to send two mails,and to supplier b I have to send two mails mentioning their flag1 and flag 2 values
So for this I have to store these values some where so that the sequence. job can reffer.

The sequence also must run once for each record in the main job which returns above two rows.

So please give the solution fro this.

Another issue is that how to process each record from a job in sequence job because sequence job runs only once for each job nt each record.

so please let me know.

Posted: Mon Apr 02, 2007 6:22 am
by chulett
Sequence jobs do not process records - they run other jobs or activities, so in general you get the notion of processing records in one out of your head.

However - if you are on a recent 7.5.x version, then you have the UserVariables Activity stage along with the Start Loop and End Loop stages. You could use them to read your flat file into a delimited List Loop so as to repeat a series of steps 'For Each Thing in List' - to quote the stage.

So your loop could execute once for each record and send emails as appropriate. Not saying this is the 'end all' solution, as you'll still need something in place to know each supplier's email address and how to properly build your emails. Perhaps a small server job you call in the loop to look that up and stash it in the job's User Status area?

The devil *is* in the details.

ps. Some people I know would just script the entire process. :wink:

Posted: Mon Apr 02, 2007 7:05 am
by sjordery
okay I got the idea.
yes I am using the recent 7.5 version.
but my source is not flat file its a relational database.
so please let me know start loop and end loop will work or not in this case.
supplier email id I can get by joing with another table.

I am representing my design idea and an issue related it.

1-1st I will design one job which take the data from the supplier table(Suppliername,flag1,flag2)and put it into a dataset.

2-In a sequence job I ll take the 1st job and connect to a start loop activity to process each record from the data set.

3-This start loop will be connected to another job activity(the job related to this activity will take the single record and extratct the supplier mail by joining).

4-email notification activity will be connected to the 3 rd job activity.

5-after 4 th step end loop activity will be connected.


but problem here is that where I will store the value of the flag and supplier name,mail id so that email notificationn activity will catch those values and send mail.

can I use user variable for this,but user variable activity is only supporting to some system variables only.

please suggest me

Posted: Mon Apr 02, 2007 7:36 am
by chulett
I doubt you'll be able to use the Notification Activity stage, doesn't seem like it will support your needs. Consider writing a custom routine where you can pass in the pertinent details and leverage either DSSendMail directly or DSExecute your operating system's mailx command.

Posted: Mon Apr 02, 2007 7:48 am
by DSguru2B
Actually, picking up from Craig's suggestion, write a Basic routine which sends mail using DSSendMail() and consider doing this in a server job. If you are sending two emails per record, I am guessing you dont have huge amount of data, yes ???
Simply do this in a server job.

Posted: Tue Apr 03, 2007 1:13 am
by sjordery
okay

yes I have few records in the table.
My requirement is to develop the job using parallel extender nt server.
If I have to use dssend mail routine activity for this please be specific that what the routine will do in this case.

please suggest.....

Posted: Tue Apr 03, 2007 1:44 am
by kumar_s
For sending mail, you need to either choose JobSequence or Basic Routine, where both run in Sequential mode (not in parallel mode).

Posted: Tue Apr 03, 2007 1:58 am
by sjordery
okay

I think I have to build one routine n I have to place this in after job sub routine stage.
Can you explain in diferent steps what the routine will do in this scenario.

Please reply

Posted: Tue Apr 03, 2007 2:43 am
by kumar_s
After job subroutine will also be executed only once after the job has finished executing.
As suggested, create a BASIC routine and execute that routine in JobSequence.
Read the file using OpenSeq function and read each row and each field, and use DSSendMail to send mail. You ll get the syntax and details of these commands in BASIC manual.

Posted: Tue Apr 03, 2007 5:43 am
by sjordery
okay thanks for your valuable suggestions.

Posted: Tue Apr 03, 2007 6:09 am
by chulett
sjordery wrote:yes I have few records in the table. My requirement is to develop the job using parallel extender not server.
[sigh] Shouldn't you be using the appropriate tool for the job? Don't you have more than one tool in your toolbox? You need to read a teeny number of records and send emails and you are "required" to do this in a PX job? :roll:

Posted: Tue Apr 03, 2007 7:38 am
by DSguru2B
Just do it in parallel job huh :?
Any particular reason why? Don't let them tell you how to do your job, just ask them what needs to be done and get it done.