Page 1 of 1

Genrating a report ( not job log ) in a specifc format.

Posted: Tue Mar 08, 2005 7:51 am
by mprashant
Hi
I am trying to generate a report at the end of a DatatStage job. I have all the values I need. My report should look like :

DAtA QUALITY ANALYSIS FOR $ TABLE

No of rows extracted from Source - $ ROWCOUNT
N o of rows extracted from Targett -$ ROWCOUNTTGT
No of rows that do not match - $MISMATCH


KEY Columns | SOURCE COLUMNS | TARGET COLUMNS

Is there any way I could do this. WIth the Sequential file I get the second part which is tabular . How can I get the header and the first 3 lines. The report HAS to be in the above format. So if anyone has any suggestions please let me know.

Posted: Tue Mar 08, 2005 8:21 am
by WoMaWil
Yes you can, why not.

If you are fit in UNIX shell scripting you can ask with dsjob any job about his statistics and then put it in a file sequential file the way you like.

If you are fit in Universe Basic you can write a general Job which does the same, even load this information with a second following job in a table.

Wolfgang

Posted: Tue Mar 08, 2005 8:26 am
by roy
Hi,
you'll probably need to write some basic code to get this info.
perhaps you might consider hiring some one of the consultants here.
anything else was discussed in previous posts.
you should be able to get all the info you mentioned.
look in the help for DSGet... routines

IHTH,

Re: Genrating a report ( not job log ) in a specifc format.

Posted: Tue Mar 08, 2005 8:44 am
by ArndW
Mprashant,

at the end of the job call up an after-job routine, in order to write your data and format to a file in the form

mprashant wrote: DAtA QUALITY ANALYSIS FOR $ TABLE

No of rows extracted from Source - $ ROWCOUNT
N o of rows extracted from Targett -$ ROWCOUNTTGT
No of rows that do not match - $MISMATCH

KEY Columns | SOURCE COLUMNS | TARGET COLUMNS
write code similar to (but not identical with, as I've got this copyrighted [just kidding]) You need to flesh out the values for StageToCheck and LinkToCheck as well error checking, but this will give you a good idea of what you need to do.

Code: Select all

OPENSEQ '/tmp/thismyheaderoutput.txt' TO SeqFilePtr THEN NULL ELSE NULL
WEOFSEQ SeqFilePtr ;** ensure that you are overwriting if necessary

  ROWCOUNTTGT  = DSGetLinkInfo(DSJ.ME,StageToCheck,LinkToCheck,DSJ.LINKROWCOUNT)
  ROWCOUNT = 1
  MISMATCH  = 1 
WRITESEQ "                   DAtA QUALITY ANALYSIS FOR $ TABLE" ON SeqFilePtr ELSE CALL DSLogFatal("OH NO, I messed up",'')
WRITESEQ "No of rows extracted from Source - ":ROWCOUNT  ON SeqFilePtr ELSE CALL DSLogFatal("OH NO, I messed up",'')
WRITESEQ "N o of rows extracted from Targett -":ROWCOUNTTGT ON SeqFilePtr ELSE CALL DSLogFatal("OH NO, I messed up",'')
WRITESEQ "No of rows that do not match - ":MISMATCH ON SeqFilePtr ELSE CALL DSLogFatal("OH NO, I messed up",'')
CLOSESEQ(SeqFilePtr)

Posted: Thu Mar 10, 2005 10:31 am
by mprashant
Hey Arnd,
Thanks a lot for your response. The after job routine works, though how do I pass the value for rowcount to the routine.

FOr example I got the value for rowcount from the previous job and passed it on to a job parameter called ROWS in the current job. Now this I want to write to the sequential file. How can i call this job parameter in my routine or pass the value of job parameter ROWS to a variable in my routine?

Posted: Thu Mar 10, 2005 10:57 am
by ArndW
Since this is an after-job routine you only have 1 parameter to play with; but if you are not passing anything else to the routine just use the #parametername# value in the call.

Posted: Thu Mar 10, 2005 6:39 pm
by ray.wurlod
Row count can be had from interrogating the job itself, using DSGetStageInfo or DSGetLinkInfo function. It would help if you have a standard naming convention for your stages and links. How you determine "do not match" would have to be a function of your job design logic (unless mismatched rows are processed to a known link name).