Page 1 of 1

Get the Input link record count and pass/insert into target

Posted: Fri Jan 30, 2009 6:34 am
by gnan_gun
I have a job like
Oracle(Source) ---> Lookup ---> Join ---> Transformer ---> Oracle(Target)
My requirement is i need get the input link record count and pass that count value into Oracle(target) table as Total_input_records.
I have written routine in Server using Linkinfo. Its working fine. but in Parallel I am unable to write/modify.
Is there any functions available in PX with out writing PX routine to get input link record count.
Please help me to resolve this.
Thanks in advance.

--Gnan

Re: Get the Input link record count and pass/insert into tar

Posted: Fri Jan 30, 2009 6:36 am
by gnan_gun
Any Replies with PX routine or alternative of PX routine to achieve this??

Posted: Fri Jan 30, 2009 8:39 am
by mk_ds09
If you want to the input number of records only which is from oracle table, you can write the before job routine to call the unix script.

In the script
count = select count(*) from the table_name

update table_2 set total_input_records = count

-------------------------

Hope this helps..

----------------------

MK

Posted: Fri Jan 30, 2009 10:11 am
by samsuf2002
Why not use @INROWNUM in the transformer for target rowcount column.....

Posted: Fri Jan 30, 2009 10:17 am
by mk_ds09
Why not use @INROWNUM in the transformer for target rowcount column.....

@INROWNUM gives the number to each row that is passing through the tramsformer.. however the issue with this one is that if job is executing on multiple nodes, the @INROWNUM will give differenet numbers on the rows on each nodes.

If there are 2 nodes with two rows ..

it will give 1 and 2 for 1st and 2nd row as they are executing on node1
again it will give 1 and 2 to 3rd and 4th row as they are excuting on the node2.

so this will not give the correct count of the records ..

hope this helps

--------------------------

MK[/i]

Posted: Fri Jan 30, 2009 11:16 am
by mspanda
Hi
call a unix script from datastage job(from before job subroutine) by passing the parameter like <projecetname> <jobname> <stagename> <linkname>

script should contain the following command.
dsjob -linkinfo <projecetname> <jobname> <stagename> <linkname> |head -1 | awk '{ print $5 }'>/path/outputfile.txt.

This /path/outputfile.txt file will be source and oracle will be target.Then insert.
Hop this will resolve the issue.

Thanks,
mspanda

Posted: Mon Feb 02, 2009 7:01 am
by Sainath.Srinivasan
Use agg stage and get max(rownum)

Posted: Mon Feb 02, 2009 9:55 pm
by gnan_gun
I dont want to modify/add the stages in the job. This has to be solved by PX routine or Unix script(After Job Subroutine).

mspanda--> U r correct. But has to implement this command in unix script. Thank for ur reply.

Posted: Tue Feb 03, 2009 8:27 am
by chulett
OK... if you "have to" do this in a script then, as noted, you would use dsjob with the -linkinfo option.