Event Type From DSGetLogEntry

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
palmeal
Participant
Posts: 122
Joined: Thu Oct 14, 2004 7:56 am
Location: Edinburgh, Scotland

Event Type From DSGetLogEntry

Post by palmeal »

I am using DSGetLogEntry to pull back Server Job information from the Director Log and am noticing some extra characters being returned - I'm hoping that there is a simple explanation for this.

The (abbreviated) code I have is as follows:

MAXREJ = 0
getsummary = DSGetLogSummary(JobHandle, DSJ.LOGANY, started, finished, MAXREJ )

RejInfoId = getsummary<1>

RejInfo = DSGetLogEntry(JobHandle, substrings(RejInfoId,1,4))


event_type = Substrings(RejInfo,Index(RejInfo ,'\',2) +1, (Index
(RejInfo ,'\',3) - (Index(RejInfo ,'\',2) +1)))

BEGIN CASE
CASE event_type= "1"
event_typet3 = "INFO"
CASE event_type= "2"
event_type= "WARNING"
CASE event_type= "3"
event_type= "FATAL"
CASE event_type = "5"
event_type= "CONTROL"
CASE event_type = "7"
event_type= "RUNJOB"
END CASE

I then write the event_type to both a file and the Director Log. The code does translate a 1 to INFO, 2 to WARNING etc some of the time. Other times I am getting the correct event type + extra characters. See below - a 5 is returned but then loads of spaces and then a "t".

"job_seq5..JobControl (EVENT TYPE): 5



t"

If I amend

CASE event_type = "5"
event_type= "CONTROL"

to

CASE substrings(event_type1,1 = "5"
event_type= "CONTROL"

then I still get the same message as above.

Another example is :

"job_seq5..JobControl (EVENT TYPE): 1
e
n

/

a
p


l
l
0


1

t




/




/
l
/





a
E
d
p
S

o
I
/
r"

Has anyone come across this before and if so how do I get around this. The code does bring back what I required slightly more than half of the time.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Palmeal,

You should use a different function for your substring, that is where your error is originating.

The output of field 1 is in the form ""14170\2005-05-30 09:39:44\5\\21\Starting Job JdDSSJOBCheckJobControl. (...)"."

(note that when I try it I get a 5 digit message number)

To parse the String execute:

(a) MessageNumber = FIELD(getsummary,'\',1)
(b) MessageDate = FIELD(getsummary,'\',2)

and you should get the idea from there :wink:
palmeal
Participant
Posts: 122
Joined: Thu Oct 14, 2004 7:56 am
Location: Edinburgh, Scotland

Post by palmeal »

Cheers Arnd - that worked a treat. Your help has saved me countless hours in the past few weeks and is very much appreciated.
Gets me thinking about one of my favourite holiday destinations (Nice) every time you reply - visited the the last two years and I can taste the Leffe !!!!

Still don't know why the substrings worked most of the time but not all. It failed for the information below - it pulled out the 2 and then a whole load of nonsense - suppose this is now academic and I won't use my previous method again

2005-05-30 09:01:36\palmeal\2\ServerAvailable.SQLSERVERLink.DSLink
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Palmeal - Your substrings depending on everything having a fixed length & position, so your parsing returned odd values when that was not the case. I can just say "been there, done that" :)

Nice is just fine right now - this weekend was awesome and the beaches in Cannes and Antibes are full {of attractive ladies}. Summer has arrived with a *bang* but they are still interviewing for 2 open PX developer slots...
palmeal
Participant
Posts: 122
Joined: Thu Oct 14, 2004 7:56 am
Location: Edinburgh, Scotland

Post by palmeal »

I don't have any PX knowledge unfortunatley and have only been using DataStage in anger for 4 months now - I'll get there however.

I do remember the views in and around Nice being very pleasant on the eye 8) (as I'm sure the wife did as well).
Post Reply