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

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
mprashant
Participant
Posts: 18
Joined: Thu Apr 29, 2004 1:23 pm

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

Post 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.
WoMaWil
Participant
Posts: 482
Joined: Thu Mar 13, 2003 7:17 am
Location: Amsterdam

Post 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
roy
Participant
Posts: 2598
Joined: Wed Jul 30, 2003 2:05 am
Location: Israel

Post 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,
Roy R.
Time is money but when you don't have money time is all you can afford.

Search before posting:)

Join the DataStagers team effort at:
http://www.worldcommunitygrid.org
Image
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

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

Post 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)
Last edited by ArndW on Thu Mar 10, 2005 10:54 am, edited 1 time in total.
mprashant
Participant
Posts: 18
Joined: Thu Apr 29, 2004 1:23 pm

Post 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?
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post 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.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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).
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply