Field value with number of records loading.

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
meena
Participant
Posts: 430
Joined: Tue Sep 13, 2005 12:17 pm

Field value with number of records loading.

Post by meena »

Good Morning,
I have scenario where I have to check the field value with the number of records getting loaded into the table.
I am getting a file with header and trailer. From the trailer I need to take a field value( column value) and do a check with the number of records getting loaded into the table. If "field value is equal to numberof records loaded" then it is fine else I need to send a notification through mail.
Is it possible to do this by after job routine else we have to go with sequencer.
Probably this must have been discussed here earlier but I am not able find.

Thanks in advance,
Meena
kris
Participant
Posts: 160
Joined: Tue Dec 09, 2003 2:45 pm
Location: virginia, usa

Re: Field value with number of records loading.

Post by kris »

meena wrote: Is it possible to do this by after job routine else we have to go with sequencer.
Can be done in several ways: My 2 ways of doing

1. Within the job, capture that value from field in the header record and write to a hashedfile. And read the target table after loading (select count(*) from table) within the same job after loading and look up the hashed file and based on the that you can do whatever you want.

2. Read the value from header and set it to parameter value and also within the same job after loading the table, read it for count of records and write to a file. Then you can have a after job routine which compares the value of the content of that file with reading argument value which is the parameter you set earlier.

Hope it helps,
Kris
~Kris
meena
Participant
Posts: 430
Joined: Tue Sep 13, 2005 12:17 pm

Post by meena »

Good Morning Kris,
I want to go with the second way provided by you. But I have question in this. How can I provide the column value as parameter to the routine.Do I need to do this in transformer stage using any specific DSfunction or ?..Can you please give me a clear picture on this.

Thanks in advance,
Meena
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

You have to write your own after stage subroutine. One that will cat the contents of both the files (file containing the header count and the file containing the number of records processed). Compare the two, if equal, well and good if not , send out an email using DSSendMail().
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
Post Reply