help required in routine

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

pandeesh
Premium Member
Premium Member
Posts: 1399
Joined: Sun Oct 24, 2010 5:15 am
Location: CHENNAI, TAMIL NADU

help required in routine

Post by pandeesh »

HI,

I have used the below routine for capturing fatals and mailing them.
But in the mail , thye full fatal is not displaying.
It's just dispalying as (....) .
Is there any way to expand that and view.

code:

Code: Select all

$INCLUDE DSINCLUDE JOBCONTROL.H 

***CallingProgName = DSJ.ME 

rJobHandle = DSAttachJob(Jobname, DSJ.ERRNONE) 
JobStartTime = DSGetJobInfo(rJobHandle, DSJ.JOBSTARTTIMESTAMP) 
JobEndTime = DSGetJobInfo (rJobHandle, DSJ.JOBLASTTIMESTAMP) 
SummaryArray = DSGetLogSummary(rJobHandle, DSJ.LOGFATAL, JobStartTime, JobEndTime, 0) 
Mail = DSSendMail("From:DataStage-Development@xys.com\nTo:abx@sant.com\nServer:wdims\nSubject:Jobs Failed !Please take care! \nBody:":SummaryArray) 
DetachResult = DSDetachJob(rJobHandle) 

Ans = Mail 

In the mail i am getting the messages like below:

Code: Select all

203\2011-07-07 06:13:18\3\Job_Activity_1\1\TL_RAW: GenericQuery:esqlErrorHandler (...)
204\2011-07-07 06:13:18\3\Job_Activity_1\1\TL_RAW: The provided query statement did not prepare correctly; (...)
205\2011-07-07 06:13:18\3\Job_Activity_1\1\main_program: Creation of a step finished with status = FAILED.


Any help appreciated

Thanks
pandeeswaran
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

That's because you are using DSGetLogSummary rather than DSGetLogDetail.
-craig

"You can never have too many knives" -- Logan Nine Fingers
pandeesh
Premium Member
Premium Member
Posts: 1399
Joined: Sun Oct 24, 2010 5:15 am
Location: CHENNAI, TAMIL NADU

Post by pandeesh »

chulett wrote:That's because you are using DSGetLogSummary rather than DSGetLogDetail.
Hi ,

I have tried DSGetLogDetail, but it throws the syntax error.
I haven't found the syntax for DSGetLogDetail anywhere.

Code: Select all

SummaryArray = DSGetLogDetail(rJobHandle,DSJ.LOGFATAL, JobStartTime, JobEndTime, 0)
The error is:

Code: Select all

Compiling: Source = 'DSU_BP/DSU.maillog', Object = 'DSU_BP.O/DSU.maillog'
********************************************?
0009    SummaryArray = DSGetLogDetail(rJobHandle,DSJ.LOGFATAL, JobStartTime, JobEndTime, 0) 

                                                            ^
',' unexpected, Was expecting: '!', ')', '=', "AND", "OR", "LT", "LE", 
pandeeswaran
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

OK... that was off the top of my head and I got the function name wrong. Was it really that hard to try and look up what I really meant? :?

Switch it to DSGetLogEntry. Note that you'll need to include the use of DSGetNewestLogId as well from what I recall. Search for forums for examples of the syntax / usage.
-craig

"You can never have too many knives" -- Logan Nine Fingers
pandeesh
Premium Member
Premium Member
Posts: 1399
Joined: Sun Oct 24, 2010 5:15 am
Location: CHENNAI, TAMIL NADU

Post by pandeesh »

Hi ,

I have used the below routine..

Code: Select all

$INCLUDE DSINCLUDE JOBCONTROL.H 
JobName = Arg1 

hJob = DSAttachJob(JobName, DSJ.ERRNONE) 

iLatestLogID = DSGetNewestLogId(hJob, DSJ.LOGANY) 

Ans = "" 
For iEventID = iLatestLogID To 1 Step -1 
   vEventDetail = DSGetLogEntry(hJob1, iEventID) 
   Ans<-1> = vEventDetail 
Next iEventID 

iIgnore = DSDetachJob(hJob)
But it's not working.Once the job aborts it says the routine did not finsh,reply=-1. But it's compiling fine.

Am i missing anything?

Thanks
pandeeswaran
pandeesh
Premium Member
Premium Member
Posts: 1399
Joined: Sun Oct 24, 2010 5:15 am
Location: CHENNAI, TAMIL NADU

Post by pandeesh »

Hi Craig,

i have used the below code and i am receiving only the last line of the mail.

Code: Select all

$INCLUDE DSINCLUDE JOBCONTROL.H 
JobName = Arg1 

hJob = DSAttachJob(JobName, DSJ.ERRNONE) 

iLatestLogID = DSGetNewestLogId(hJob, DSJ.LOGANY) 

For iEventID = iLatestLogID To 1 Step -1
   
  vEventDetail = DSGetLogEntry(hJob, iLatestLogID) 

next iEventID

Mail = DSSendMail("From:DataStage-Development@xys.com\nTo:pandeesh@ccgi.com\nServer:wdims\nSubject:Jobs Failed !Please take care! \nBody:":vEventDetail ) 

Ans = Mail

iIgnore = DSDetachJob(hJob)
i am struggling to store all the log entries in a single variable(array variable) and concatenate that variable in the DSSendMail.

In the mail i am receiving:

Code: Select all

2011-07-07 08:49:25\adm\7\(Seqps) <- Acg: Job under control finished.
And one more thing is:
DSGetNewestLogId(hJob, DSJ.LOGANY) fetches all the entries in the log regardless of fatal,warning or information.
Is there any other option available to fetch the fatal alone?

Thanks
pandeeswaran
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You overwrite vEventDetail each iteration through the loop, but don't call DSSentMail() till you exit the loop. Why don't you specify in English what you want to achieve?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

pandeesh wrote: DSGetNewestLogId(hJob, DSJ.LOGANY) fetches all the entries in the log regardless of fatal,warning or information.
Is there any other option available to fetch the fatal alone?
Yes and a quick check of the documentation should clear that up for you. Hint: you told it you wanted DSJ.LOGANY - that's not the only option.
-craig

"You can never have too many knives" -- Logan Nine Fingers
pandeesh
Premium Member
Premium Member
Posts: 1399
Joined: Sun Oct 24, 2010 5:15 am
Location: CHENNAI, TAMIL NADU

Post by pandeesh »

ray.wurlod wrote:You overwrite vEventDetail each iteration through the loop,
In stead of overwriting, how to append the log information to that variable?

So that we can finally include that variable in the mail body?

Thanks
pandeeswaran
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Do you see how "Ans" was being treated as a dynamic arrary in the code you first posted and then you removed that bit of magic from the second iteration of the code? Now you want to treat your vEventDetail in that same fashion so it inserts a new array element each time through the loop rather than overwriting:

Code: Select all

For iEventID = iLatestLogID To 1 Step -1 
    
  vEventDetail<-1> = DSGetLogEntry(hJob, iLatestLogID) 

next iEventID
Then when you include vEventDetail in the body of the email it will have all occurances in it.
-craig

"You can never have too many knives" -- Logan Nine Fingers
pandeesh
Premium Member
Premium Member
Posts: 1399
Joined: Sun Oct 24, 2010 5:15 am
Location: CHENNAI, TAMIL NADU

Post by pandeesh »

The below code works for me:

Code: Select all

vEventDetail<-1> = DSGetLogEntry(hJob,iEventID) 
But it mails log details for all runs ,since the loop is from iNewestLogID to 1

In stead of that, i need the log for only last run alone.
How to find the id for the initial line of last run?
is there any way to find that?

Thanks
pandeeswaran
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

How about this?
ray.wurlod wrote:Why don't you specify in English what you want to achieve?
Please do that so we don't waste any more time going 'round and 'round with inappropriate solutions. :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
pandeesh
Premium Member
Premium Member
Posts: 1399
Joined: Sun Oct 24, 2010 5:15 am
Location: CHENNAI, TAMIL NADU

Post by pandeesh »

i want to mail the log details of the last run alone.
This is my requirement.
pandeeswaran
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Then why are you looking for ANY "newest" id (which will get you the most recent log entry) and then going backwards to the beginning of everything in the log? As noted, you tell the DSGetNewestLogId function what type of newest id you want so there are a couple of approaches that would be more appropriate.

You can also capture the newest "starting" id, that way you either know where to stop if you are farming everything backwards, or where to start if you want things in the "proper" order in your EventDetail array.
-craig

"You can never have too many knives" -- Logan Nine Fingers
pandeesh
Premium Member
Premium Member
Posts: 1399
Joined: Sun Oct 24, 2010 5:15 am
Location: CHENNAI, TAMIL NADU

Post by pandeesh »

Yes Craig!! Exactly!!i want to capture the newest starting id.
pandeeswaran
Post Reply