Image not found Collapse All | Expand All | Show Default

KgdGenHtmlRoutineDocs
DataStage Job Report
Generated 2004-06-30 10:48:02pm

 - Job Design  
Image not found
 - Job Information  
 - Job Properties (8) 
Property Value
Object Type Server 
Short Description kduke 2004-06-15 created  
Full Description
Job: KgdGenHtmlRoutineDocs
=================================================================
Description:
This job documents DataStage routines.
=================================================================
Parameters:
1. FilePath
2. LogoPath - jpg to display on top page of all html
3. CategoryToDoc - Category or All or Routine name
=================================================================
Sources:
DS_ROUTINES
=================================================================
Targets:
KimD/Routines/{RoutineName}.html
=================================================================
To use in next job:
none
=================================================================
Modification History
=================================================================
Developer Date Modification description
======== ========= ==============================================
kduke 2004-06-15 created
======== ========= ==============================================  
Category UserDefined\KimD 
Multiple Instance False 
Job Version Number 40.0.0 
Hash File Cache Sharing False 
Job Control
* -----------------------------------------------------------------
* Job: KgdGenHtmlRoutineDocs
* -----------------------------------------------------------------
* Description:
* Document DataStage Routines.
* -----------------------------------------------------------------
* Created by: Kim Duke June 15, 2004
* -----------------------------------------------------------------
* $INCLUDE DSINCLUDE JOBCONTROL.H
* -----------------------------------------------------------------
DEFFUN KgdMakeDir(DirName) CALLING "DSU.KgdMakeDir"
* -----------------------------------------------------------------
DEFFUN KgdGenHtmlHeader(ObjectName,Title,LogoPath) CALLING "DSU.KgdGenHtmlHeader"
DEFFUN KgdGenHtmlDiv(DivName,DivDesc,IndentLevel) CALLING "DSU.KgdGenHtmlDiv"
DEFFUN KgdGenHtmlTableHeader(ColNames,ColWidths,IndentLevel) CALLING "DSU.KgdGenHtmlTableHeader"
DEFFUN KgdGenHtmlTableRows(ColValues,NoOfCols) CALLING "DSU.KgdGenHtmlTableRows"
DEFFUN KgdGenHtmlFooter(NotUsed) CALLING "DSU.KgdGenHtmlFooter"
* -----------------------------------------------------------------
JobName = "KgdGenHtmlRoutineDocs"
Title = 'DataStage Routine Report'
Now = oconv(@DATE, "D4-YMD[4,2,2]"):' ':oconv(@TIME, "MTHS")
ThisDay = convert('-','',oconv(@DATE, "D4-YMD[4,2,2]"))
NotUsed = ''
* parameter now LogoPath = "dcibanner.jpg"
If System(91) = 0 Then
Shell = "UNIX"
Sep = '/'
OtherSep = '\'
End Else
Shell = "DOS"
Sep = '\'
OtherSep = '/'
End
convert OtherSep to Sep in LogoPath
convert OtherSep to Sep in FilePath
RoutinePath = FilePath:"KimD":Sep:"Routines":Sep:ThisDay
DirName = RoutinePath
HashFile = "DS_ROUTINES"
open HashFile to DsRoutines else
Call DSLogInfo("Error: Unable to open " : HashFile, JobName)
goto TheEnd
end
Call DSLogInfo("KgdMakeDir(":RoutinePath:")", JobName)
x = KgdMakeDir(RoutinePath)
openpath RoutinePath to RoutineDir else
Call DSLogInfo("Error: Unable to open " : RoutinePath, JobName)
goto TheEnd
end
Call DSLogInfo("Writing Routines Html to " : RoutinePath, JobName)
RecCnt = 0
* -----------------------------------------------------------------
* select routines
* -----------------------------------------------------------------
cmd = "SSELECT DS_ROUTINES"
cmd := ' UNLIKE "\..."'
if downcase(CategoryToDoc) <> "all" then
cmd := ' AND WITH CATEGORY LIKE "':CategoryToDoc:'..."'
end
Call DSLogInfo(cmd, JobName)
execute cmd capturing output
Call DSLogInfo(output, JobName)
SecondChance = @true
RoutineList = ''
CategoryList = ''
loop while readnext RoutineName
NoneSelected:
read RoutineRec from DsRoutines, RoutineName then
RecCnt += 1
RoutineList<1, RecCnt> = RoutineName:'.html'
Category = RoutineRec<3>
CategoryList<1, RecCnt> = Category
SubType = RoutineRec<2>
if SubType = 'CRoutine' then
SubType = 'Transform Function'
end else
SubType = 'Before/After Routine'
end
ShortDesc = RoutineRec<4>
LongDesc = RoutineRec<5>
RoutineType = RoutineRec<6>
ArgCount = RoutineRec<7>
Author = RoutineRec<11>
Version = RoutineRec<12>
Code = RoutineRec<15>
ArgMV = RoutineRec<43>
ArgDescMV = RoutineRec<44>
Code = change(Code, char(13):char(10), @vm)
CodeCnt = 1
NoOfLines = dcount(Code<1>, @VM)
for i=1 to NoOfLines
CodeCnt<1, i> = i
next i
Call DSLogInfo('KgdGenHtmlHeader(':RoutineName:',':Title:',':LogoPath:')', JobName)
HtmlDoc = KgdGenHtmlHeader(RoutineName,Title,LogoPath)
* -----------------------------------------------------------------
* start rtninfo division
* -----------------------------------------------------------------
DivName = "rtninfo"
DivDesc = "Routine Information"
IndentLevel = 0
Call DSLogInfo('KgdGenHtmlDiv(':DivName:',':DivDesc:',':IndentLevel:')', JobName)
GenHtml = KgdGenHtmlDiv(DivName,DivDesc,IndentLevel)
HtmlDoc := @FM:GenHtml
HtmlDoc<-1> = '<br>'
* -----------------------------------------------------------------
* start rtninfo table
* -----------------------------------------------------------------
ColNames = "Property"
ColNames<2> = "Value"
* -----------------------------------------------------------------
ColWidths = "20"
ColWidths<-1> = "80"
* -----------------------------------------------------------------
IndentLevel = 1
Call DSLogInfo('KgdGenHtmlTableHeader(':ColNames:',':ColWidths:',':IndentLevel:')', JobName)
GenHtml = KgdGenHtmlTableHeader(ColNames,ColWidths,IndentLevel)
HtmlDoc := @FM:GenHtml
* -----------------------------------------------------------------
ColValues = ""
ColValues<1, -1> = "SubType"
ColValues<2, -1> = SubType:" "
ColValues<1, -1> = "Category"
ColValues<2, -1> = Category:" "
ColValues<1, -1> = "Author"
ColValues<2, -1> = Author:" "
ColValues<1, -1> = "Arg Count"
ColValues<2, -1> = ArgCount:" "
ColValues<1, -1> = "Version"
ColValues<2, -1> = Version:" "
ColValues<1, -1> = "Routine Type"
ColValues<2, -1> = RoutineType:" "
ColValues<1, -1> = "Short Description"
ColValues<2, -1> = ShortDesc:" "
ColValues<1, -1> = "Long Description"
ColValues<2, -1> = LongDesc:" "
QuoteFlag = @false
NoOfCols = dcount(ColNames, @FM)
Call DSLogInfo('KgdGenHtmlTableRows(ColValues,':NoOfCols:')', JobName)
GenHtml = KgdGenHtmlTableRows(ColValues,NoOfCols)
HtmlDoc := @FM:GenHtml
* -----------------------------------------------------------------
* close table and divisions
* -----------------------------------------------------------------
* HtmlDoc<-1> = '</table>'
HtmlDoc<-1> = '</div>'
HtmlDoc<-1> = '</div>'
HtmlDoc<-1> = '<br>'
* -----------------------------------------------------------------
* start arguments division
* -----------------------------------------------------------------
DivName = "arguments"
DivDesc = "Arguments"
IndentLevel = 0
Call DSLogInfo('KgdGenHtmlDiv(':DivName:',':DivDesc:',':IndentLevel:')', JobName)
GenHtml = KgdGenHtmlDiv(DivName,DivDesc,IndentLevel)
HtmlDoc := @FM:GenHtml
HtmlDoc<-1> = '<br>'
* -----------------------------------------------------------------
* start arguments table
* -----------------------------------------------------------------
ColNames = "Argument"
ColNames<2> = "Description"
* -----------------------------------------------------------------
ColWidths = "20"
ColWidths<2> = "80"
* -----------------------------------------------------------------
IndentLevel = 1
Call DSLogInfo('KgdGenHtmlTableHeader(':ColNames:',':ColWidths:',':IndentLevel:')', JobName)
GenHtml = KgdGenHtmlTableHeader(ColNames,ColWidths,IndentLevel)
HtmlDoc := @FM:GenHtml
* -----------------------------------------------------------------
ColValues = ArgMV
ColValues<2> = ArgDescMV
QuoteFlag = @false
NoOfCols = dcount(ColNames, @FM)
Call DSLogInfo('KgdGenHtmlTableRows(ColValues,':NoOfCols:')', JobName)
GenHtml = KgdGenHtmlTableRows(ColValues,NoOfCols)
HtmlDoc := @FM:GenHtml
* -----------------------------------------------------------------
* close table and divisions
* -----------------------------------------------------------------
HtmlDoc<-1> = '</div>'
HtmlDoc<-1> = '<br>'
* -----------------------------------------------------------------
* start sourcecode division
* -----------------------------------------------------------------
DivName = "sourcecode"
DivDesc = "Source Code"
IndentLevel = 0
Call DSLogInfo('KgdGenHtmlDiv(':DivName:',':DivDesc:',':IndentLevel:')', JobName)
GenHtml = KgdGenHtmlDiv(DivName,DivDesc,IndentLevel)
HtmlDoc := @FM:GenHtml
HtmlDoc<-1> = '<br>'
* -----------------------------------------------------------------
* start arguments table
* -----------------------------------------------------------------
ColNames = "LineNo"
ColNames<2> = "Source Code"
* -----------------------------------------------------------------
ColWidths = "10"
ColWidths<2> = "90"
* -----------------------------------------------------------------
IndentLevel = 1
Call DSLogInfo('KgdGenHtmlTableHeader(':ColNames:',':ColWidths:',':IndentLevel:')', JobName)
GenHtml = KgdGenHtmlTableHeader(ColNames,ColWidths,IndentLevel)
HtmlDoc := @FM:GenHtml
* -----------------------------------------------------------------
ColValues = CodeCnt
ColValues<2> = Code
QuoteFlag = @true
NoOfCols = dcount(ColNames, @FM)
Call DSLogInfo('KgdGenHtmlTableRows(ColValues,':NoOfCols:')', JobName)
GenHtml = KgdGenHtmlTableRows(ColValues,NoOfCols)
HtmlDoc := @FM:GenHtml
* -----------------------------------------------------------------
* close table and divisions
* -----------------------------------------------------------------
HtmlDoc<-1> = '</div>'
HtmlDoc<-1> = '<br>'
* -----------------------------------------------------------------
* footer
* -----------------------------------------------------------------
Call DSLogInfo('KgdGenHtmlFooter(':NotUsed:')', JobName)
GenHtml = KgdGenHtmlFooter(NotUsed)
HtmlDoc := @FM:GenHtml
* -----------------------------------------------------------------
* write documents to disk
* -----------------------------------------------------------------
HtmlId = RoutineName:'.html'
Call DSLogInfo("Writing " : HtmlId :" to " : RoutinePath, JobName)
write HtmlDoc on RoutineDir, HtmlId else
Call DSLogInfo("Error: Unable to write to " : RoutinePath, JobName)
goto TheEnd
end
end
* test mode goto TheEnd
repeat
* -----------------------------------------------------------------
* End of routines
* -----------------------------------------------------------------
if RecCnt = 0 and SecondChance then
SecondChance = @false
RoutineName = CategoryToDoc
goto NoneSelected
end
gosub GenIndex
Call DSLogInfo(RecCnt:" rows written to ":RoutinePath, JobName : "JobControl")
* -----------------------------------------------------------------
goto TheEnd
* -----------------------------------------------------------------
* index html page to all routines just generated
* -----------------------------------------------------------------
GenIndex:
if RecCnt > 1 then
RoutineName = CategoryToDoc:'_Index'
HtmlDoc = ''
Call DSLogInfo('KgdGenHtmlHeader(':RoutineName:',':Title:',':LogoPath:')', JobName)
GenHtml = KgdGenHtmlHeader(RoutineName,Title,LogoPath)
HtmlDoc = GenHtml
* -----------------------------------------------------------------
* start rtninfo division
* -----------------------------------------------------------------
DivName = "rtnindex"
DivDesc = "Routine Index "
IndentLevel = 0
Call DSLogInfo('KgdGenHtmlDiv(':DivName:',':DivDesc:',':IndentLevel:')', JobName)
GenHtml = KgdGenHtmlDiv(DivName,DivDesc,IndentLevel)
HtmlDoc := @FM:GenHtml
HtmlDoc<-1> = '<br>'
* -----------------------------------------------------------------
* start rtninfo table
* -----------------------------------------------------------------
ColNames = "Routine"
ColNames<2> = "Category"
* -----------------------------------------------------------------
ColWidths = "50"
ColWidths<-1> = "50"
* -----------------------------------------------------------------
IndentLevel = 1
Call DSLogInfo('KgdGenHtmlTableHeader(':ColNames:',':ColWidths:',':IndentLevel:')', JobName)
GenHtml = KgdGenHtmlTableHeader(ColNames,ColWidths,IndentLevel)
HtmlDoc := @FM:GenHtml
* -----------------------------------------------------------------
ColValues = ""
ColValues<1> = RoutineList
ColValues<2> = CategoryList
QuoteFlag = @false
NoOfCols = dcount(ColNames, @FM)
Call DSLogInfo('KgdGenHtmlTableRows(ColValues,':NoOfCols:')', JobName)
GenHtml = KgdGenHtmlTableRows(ColValues,NoOfCols)
HtmlDoc := @FM:GenHtml
* -----------------------------------------------------------------
* close table and divisions
* -----------------------------------------------------------------
HtmlDoc<-1> = '</div>'
* HtmlDoc<-1> = '</div>'
* -----------------------------------------------------------------
* sort by category
* -----------------------------------------------------------------
if downcase(CategoryToDoc) = "all" then
* -----------------------------------------------------------------
* start rtninfo division
* -----------------------------------------------------------------
DivName = "rtncatindex"
DivDesc = "Routine Index by Category"
IndentLevel = 0
Call DSLogInfo('KgdGenHtmlDiv(':DivName:',':DivDesc:',':IndentLevel:')', JobName)
GenHtml = KgdGenHtmlDiv(DivName,DivDesc,IndentLevel)
HtmlDoc := @FM:GenHtml
HtmlDoc<-1> = '<br>'
* -----------------------------------------------------------------
cmd = "SSELECT DS_ROUTINES"
cmd := ' UNLIKE "\..."'
cmd := ' BY CATEGORY '
Call DSLogInfo(cmd, JobName)
execute cmd capturing output
Call DSLogInfo(output, JobName)
* -----------------------------------------------------------------
RoutineList = ''
CategoryList = ''
RecCnt = 0
loop while readnext RoutineName
read RoutineRec from DsRoutines, RoutineName then
RecCnt += 1
RoutineList<1, RecCnt> = RoutineName:'.html'
Category = RoutineRec<3>
CategoryList<1, RecCnt> = Category
end
repeat
* -----------------------------------------------------------------
* start rtninfo table
* -----------------------------------------------------------------
ColNames = "Category"
ColNames<2> = "Routine"
* -----------------------------------------------------------------
ColWidths = "50"
ColWidths<-1> = "50"
* -----------------------------------------------------------------
IndentLevel = 1
Call DSLogInfo('KgdGenHtmlTableHeader(':ColNames:',':ColWidths:',':IndentLevel:')', JobName)
GenHtml = KgdGenHtmlTableHeader(ColNames,ColWidths,IndentLevel)
HtmlDoc := @FM:GenHtml
* -----------------------------------------------------------------
ColValues = ""
ColValues<1> = CategoryList
ColValues<2> = RoutineList
QuoteFlag = @false
NoOfCols = dcount(ColNames, @FM)
Call DSLogInfo('KgdGenHtmlTableRows(ColValues,':NoOfCols:')', JobName)
GenHtml = KgdGenHtmlTableRows(ColValues,NoOfCols)
HtmlDoc := @FM:GenHtml
* -----------------------------------------------------------------
* close table and divisions
* -----------------------------------------------------------------
HtmlDoc<-1> = '</div>'
end
* -----------------------------------------------------------------
* close table and divisions
* -----------------------------------------------------------------
HtmlDoc<-1> = '</div>'
HtmlDoc<-1> = '<br>'
RoutineName = convert('\/','__',CategoryToDoc):'_Index'
* -----------------------------------------------------------------
* footer
* -----------------------------------------------------------------
Call DSLogInfo('KgdGenHtmlFooter(':NotUsed:')', JobName)
GenHtml = KgdGenHtmlFooter(NotUsed)
HtmlDoc := @FM:GenHtml
* -----------------------------------------------------------------
* write documents to disk
* -----------------------------------------------------------------
HtmlId = convert('\/','__',RoutineName):'.html'
Call DSLogInfo("Writing " : HtmlId :" to " : RoutinePath, JobName)
write HtmlDoc on RoutineDir, HtmlId else
Call DSLogInfo("Error: Unable to write to " : RoutinePath, JobName)
goto TheEnd
end
end
return
* -----------------------------------------------------------------
* exit program here
* -----------------------------------------------------------------
TheEnd:  
 - Parameters (3) 
Parameter Name Prompt Default Value Help Text
FilePath  FilePath  ./   
LogoPath  LogoPath  ../OurLogo.jpg   
CategoryToDoc  Category or All  All   
 - Stages (0) 

 - Source Stages (0) 
 - Processing Stages (0) 
 - Target Stages (0) 

Ascential and DataStage are trademarks of Ascential Software Corporation or its affiliates and may be registered in the United States or other jurisdictions. For questions or comments regarding this utility, contact tony.curcio@ascentialsoftware.com.