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

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

Post by chulett »

So... go ahead. Make it so. :wink:
-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 »

Craig,

As per the documentation i understand that,

Code: Select all

EventId is an integer that identifies the specific log event for which details are
required. This is obtained using the DSGetNewestLogId function.
DSGetNewestLogId returns the recent event id.
so, while traversing backwards how to find the limit to which we need to traverse.if we give 1 it will traverse till the log of the first run.

i really don't know how to find the recent starting id.
I am still delving into the documentation

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

Post by ray.wurlod »

If you're reading the detail of each event anyway, simply exit the loop after you encounter the "job starting" event.

But you still haven't really told us (in English) what you're trying to accomplish. That is, a specification for the routine, and where you intend to use it.
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 »

In case you are still looking for some documentation.
-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:If you're reading the detail of each event anyway, simply exit the loop after you encounter the "job starting" event.
Ray,

I am struggling to find the job starting event.
Is there any built in functions available for finding the starting event id?

i have a parallel job in job activity.Once the job gets aborted , i need to mail the log information via routine.
That's what i am trying to achieve.

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

Post by chulett »

Seriously? I'm not sure how many more ways I can explain it without writing the code for you. Did you check the documentation link I posted?
-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 »

Sorry Craig!!

My understanding is:

I am running the routine once the job gets aborted.
So using DSGetNewestLogId() ,i can get the newest log id.i.e last event.

e.g:job123 abrted.

now i need to go to previous entry .

in the loop i am traversing backwards.

So how to find the recent start event id, so that i can exit from the loop,

One of the way i am thinking is..before job activity stage, i need to find the recent event id first.so after the job run, i will loop between current_recent_event id to last_recent_event_id+1

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

Post by pandeesh »

i have tried the below code:

Code: Select all

hJob = DSAttachJob(JobName, DSJ.ERRNONE) 

iLatestLogID = DSGetNewestLogId(hJob, DSJ.LOGFATAL) 

IdList  =  DSGetLogEventIds (hJob,0,'F')

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

next iEventID


Ans = vEventDetail
but it throws the below errors:

Code: Select all

0015    IdList  =  DSGetLogEventIds (hJob,0,'F')

                                      ^
',' unexpected, Was expecting: '!', ')', '=', "AND", "OR", "LT", "LE", 
"GT", "GE", "NE", "EQ", "MATCH"
Array 'DSGetLogEventIds' never dimensioned.

2 Errors detected, No Object Code Produced.
Am i missing anything?

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

Post by chulett »

Yes. Reread the syntax for the DSGetLogEventIds function at the link provided, you are not calling it correctly.
-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 »

In the documentation, it's given as

Code: Select all

IdList = DSGetLogEventIds (JobHandle, RunNumber, EventTypeFilter)
Thats what i have followed in my code.

Code: Select all

hJob = DSAttachJob(JobName, DSJ.ERRNONE)

IdList  =  DSGetLogEventIds (hJob,0,'F')
 
pandeeswaran
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

In the documentation I linked, it's given as:

Code: Select all

int DSGetLogEventIds(
      DSJOB JobHandle
,
      int RunNumber,
      char *
Filter,
      char **
List
);
So the "List" of returned IDs is one of the function arguments, the "int" it shows holds the returned status of the function call.
Return Values
If the function succeeds, the return value is DSJE_NOERROR.

If the function fails, the return value is one of the following:

Token: Description
DSJE_BADHANDLE: Invalid job handle.
DSJE_BADTYPE: Invalid Filter value.
DSJE_BADVALUE: Invalid RunNumber value.
See if that helps.
-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 »

Craig,

I don't think the syntax is incorrect.
i am getting the same error even if i specify the 4th argument.
i have tried the below code with reference to the post:

viewtopic.php?t=123872&highlight=DSGetLogEventIds

Code: Select all

IdList=Ereplace(DSGetLogEventIds(hJob, 0, 'F') , \"\\\" , @FM, 1) 
But i am getting the same error.
pandeeswaran
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Ah... that's an 8.x function, hence the "never dimensioned" error when you try to use it in a 7.x environment.
-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 »

Alas!!so, is there any equivalent function available in 7.x for finding recent starting event id?
i don't think we can get the recent starting event via DSGetNewestLogID.
Because it returns the last event of the recent run
pandeeswaran
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

pandeesh wrote:So, is there any equivalent function available in 7.x for finding recent starting event id? i don't think we can get the recent starting event via DSGetNewestLogID. Because it returns the last event of the recent run
Of course there is a way and it's what I've been harping on you about from the beginning. Read the documentation I linked to which starts you off right at that function. Examine the nine different valid values for the EventType argument. You've stubbornly been sticking with DSJ_LOGANY when there are eight others to choose from, including DSJ_LOGSTARTED.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply