After subroutine to see the log

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

Moderators: chulett, rschirm, roy

Post Reply
prasson_ibm
Premium Member
Premium Member
Posts: 536
Joined: Thu Oct 11, 2007 1:48 am
Location: Bangalore

After subroutine to see the log

Post by prasson_ibm »

Hi All,

I need help in creating a routine which will display director log in output.
I have created routine as:-

Code: Select all

$INCLUDE DSINCLUDE JOBCONTROL.H
JobName = Arg1
 
hJob1 = DSAttachJob(JobName, DSJ.ERRNONE) 
jobStart = DSGetJobInfo (hJob1, DSJ.JOBSTARTTIMESTAMP) 
latestID = DSGetNewestLogId(hJob1,DSJ.LOGANY)
DIM evtVector(latestID) 
DIM errVector(latestID) 
DIM errTypeVector(latestID) 
 
For eventID = latestID To 1 Step -1 

    eventDetail = DSGetLogEntry(hJob1,eventID)

    Ans =  eventDetail
          
Next eventID
And i m getting output as:-

Code: Select all

Result = 2010-09-16 21:41:04\TD|pk1\1\Environment variable settings:ALLUSERSPROFILE=C:\Documents and Settings\All Users
APT_COMPILEOPT=-W/TP -W/EHa -D,

<snip an awful lot of unnecessary example>

!vseverity, !jobid, moduleid, errorIndex, timestamp, !ipaddr, !nodeplayer, !nodename, opid, message
This is only first Event of director Log. I want all event should be displayed.I think i have an issue with For loop.

Need help.

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

Post by ray.wurlod »

First off, lose the DIM statements. They're misleading both us and the compiler.

Second, each iteration of the loop is overwriting Ans variable. Is this really what you want? If no, why have the loop at all?

3. Always detach any job you attach to a routine.

4. Your logic is reading the log backwards in time. Is this really what you want to do?

5. You're not using jobStart.

6. Use a dynamic array to accumulate the log entries.

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)
Congratulations! We've just re-invented DSGetLogSummary().
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
prasson_ibm
Premium Member
Premium Member
Posts: 536
Joined: Thu Oct 11, 2007 1:48 am
Location: Bangalore

Post by prasson_ibm »

I want all log information,so i have a loop which starting from lastest event id and decrementing by 1 and printing the value.
But i am getting only first log message not all message.

Do i need to place Ans out of the loop?
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Please (get a premium membership and) read my complete reply which includes a working routine to do what you require.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
prasson_ibm
Premium Member
Premium Member
Posts: 536
Joined: Thu Oct 11, 2007 1:48 am
Location: Bangalore

Post by prasson_ibm »

Thanks ray,But temporarily i need to help to trigger my routine.... :(
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You've been benefiting from the free service for more than three years. Isn't it time you contributed to the running of the site?
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