We have the following bit of code as part of a routine
**********************************************************
writeJobLogToFile:
v_jobLogFileName = v_FileNamePrefix : '_JobLog.txt'
v_maxEventID = DSGetNewestLogId ( v_jobHandle, DSJ.LOGANY)
if ((v_maxEventID <= 0) or (v_maxEventID = DSJE.BADTYPE)) then
v_logSummary = ""
call DSLogWarn("Error Accessing Max Event ID for JobLog", c_routineName)
end
else
v_logSummary = DSGetLogSummary ( v_jobHandle, DSJ.LOGANY, DSJobStartTimestamp, "" , c_maxLogLines)
end
* Loop to get each Job Log Event Detail and concatenate into v_logText
v_logText = 'Event Timestamp\User\Event Type\Event Details'
v_eventDetail = ''
i = 1
v_eventID = Field(v_logSummary<i>, '\', 1)
Loop While v_eventID<>''
v_eventDetail = DSGetLogEntry (v_jobHandle, v_eventID)
if v_eventDetail = DSJE.BADVALUE then
call DSLogWarn("Error Accessing Event ID ":v_eventID, c_routineName)
Exit
end
else
v_logText := CHAR(10) : Exchange(Exchange(v_eventDetail, '0D', 'FF'), '0A', 'FF')
end
i = i+1
v_eventID = Field(v_logSummary<i>, '\', 1)
Repeat
Openpath v_logFolder to t.fvar2 then
write v_logText to t.fvar2, v_jobLogFileName else
call DSLogWarn("Failed to write file ":v_jobLogFileName:" to directory ":v_logFolder, c_routineName)
GoTo ExitWriteJobLogToFile
end
end
else
call DSLogWarn("Failed to open directory ":v_logFolder, c_routineName)
GoTo ExitWriteJobLogToFile
end
close t.fvar2
ExitWriteJobLogToFile:
Return
**********************************************************
As you see in this we concate all the event messages into one variable v_logText . We came across a warning in the DS Log that is more than varchar(2000). Whenever we get this message this routine is aborting.
Was wondering if it is beacuse the concatenated value has exceeded the size that this variable can hold.
Any suggestions pls.
Katz
Routine Variable Limitation
Moderators: chulett, rschirm, roy
-
- Charter Member
- Posts: 560
- Joined: Wed Jul 13, 2005 5:36 am
- Location: Ohio
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Make sure there is no space between any function name and its opening (left) parenthesis. DataStage BASIC can be finicky about this.
There is no limit to the length of a string variable in DataStage BASIC until you run out of virtual memory. By assembling the entire log into a single string to be written with a single WRITE statement this may be happening (unrelated to any particular log event, but certainly exacerbated thereby).
A better approach would be one that writes a single line at a time into your output file. Open with OpenSeq (or, better, with the OpenSequentialFile function that can be found on the forum), and write lines with WriteSeq. Remember to CloseSeq any file thus opened.
There is no limit to the length of a string variable in DataStage BASIC until you run out of virtual memory. By assembling the entire log into a single string to be written with a single WRITE statement this may be happening (unrelated to any particular log event, but certainly exacerbated thereby).
A better approach would be one that writes a single line at a time into your output file. Open with OpenSeq (or, better, with the OpenSequentialFile function that can be found on the forum), and write lines with WriteSeq. Remember to CloseSeq any file thus opened.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.