Beruflich Dokumente
Kultur Dokumente
Thisexampleshowshowtobursttothefilesystem,andincludeapostprocessingETL.Itdoesnotusetheinbuilt
Cognospostprocessingscriptasweonlywantthescripttorunwhenthisonereportisbursttothefilesystem.
Challengesthatarehandledthiswayinclude:
Onlyrunpostprocessingscriptonasinglereportoutputtofilesystem,notallreports.
RenamingofPDFfiletoeliminatelanguagespecificationaddedbyCognos(enus).
Deletingthexmlfilethatisalsocreatedwhenburstingtothefilesystem.
Step1:ConfiguretheCognosinstance
InCognosConfigurationmakesuretheoptionforSavereportoutputstoafilesystem?issettotrue.Thiscanbe
foundunder[LocalConfiguration].[DataAccess].[ContentManger].
Next,underActionsmenu,chooseGlobalConfiguration.ThenontheGeneraltabsettheArchiveLocationFile
SystemRoot.Thiswillbetherootdirectorywhereyouwilllatercreatesubdirectoriestostorereportoutputs.You
cancreateasmanysubdirectoriesasyoulike,buttheywillallhavetobecontainedunderthisoneroot.Itshouldbe
createdasaURI.Thehelpdocumentsareprettyclearbuthereissyntax:
file://\\<server>\<fileshare
>.
YouwillneedtorestarttheCognosServicefortheconfigurationchangestotakeeffect.
Step2:CreateafilesystemlocationinCognosConnection
InCognosConnectiongotoLaunchthenCognosAdministration.GototheConfigurationtabandchoose
DispatchersandServices.ThenchoosetheiconforDefineFileSystemLocations.
ClickNew,andgivethefilesystemlocationaname.Also,makesurethatyourconfigurationofthefilesystemroot
locationtookeffect.IfthefilesystemrootlocationisnotfilledoutwiththelocationyoudefinedinCognos
Configuration,somethingdidnttake.IBMhasaKBarticleonthis,butIfoundthatsometimesitjusttakesacouple
triestomakeitwork.Itshouldlooksomethinglikethis:
Nowyoucandefinethesubdirectoryyouwanttostorethereportsto.Use\\inthebeginning.Idontknowwhy
youneedtouse\\,butthatswhatIdidtomakeitwork.Also,makesureyouhavecreatedthesubdirectoryinthe
filesystem.
Step3:CreateaSSISpackagethatwillprocesseachreportfilecreatedbyCognosduringthefilesystemburst
ThisexampleusesSSIS2005butcanprobablybeportedtootherETLtoolsorjustscriptedintoa.batfile.Imnot
goingtogointodetailsabouthowtocreatetheSSISpackage,butwillbrieflyexplainonewaytodeletethe.xmlfiles
Cognoscreatesaspartofwritingtothefilesystemandalsohowtorenamethefiletoeliminatetheenuslanguage
designationthatCognosaddstotheoutputfiles.
Todeletethexmlfilesstartbycreatingaforeachloop,toloopthrougheachXMLfileinthedirectorywhereCognos
outputthereports.Thenuseafilesystemdeletetasktodeletethefile.Makesuretodefinethesourceofthefile
systemtasktobeavariabledefinedbytheloop.
Toremovetheenuslanguagedesignationfromthereportoutput,againcreateaforeachloop.Butthistimeloop
overthereports,onlylookingforfilesthatarelike*enus*.PDF.Mightnotbepdf,thisdependsonhowyouhad
Cognosoutputthereports.Thendefineafilesystemtasktorenamethefiletoremovetheenus.
Onethingtonoteisthatyouwillnotbeabletorenameordeletefilesthatareopen,andlocked,byanotherprocess.
Thiscancreatechallenges.Therearelotsofwaystodealwiththis,butthebestisprobablytokickeveryoneoffthe
filesharebeforerunningtheseprocesses.
Step4:Createstoredproceduretokickoffscript
CreateastoredprocedurethattakesthefullpathoftheSSISpackageasaparameter.Thenusexp_cmdshelltorun
theDTEXEC.execommandlineSSISexecutable.ThiswillcausetheservertoruntheSSISpackage.Asanalternative
youcoulduseaSQLAgentjoband/orstoretheSSISpackageontheserver.
CREATE
P ROCEDURE
[dbo]
.
[ ExecuteSSIS]
packagepathparam.
notethatthereisabuginxm_cmdShellknownbyMSthatonlyallowsoneset
ofdouplequotes.Thismeanswecannotexecutepackagesstoredatpathsthat
includespacesinthepath.Youcanfinddocumentationonthisbugifyou
googleit.
@DtsxPath
v archar
(
2 000
)
AS
BEGIN
SET
N OCOUNT
O N
buildcommandlinestring.
DECLARE
@CmdString
v archar
(
2 500
)
SET
@CmdString
=
' "C:\ProgramFiles\MicrosoftSQLServer\90\DTS\Binn\DTEXEC.exe"
/FILE'
+
@DtsxPath
EXEC
x p_cmdshell
@ CmdString
END
Step5:Createareporttokickoffthestoredprocedure
ThisleveragesstoredprocedurequerysubjectsinFMtorunthesprocpassingtheparameter,whichisthefullpathto
theSSISpackage.Thesprocparameterwillbelistedasanargument.Inthevalueforthatargumentdefinea
parameterusingthe?param?syntax.
Oneinterestingthingtonoteisthatyoursprocquerysubjectreturnsonedataitemcalledoutput.InSQLServerthis
willreceivetheresultofthesproc,whichinourcasewillbetheSSISexecutionlog.Thisisreallycool,becauseyou
canhaveCognosstorethatresultorevenemailtoyou.
Step6:Createareporttoexecutethesprocanddisplaytheoutput
Inreportstudioauthorasimplelistreportthathasapromptpagewithatextboxpromptfortheparameterdefined
intheFMmodelsprocquerysubject.(?param?).
Theninthelist,displaytheoutputfieldfromtheFMsprocquerysubject.Iwouldformattoremoveanycellborders,
etc.
YoucannowtestthereporttomakesureitkicksofftheSSISpackageandthatthepackagedoessomething.When
yourunthereport,itwilloutputtheresultoftheSSISpackage.
Step4:Setyourjobtobursttothefilesystem
Imnotgoingtocoverbursting,butwillassumeyoualreadyhaveburstingsetupinareport.Createanewjobin
CognosConnectionthathastwostepsrunInsequence.Itsveryimportantthatyouruninsequencenotallatonce.
Firststepwillbetorunyourburstreport,outputtothefilesystem.Itshouldbesetupsomethinglikethis:
MakesuretoedittheoptionsonSavetothefilesystem,choosingthelocationthatyouwanttosavetowhichyou
definedinstep2ofthisdocument.
ThesecondstepwillbetorunthereportusedtoexecutethesprocwhichkicksofftheSSISpackage.Inthiscaseyou
willoverridethedefaultvalueontheprompts,passingthepathtotheSSISpackage.Youalsomustchoosehowyou
wantittooutputandtowhere.Inthiscase,IstoreditasaPDFtothecontentstore,butyoumightwanttohaveit
emailyouorsaveashtml.ThisoutputwillbetheexecutionlogoftheSSISpackage.
Yourjobshouldlooksomethinglikethis:
Atthispointyoushouldbeabletorunorschedulethejobanditwillexecutetheentireprocessofburstingthe
report,outputtothefilesystem,deletingthexmlfiles,renamingthereportfiles,andstoringtheSSISresultlog.