write a Routine

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
eoyylo
Participant
Posts: 57
Joined: Mon Jun 30, 2003 6:56 am

write a Routine

Post by eoyylo »

Hi,
i need to write a new routine that analyze the DataStage director log and write it in a table.

In the past i used a Job contol code that did it. The code was:

hJob = DSAttachJob("JOB1", DSJ.ERRFATAL)

STATO = DSGetJobInfo(hJob, DSJ.JOBSTATUS)
EVENT_ID = DSGetNewestLogId(hJob,DSJ.LOGANY)-1
LOGSTRING = DSGetLogEntry(hJob,EVENT_ID)
TIME_STOP = CHANGE(Substrings(LOGSTRING,1,19)," ","_")
TIME_START = CHANGE(DSGetJobInfo(hJob, DSJ.JOBSTARTTIMESTAMP)," ","_")
ROW_WRITE = DSGetLinkInfo(hJob,"T_W","L_W",DSJ.LINKROWCOUNT)
ROW_ERR = DSGetLinkInfo(hJob,"T_W","L_ERR",DSJ.LINKROWCOUNT)




Now I have to use a Routin and I 'd like to use the same code but I have compilation errors:

Compiling: Source = 'DSU_BP/DSU.EBISLog', Object = 'DSU_BP.O/DSU.EBISLog'
***?
0039 ROW_WRITE = DSGetLinkInfo(hJob,"T_W","L_W",DSJ.LINKROWCOUNT)

^
',' unexpected, Was expecting: '!', ')', '=', "AND", "OR", "LT", "LE",
"GT", "GE", "NE", "EQ", "MATCH"
0040 ROW_ERR = DSGetLinkInfo(hJob,"T_W","L_ERR",DSJ.LINKROWCOUNT)

^
',' unexpected, Was expecting: '!', ')', '=', "AND", "OR", "LT", "LE",
"GT", "GE", "NE", "EQ", "MATCH"
0045 ROW_READ = DSGetLinkInfo(hJob,"T_R","L_R",DSJ.LINKROWCOUNT)

^
',' unexpected, Was expecting: '!', ')', '=', "AND", "OR", "LT", "LE",
"GT", "GE", "NE", "EQ", "MATCH"
0048 ROW_READ = DSGetLinkInfo(hJob,"T_W","L_R",DSJ.LINKROWCOUNT)

^
WARNING: Text found after final END statement

Array 'DSAttachJob' never dimensioned.
WARNING: Variable 'DSJ.ERRFATAL' never assigned a value.
Array 'DSGetJobInfo' never dimensioned.
WARNING: Variable 'DSJ.JOBSTATUS' never assigned a value.
Array 'DSGetNewestLogId' never dimensioned.
WARNING: Variable 'DSJ.LOGANY' never assigned a value.
Array 'DSGetLogEntry' never dimensioned.
WARNING: Variable 'DSJ.JOBSTARTTIMESTAMP' never assigned a value.
Array 'DSGetLinkInfo' never dimensioned.
WARNING: Variable 'DSJ.STAGELIST' never assigned a value.

8 Errors detected, No Object Code Produced.




I modified the code with the "Deffun" obtaining


Deffun DSAttachJob
Deffun DSGetLinkInfo


hJob = DSAttachJob(JOBID, DSJ.ERRFATAL)

STATO = DSGetJobInfo(hJob, DSJ.JOBSTATUS)
EVENT_ID = DSGetNewestLogId(hJob,DSJ.LOGANY)-1
LOGSTRING = DSGetLogEntry(hJob,EVENT_ID)
TIME_STOP = CHANGE(Substrings(LOGSTRING,1,19)," ","_")
TIME_START = CHANGE(DSGetJobInfo(hJob, DSJ.JOBSTARTTIMESTAMP)," ","_")
ROW_WRITE = DSGetLinkInfo(hJob,"T_W","L_W",DSJ.LINKROWCOUNT)
ROW_ERR = DSGetLinkInfo(hJob,"T_W","L_ERR",DSJ.LINKROWCOUNT)
StageList = DSGetJobInfo (hJob,DSJ.STAGELIST)
StageList=" ":CHANGE(StageList,","," , "):" "




and the copiling error now are:

Compiling: Source = 'DSU_BP/DSU.EBISLog', Object = 'DSU_BP.O/DSU.EBISLog'
***??
0036 hJob = DSAttachJob(JOBID, DSJ.ERRFATAL)

^
Incorrect number of arguments

0043 ROW_WRITE = DSGetLinkInfo(hJob,"T_W","L_W",DSJ.LINKROWCOUNT)

^
Incorrect number of arguments

0044 ROW_ERR = DSGetLinkInfo(hJob,"T_W","L_ERR",DSJ.LINKROWCOUNT)

^
Incorrect number of arguments

0049 ROW_READ = DSGetLinkInfo(hJob,"T_R","L_R",DSJ.LINKROWCOUNT)

^
Incorrect number of arguments

0052 ROW_READ = DSGetLinkInfo(hJob,"T_W","L_R",DSJ.LINKROWCOUNT)

^
WARNING: Text found after final END statement

Array 'DSGetJobInfo' never dimensioned.
WARNING: Variable 'DSJ.JOBSTATUS' never assigned a value.
Array 'DSGetNewestLogId' never dimensioned.
WARNING: Variable 'DSJ.LOGANY' never assigned a value.
Array 'DSGetLogEntry' never dimensioned.
WARNING: Variable 'DSJ.JOBSTARTTIMESTAMP' never assigned a value.
WARNING: Variable 'DSJ.STAGELIST' never assigned a value.

7 Errors detected, No Object Code Produced.




The questions are:
Is it possible to use the DSAttachJob or DSGetLinkInfo function in a Routine? How is it possible to do it?
Why do I obtain the "Variable 'DSJ.STAGELIST' never assigned a value." error?


Thanks in advance

Regards

Mario
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Hello eoyylo,

Please add

Code: Select all

$INCLUDE DSINCLUDE JOBCONTROL.H
to the beginning of your program and see what the compiler has to say; your compiler messages are due to the functions not being detected, and your DEFFUN don't have the correct number of parameters.
Post Reply