Created
June 19, 2023 13:56
-
-
Save earnhardt3rd/a6ef92b604977ddd6adc90df2b70de1c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'getopts.pl'; | |
| Getopts('m:d:t'); | |
| my $MODE = uc($opt_m) || ""; | |
| my $DEBUG = $opt_d || 0; | |
| if (defined $opt_t) { my %TEST = &D_USD_CONTACT_METHODS();} | |
| 1; | |
| sub D_USD_CONTACT_METHODS { | |
| my $cRef = $_[0]; | |
| my $dFile = $_[1]; | |
| my $ret_msg = "Export Contact Methods"; | |
| if (! -f $dFile) {return "ERROR! Unable to Locate Data File ($dFile) \@ $cRef";} | |
| open (DAFH,">> $dFile"); | |
| print DAFH "\n"; | |
| print DAFH "REM ### $ret_msg ###\n"; | |
| print DAFH "pdm_extract Contact_Method >> %data%\n"; | |
| close(DAFH); | |
| #TABLE Contact_Method | |
| # sym cm_template write_file | |
| # { "AP ONLY" ,"zTriggerScript.bat" ,"1" } | |
| # { "Email" ,"pdm_mail -m" ,"1" } | |
| # { "FAXserve" ,"fs" ,"" } | |
| # { "Notification" ,"$NX_ROOT/bin/notification @ domsrvr TOP call_attr" ,"" } | |
| # { "Pager_Email" ,"pdm_mail -m" ,"1" } | |
| #pdm_extract -f "select * from Contact_Method where id = 1800" >>%data% | |
| return $ret_msg; | |
| } | |
| sub D_USD_CONTROL_TABLES { | |
| my $cRef = $_[0]; | |
| my $dFile = $_[1]; | |
| my $ret_msg = "Export Control Table"; | |
| if (! -f $dFile) {return "ERROR! Unable to Locate Data File ($dFile) \@ $cRef";} | |
| open (DAFH,">> $dFile"); | |
| print DAFH "\n"; | |
| print DAFH "REM ### $ret_msg ###\n"; | |
| print DAFH "pdm_extract Controlled_Table >> %data%\n"; | |
| close(DAFH); | |
| return $ret_msg; | |
| } | |
| sub D_USD_DATA_CONSTRAINTS { | |
| my $cRef = $_[0]; | |
| my $dFile = $_[1]; | |
| my $ret_msg = "Export Data Partition Constraints"; | |
| if (! -f $dFile) {return "ERROR! Unable to Locate Data File ($dFile) \@ $cRef";} | |
| open (DAFH,">> $dFile"); | |
| print DAFH "\n"; | |
| print DAFH "REM ### $ret_msg ###\n"; | |
| print DAFH "pdm_extract Domain_Constraint >> %data%\n"; | |
| close(DAFH); | |
| #pdm_extract -f "select * from Domain_Constraint where ERROR_msg ='You my not edit a Child Incident'" >> %del% | |
| return $ret_msg; | |
| } | |
| sub D_USD_DATA_PARTITIONS { | |
| my $cRef = $_[0]; | |
| my $dFile = $_[1]; | |
| my $ret_msg = "Export Data Partitions"; | |
| if (! -f $dFile) {return "ERROR! Unable to Locate Data File ($dFile) \@ $cRef";} | |
| open (DAFH,">> $dFile"); | |
| print DAFH "\n"; | |
| print DAFH "REM ### $ret_msg ###\n"; | |
| print DAFH "pdm_extract Domain >> %data%\n"; | |
| close(DAFH); | |
| return $ret_msg; | |
| } | |
| sub D_USD_EMAILS { | |
| my $cRef = $_[0]; | |
| my $dFile = $_[1]; | |
| my $ret_msg = "ERROR!$cRef NOT IMPLEMENTED!"; | |
| if (! -f $dFile) {return "ERROR! Unable to Locate Data File ($dFile) \@ $cRef";} | |
| return $ret_msg; | |
| open (DAFH,">> $dFile"); | |
| print DAFH "\n"; | |
| print DAFH "REM ### $ret_msg ###\n"; | |
| print DAFH "set wsp=wsp_%COMPUTERNAME%-%TODAY%-%TIME%\n"; | |
| print DAFH "pdm_extract wspcol > %wsp%\n"; | |
| print DAFH "pdm_extract wsptbl >> %wsp%\n"; | |
| close(DAFH); | |
| #REM pdm_extract -f "select * from Spell_Macro where type = 'BHVNOTIFY_MANY' and sym = 'Notify Assignee - Emergency'" >> %data% | |
| #REM pdm_extract -f "select * from Spell_Macro where type = 'BHVNOTIFY_MANY' and sym = 'Plan notification'" >> %data% | |
| #REM pdm_extract -f "select * from Spell_Macro where type = 'BHVNOTIFY_MANY' and sym = 'Priority 1 Alert'" >> %data% | |
| #REM pdm_extract -f "select * from Spell_Macro where type = 'BHVNOTIFY_MANY' and sym = 'Priority 1 and 2 Alert'" >> %data% | |
| #REM pdm_extract -f "select * from Spell_Macro where type = 'BHVNOTIFY_MANY' and sym = 'SLA-Violation-TTA'" >> %data% | |
| #REM pdm_extract -f "select * from Spell_Macro where type = 'BHVNOTIFY_MANY' and sym = 'SLA-Violation-TTF'" >> %data% | |
| #REM pdm_extract -f "select * from Spell_Macro where type = 'BHVNOTIFY_MANY' and sym = 'SLA-Warning-TTF'" >> %data% | |
| #REM pdm_extract -f "select * from Spell_Macro where type = 'BHVNOTIFY_MANY' and sym = 'Task notification'" >> %data% | |
| #REM pdm_extract -f "select * from Spell_Macro where type = 'BHVNOTIFY_MANY' and sym = 'Task Rejection Notification'" >> %data% | |
| #REM pdm_extract -f "select * from Spell_Macro where type = 'BHVNOTIFY_MANY' and sym = 'z-Notify Configuration MGT Grp'" >> %data% | |
| #pdm_extract -f "select * from Spell_Macro where type = 'BHVNOTIFY_MANY'" >> %data% | |
| # | |
| #pdm_extract -f "select * from Act_Type where sym ='Close'" >> %data% | |
| #pdm_extract -f "select * from Act_Type where sym ='Close Requested'" >> %data% | |
| #pdm_extract -f "select * from Act_Type where sym ='Escalate'" >> %data% | |
| #pdm_extract -f "select * from Act_Type where sym ='Initial'" >> %data% | |
| #pdm_extract -f "select * from Act_Type where sym ='Manual Notify'" >> %data% | |
| #pdm_extract -f "select * from Act_Type where sym ='Reassign'" >> %data% | |
| #pdm_extract -f "select * from Act_Type where sym ='Reopen'" >> %data% | |
| #pdm_extract -f "select * from Act_Type where sym ='Resolved'" >> %data% | |
| #pdm_extract -f "select * from Act_Type where sym ='MMC Priority 1'" >> %data% | |
| #pdm_extract -f "select * from Act_Type where sym ='MMC Priority 1 Down'" >> %data% | |
| #pdm_extract -f "select * from Act_Type where sym ='MMC Priority 1 Reassign'" >> %data% | |
| #pdm_extract -f "select * from Act_Type where sym ='MMC Priority 1 Resolve'" >> %data% | |
| return $ret_msg; | |
| } | |
| sub D_USD_FORM_GROUPS { | |
| my $cRef = $_[0]; | |
| my $dFile = $_[1]; | |
| my $ret_msg = "Export Form Groups"; | |
| if (! -f $dFile) {return "ERROR! Unable to Locate Data File ($dFile) \@ $cRef";} | |
| open (DAFH,">> $dFile"); | |
| print DAFH "\n"; | |
| print DAFH "REM ### $ret_msg ###\n"; | |
| print DAFH "pdm_extract Form_Group >> %data%\n"; | |
| close(DAFH); | |
| return $ret_msg; | |
| } | |
| sub D_USD_IMPACT { | |
| my $cRef = $_[0]; | |
| my $dFile = $_[1]; | |
| my $ret_msg = "Export Impact"; | |
| if (! -f $dFile) {return "ERROR! Unable to Locate Data File ($dFile) \@ $cRef";} | |
| open (DAFH,">> $dFile"); | |
| print DAFH "\n"; | |
| print DAFH "REM ### $ret_msg ###\n"; | |
| print DAFH "pdm_extract Impact >> %data%\n"; | |
| close(DAFH); | |
| return $ret_msg; | |
| } | |
| sub D_USD_MACRO { | |
| my $cRef = $_[0]; | |
| my $dFile = $_[1]; | |
| my $ret_msg = "Export Macros & Conditions"; | |
| if (! -f $dFile) {return "ERROR! Unable to Locate Data File ($dFile) \@ $cRef";} | |
| open (DAFH,">> $dFile"); | |
| print DAFH "\n"; | |
| print DAFH "REM ### $ret_msg ###\n"; | |
| print DAFH "pdm_extract Atomic_Condition >> %data%\n"; | |
| print DAFH "pdm_extract Spell_Macro >> %data%\n"; | |
| close(DAFH); | |
| #MACRO CONDITIONS | |
| #pdm_extract -f "select * from Spell_Macro where sym = 'Priority 1 and 2 Alert'" >>%data% | |
| return $ret_msg; | |
| } | |
| sub D_USD_NOTIFICATION_METHOD { | |
| my $cRef = $_[0]; | |
| my $dFile = $_[1]; | |
| my $ret_msg = "Export Notification Methods"; | |
| if (! -f $dFile) {return "ERROR! Unable to Locate Data File ($dFile) \@ $cRef";} | |
| open (DAFH,">> $dFile"); | |
| print DAFH "\n"; | |
| print DAFH "REM ### $ret_msg ###\n"; | |
| print DAFH "pdm_extract Contact_Method >> %data%\n"; | |
| close(DAFH); | |
| #pdm_extract -f "select * from Contact_Method where sym = 'AP ONLY'" >> %data% | |
| return $ret_msg; | |
| } | |
| sub D_USD_PRIORITY { | |
| my $cRef = $_[0]; | |
| my $dFile = $_[1]; | |
| my $ret_msg = "Export Priority"; | |
| if (! -f $dFile) {return "ERROR! Unable to Locate Data File ($dFile) \@ $cRef";} | |
| open (DAFH,">> $dFile"); | |
| print DAFH "\n"; | |
| print DAFH "REM ### $ret_msg ###\n"; | |
| print DAFH "pdm_extract Priority >> %data%\n"; | |
| close(DAFH); | |
| return $ret_msg; | |
| } | |
| sub D_USD_PROB_CAT { | |
| my $cRef = $_[0]; | |
| my $dFile = $_[1]; | |
| my $ret_msg = "Export Problem Category"; | |
| if (! -f $dFile) {return "ERROR! Unable to Locate Data File ($dFile) \@ $cRef";} | |
| open (DAFH,">> $dFile"); | |
| print DAFH "\n"; | |
| print DAFH "REM ### $ret_msg ###\n"; | |
| print DAFH "pdm_extract Prob_Category >> %data%\n"; | |
| close(DAFH); | |
| #pdm_extract -f "select * from Prob_Category where sym = 'zCA.Support.Incoming Email.Peoplesoft'" | |
| #pdm_extract -f "select * from Prob_Category where sym = 'zCA.Admin.Incoming Email.Peoplesoft'" | |
| return $ret_msg; | |
| } | |
| sub D_USD_NOTIFY_OBJECT_ATTRIBUTES { | |
| my $cRef = $_[0]; | |
| my $dFile = $_[1]; | |
| my $ret_msg = "Export Notify Object Attributes"; | |
| if (! -f $dFile) {return "ERROR! Unable to Locate Data File ($dFile) \@ $cRef";} | |
| open (DAFH,">> $dFile"); | |
| print DAFH "\n"; | |
| print DAFH "REM ### $ret_msg ###\n"; | |
| print DAFH "pdm_extract -f \"select * from Notify_Object_Attr\" >> %data%\n"; | |
| close(DAFH); | |
| return $ret_msg; | |
| } | |
| sub D_USD_NOTIFY_RULES { | |
| my $cRef = $_[0]; | |
| my $dFile = $_[1]; | |
| my $ret_msg = "Export Notify Rules"; | |
| if (! -f $dFile) {return "ERROR! Unable to Locate Data File ($dFile) \@ $cRef";} | |
| open (DAFH,">> $dFile"); | |
| print DAFH "\n"; | |
| print DAFH "REM ### $ret_msg ###\n"; | |
| print DAFH "pdm_extract -f \"select * from Notify_Rule\" >> %data%\n"; | |
| close(DAFH); | |
| return $ret_msg; | |
| } | |
| sub D_USD_NOTIFY_METHOD_TEMPLATES { | |
| my $cRef = $_[0]; | |
| my $dFile = $_[1]; | |
| my $ret_msg = "Export Notify Method Template"; | |
| if (! -f $dFile) {return "ERROR! Unable to Locate Data File ($dFile) \@ $cRef";} | |
| open (DAFH,">> $dFile"); | |
| print DAFH "\n"; | |
| print DAFH "REM ### $ret_msg ###\n"; | |
| print DAFH "pdm_extract -f \"select * from Notify_Msg_Tpl\" >> %data%\n"; | |
| close(DAFH); | |
| return $ret_msg; | |
| } | |
| sub D_USD_SERIVCE_TYPES { | |
| my $cRef = $_[0]; | |
| my $dFile = $_[1]; | |
| my %MACROS; | |
| print " DEBUG_SERVICE_TYPES(cRef=$cRef,dFile=$dFile)\n" if $DEBUG > 0; | |
| my $ret_msg = "Export Service Types"; | |
| if (! -f $dFile) {return "ERROR! Unable to Locate Data File ($dFile) \@ $cRef";} | |
| my @S_TYPES = &_PDM_EXTRACT("select sym,id,del from Service_Desc"); | |
| if (scalar(@S_TYPES) > 0) { | |
| print " Select Service Types to add to package\n"; | |
| @S_TYPES = &fromARRAY(@S_TYPES); | |
| if (scalar(@S_TYPES) > 0) { | |
| $ret_msg .= " via DYNAMIC SELECTION\n"; | |
| my $sd_ext =""; | |
| my $rpt_msg=""; | |
| my %SDSC; # Service_Desc | |
| my %SLA; # SLA_Template | |
| my %EVT; # Events | |
| my %REL; # Lrel_Table | |
| my %MAE; # Spell_Macro for Events | |
| my %MAR; # Spell Macro for Lrels | |
| my $INCLUDE_SLA="YES-ALL"; | |
| my $INCLUDE_EVT="YES-ALL"; | |
| my $INCLUDE_MAE="NO"; | |
| my $INCLUDE_REL="NO"; | |
| my $INCLUDE_MAR="NO"; | |
| for (my $st=0;$st<=scalar(@S_TYPES)-1 ;$st++) { | |
| my ($sName,$sId,$sDel) = split(',',$S_TYPES[$st]); | |
| print " DEBUG_SD:sName=$sName,sId=$sId,sDel=$sDel\n" if $DEBUG > 0; | |
| my $sd_msg = sprintf "%-30s %-60s %-15s %s \n","Service Type:",$sName,$sId,$sDel; | |
| $SDSC{$sId} = "Service_Desc,$sName,$sDel"; | |
| #$sd_ext .= "pdm_extract -f \"select * from Service_Desc where id = $sId\" >> \%sla\%\n"; | |
| my $sd_sel = "select sym,id,event,del from SLA_Template where service_type = 'sdsc:$sId'"; | |
| print " DEBUG_SD:$sd_sel\n" if $DEBUG > 0; | |
| my @SLA_TEMPLATES = &_PDM_EXTRACT($sd_sel); | |
| if (scalar(@SLA_TEMPLATES) > 0) { | |
| my $slaMsg = scalar(@SLA_TEMPLATES) . " SLA Templates Found for Service Type: $sName\n"; | |
| $slaMsg = &displayMessageInBox($slaMsg); | |
| if ($INCLUDE_SLA eq "NO-ALL") {goto NO_SLA;} | |
| if (uc($INCLUDE_SLA) =~ "NO") { | |
| my $slaAns = &Ask("--Would you like to include the SLA Templates? :","Yes","No","Yes-All","No-All"); | |
| if ($slaAns eq "No") {goto NO_SLA;} | |
| if ($slaAns eq "Yes-All") {$INCLUDE_SLA="YES-ALL";} | |
| if ($slaAns eq "No-All") {$INCLUDE_SLA="NO-ALL"; goto NO_SLA;} | |
| } | |
| for (my $sl=0;$sl<=scalar(@SLA_TEMPLATES)-1 ;$sl++) { | |
| my ($slName,$slId,$slEvent,$slDel) = split(',',$SLA_TEMPLATES[$sl]); | |
| print " DEBUG_SL:slName=$slName,slId=$slId,slEvent=$slEvent,slDel=$slDel\n" if $DEBUG > 0; | |
| $sd_msg .= sprintf "%-30s %-60s %-15s %s \n","--SLA Template:",$slName,$slId,$slDel; | |
| $SLA{"sdsc:$sId,$slId"} = "SLA_Template,$slName,$slEvent,$slDel"; | |
| #$sd_ext .= "pdm_extract -f \"select * from SLA_Template where service_type = 'sdsc:$sId' and id = $slId\" >> \%sla\%\n"; | |
| my $se_sel ="select sym,id,condition,del from Events where persid='$slEvent'"; | |
| print " DEBUG_SE:$se_sel\n" if $DEBUG > 0; | |
| my @EVENTS = &_PDM_EXTRACT($se_sel); | |
| if (scalar(@EVENTS) > 0) { | |
| my $evtMsg = scalar(@EVENTS) . " Events Found for SLA_Template: $slName\n"; | |
| $evtMsg = &displayMessageInBox($evtMsg); | |
| if ($INCLUDE_EVT eq "NO-ALL") {goto NO_EVT;} | |
| if (uc($INCLUDE_EVT) =~ "NO") { | |
| my $evtAns = &Ask("--Would you like to include the Events? :","Yes","No","Yes-All","No-All"); | |
| if ($evtAns eq "No") {goto NO_EVT;} | |
| if ($evtAns eq "Yes-All") {$INCLUDE_EVT="YES-ALL";} | |
| if ($evtAns eq "No-All") {$INCLUDE_EVT="NO-ALL"; goto NO_EVT;} | |
| } | |
| for (my $se=0;$se<=scalar(@EVENTS)-1 ;$se++) { | |
| my ($seName,$seId,$seCond,$seDel) = split(',',$EVENTS[$se]); | |
| print " DEBUG_SE:seName=$seName,seId=$seId,seCond=$seCond,seDel=$seDel\n" if $DEBUG > 0; | |
| $sd_msg .= sprintf "%-30s %-60s %-15s %s \n"," --Event:",$seName,$seId,$seDel; | |
| $EVT{$seId} = "Events,$seName,$seCond,$seDel"; | |
| #$sd_ext .= "pdm_extract -f \"select * from Events where id = $seId\" >> \%sla\%\n"; | |
| my $me_sel = "select sym,id,type,ob_type,del from Spell_Macro where persid='$seCond'"; | |
| print " DEBUG_ME:SEL=$me_sel\n" if $DEBUG > 0; | |
| my @MAC_E = &_PDM_EXTRACT($me_sel); | |
| if (scalar(@MAC_E) > 0) { | |
| my $meMsg = scalar(@EVENTS) . " Spell_Macros Found for Event: $seName\n"; | |
| $meMsg = &displayMessageInBox($meMsg," "); | |
| if ($INCLUDE_MAE eq "NO-ALL") {goto NO_MAE;} | |
| if (uc($INCLUDE_MAE) =~ "NO") { | |
| my $maeAns = &Ask("--Would you like to include the Spell Macros? :","Yes","No","Yes-All","No-All"); | |
| if ($maeAns eq "No") {goto NO_MAE;} | |
| if ($maeAns eq "Yes-All") {$INCLUDE_MAE="YES-ALL";} | |
| if ($maeAns eq "No-All") {$INCLUDE_MAE="NO-ALL"; goto NO_MAE;} | |
| } | |
| for (my $me=0;$me<=scalar(@MAC_E)-1 ;$me++) { | |
| my ($meName,$meId,$meType,$meObj,$meDel) = split(',',$MAC_E[$me]); | |
| print " DEBUG_ME:meName=$meName,meId=$meId,meDel=$meDel\n" if $DEBUG > 0; | |
| if ($meId eq "") { | |
| &displayMessageInBox(" ERROR!ME:meName=$meName,meId=$meId,meDel=$meDel \n","!"); | |
| next; | |
| } | |
| $sd_msg .= sprintf "%-30s %-60s %-15s %s \n"," --Macro:",$meName,$meId,$meDel; | |
| $MAE{$meId} = "Spell_Macro,$meName,$meType,$meObj,$meDel"; | |
| #$sd_ext .= "pdm_extract -f \"select * from Spell_Macro where id = $meId\" >> \%sla\%\n"; | |
| } | |
| NO_MAE: | |
| } | |
| } | |
| } | |
| NO_EVT: | |
| my $sl_sel = "select l_attr,id,r_persid from Lrel_Table where l_persid = '$slEvent'"; | |
| print " DEBUG_SL:$sl_sel\n" if $DEBUG > 0; | |
| my @L_REL = &_PDM_EXTRACT($sl_sel); | |
| if (scalar(@L_REL) > 0) { | |
| my $relMsg = scalar(@L_REL) . " Lrels Found for SLA_Template: $slName\n"; | |
| $relMsg = &displayMessageInBox($relMsg); | |
| if ($INCLUDE_REL eq "NO-ALL") {goto NO_REL;} | |
| if (uc($INCLUDE_REL) =~ "NO") { | |
| my $relAns = &Ask("--Would you like to include the Lrels? :","Yes","No","Yes-All","No-All"); | |
| if ($relAns eq "No") {goto NO_REL;} | |
| if ($relAns eq "Yes-All") {$INCLUDE_REL="YES-ALL";} | |
| if ($relAns eq "No-All") {$INCLUDE_REL="NO-ALL"; goto NO_REL;} | |
| } | |
| for (my $lr=0;$lr<=scalar(@L_REL)-1 ;$lr++) { | |
| my ($lrName,$lrId,$lrMacro) = split(',',$L_REL[$lr]); | |
| print " DEBUG_LR:lrName=$lrName,lrId=$lrId,lrMacro=$lrMacro\n" if $DEBUG > 0; | |
| $sd_msg .= sprintf "%-30s %-60s %s \n"," --L_REL:",$lrName,$lrId; | |
| if ($lrId eq "") { | |
| &displayMessageInBox(" ERROR!:L_REL:lrName=$lrName,lrId=$lrId,lrMacro=$lrMacro \n","!"); | |
| } else { | |
| $REL{$lrId} = "LrelTable,$lrName,$lrMacro"; | |
| } | |
| #$sd_ext .= "pdm_extract -f \"select * from Lrel_Table where id = $lrId\" >> \%sla\%\n"; | |
| my $ml_sel = "select sym,id,type,ob_type,del from Spell_Macro where persid='$lrMacro'"; | |
| print " DEBUG_ML:SEL=$ml_sel\n" if $DEBUG > 0; | |
| my @MAC_L = &_PDM_EXTRACT($ml_sel,"."); | |
| if (scalar(@MAC_L) > 0) { | |
| my $maMsg = scalar(@EVENTS) . " Spell_Macros Found for Lrel: $lrName\n"; | |
| $maMsg = &displayMessageInBox($maMsg," "); | |
| if ($INCLUDE_MAR eq "NO-ALL") {goto NO_MAR;} | |
| if (uc($INCLUDE_MAR) =~ "NO") { | |
| my $marAns = &Ask("--Would you like to include the Spell Macros? :","Yes","No","Yes-All","No-All"); | |
| if ($marAns eq "No") {goto NO_MAR;} | |
| if ($marAns eq "Yes-All") {$INCLUDE_MAR="YES-ALL";} | |
| if ($marAns eq "No-All") {$INCLUDE_MAR="NO-ALL"; goto NO_MAR;} | |
| } | |
| for (my $ml=0;$ml<=scalar(@MAC_L)-1 ;$ml++) { | |
| my ($mlName,$mlId,$mlType,$mlObj,$mlDel) = split(',',$MAC_L[$ml]); | |
| print " DEBUG_ML:mlName=$mlName,mlId=$mlId,mlDel=$mlDel\n" if $DEBUG > 0; | |
| if ($mlId eq "") { | |
| &displayMessageInBox(" ERROR!ML:mlName=$mlName,mlId=$mlId,mlDel=$mlDel \n","!"); | |
| next; | |
| } | |
| $sd_msg .= sprintf "%-30s %-60s %-15s %s \n"," --Macro:",$mlName,$mlId,$mlDel; | |
| $MAR{$mlId} = "Spell_Macro,$mlName,$mlType,$mlObj,$mlDel"; | |
| #$sd_ext .= "pdm_extract -f \"select * from Spell_Macro where id = $mlId\" >> \%sla\%\n"; | |
| } | |
| NO_MAR: | |
| } | |
| } | |
| NO_REL: | |
| } | |
| } | |
| NO_SLA: | |
| } | |
| $rpt_msg .= &displayMessageInBox($sd_msg,"+"); | |
| } | |
| $rpt_msg = &displayMessageInBox($rpt_msg,":"); | |
| open (SLAFH,">> $dFile"); | |
| print SLAFH "\n"; | |
| print SLAFH "set slaFull=sla_full_\%COMPUTERNAME\%-\%TODAY\%-\%TIME\%\n"; | |
| print SLAFH "ECHO *** BACK-UP FULL SLA TABLES IN CASE OF ISSUES ***\n"; | |
| print SLAFH "pdm_extract Service_Desc > \%slaFull\%\n"; | |
| print SLAFH "pdm_extract SLA_Template >> \%slaFull\%\n"; | |
| print SLAFH "pdm_extract Events >> \%slaFull\%\n"; | |
| print SLAFH "pdm_extract Lrel_Table >> \%slaFull\%\n"; | |
| print SLAFH "pdm_extract Spell_Macro >> \%slaFull\%\n"; | |
| print SLAFH "ECHO *** FULL BACKUPS COMPLETED ***\n"; | |
| #print SLAFH "$sd_msg\n"; | |
| print SLAFH "set sla=sla_%COMPUTERNAME%-%TODAY%-%TIME%\n"; | |
| if (scalar(keys %SDSC) > 0) { | |
| my $sdsc=""; | |
| print SLAFH "echo Exporting " . scalar(keys %SDSC) . " rows from Service_Desc\n"; | |
| foreach my $sdscKey(sort keys %SDSC) { | |
| if ($sdsc eq "") { | |
| $sdsc = "pdm_extract -f \"select * from Service_Desc where id in ('$sdscKey'"; | |
| } else { | |
| $sdsc .= ",'$sdscKey'"; | |
| } | |
| } | |
| $sdsc .= ")\" >> \%sla\%"; | |
| print SLAFH "$sdsc\n"; | |
| print SLAFH "echo .............\n"; | |
| } | |
| if (scalar(keys %SLA) > 0) { | |
| my $sla=""; | |
| print SLAFH "echo Exporting " . scalar(keys %SLA) . " rows from SLA_Template\n"; | |
| foreach my $slaKey(sort keys %SLA) { | |
| my ($slaSTID,$slaID) = split(',',$slaKey); | |
| if ($sla eq "") { | |
| #$sla = "pdm_extract -f \"select * from SLA_Template where service_type = '$slaSTID' and id in ('$slaID'"; | |
| $sla = "pdm_extract -f \"select * from SLA_Template where id in ('$slaID'"; | |
| } else { | |
| $sla .= ",'$slaID'"; | |
| } | |
| } | |
| $sla .= ")\" >> \%sla\%"; | |
| print SLAFH "$sla\n"; | |
| print SLAFH "echo .............\n"; | |
| } | |
| if (scalar(keys %EVT) > 0) { | |
| my $evt=""; | |
| print SLAFH "echo Exporting " . scalar(keys %EVT) . " rows from Events\n"; | |
| foreach my $evtKey(sort keys %EVT) { | |
| if ($evt eq "") { | |
| $evt = "pdm_extract -f \"select * from Events where id in ('$evtKey'"; | |
| } else { | |
| $evt .= ",'$evtKey'"; | |
| } | |
| } | |
| $evt .= ")\" >> \%sla\%"; | |
| print SLAFH "$evt\n"; | |
| print SLAFH "echo .............\n"; | |
| } | |
| if (scalar(keys %MAE) > 0) { | |
| my $mae=""; | |
| print SLAFH "echo Exporting " . scalar(keys %MAE) . " rows from Spell_Macro\n"; | |
| foreach my $maeKey(sort keys %MAE) { | |
| if ($mae eq "") { | |
| $mae = "pdm_extract -f \"select * from Spell_Macro where id in ('$maeKey'"; | |
| } else { | |
| $mae .= ",'$maeKey'"; | |
| } | |
| } | |
| $mae .= ")\" >> \%sla\%"; | |
| print SLAFH "$mae\n"; | |
| print SLAFH "echo .............\n"; | |
| } | |
| if (scalar(keys %REL) > 0) { | |
| my $rel=""; | |
| print SLAFH "echo Exporting " . scalar(keys %REL) . " rows from Lrel_Table\n"; | |
| foreach my $relKey(sort keys %REL) { | |
| if ($rel eq "") { | |
| $rel = "pdm_extract -f \"select * from Lrel_Table where id in ('$relKey'"; | |
| } else { | |
| $rel .= ",'$relKey'"; | |
| } | |
| } | |
| $rel .= ")\" >> \%sla\%"; | |
| print SLAFH "$rel\n"; | |
| print SLAFH "echo .............\n"; | |
| } | |
| if (scalar(keys %MAR) > 0) { | |
| my $mar=""; | |
| print SLAFH "echo Exporting " . scalar(keys %MAR) . " rows from Spell_Macro\n"; | |
| foreach my $marKey(sort keys %MAR) { | |
| if ($mar eq "") { | |
| $mar = "pdm_extract -f \"select * from Spell_Macro where id in ('$marKey'"; | |
| } else { | |
| $mar .= ",'$marKey'"; | |
| } | |
| } | |
| $mar .= ")\" >> \%sla\%"; | |
| print SLAFH "$mar\n"; | |
| print SLAFH "echo .............\n"; | |
| } | |
| print SLAFH "$sd_ext\n"; | |
| close(SLAFH); | |
| $ret_msg .= $rpt_msg; | |
| # # PICK UP SHARED MACROS | |
| # if (scalar(keys %MACROS) > 0) { | |
| # my $ma_msg = ":: Spell Macro\n"; | |
| # foreach my $mkey(sort keys %MACROS) { | |
| # my $ma_sel = "select sym,id,type,ob_type from Spell_Macro where persid='$mkey'"; | |
| # print " DEBUG_MA:SEL=$ma_sel\n"; | |
| # my @MAC = &_PDM_EXTRACT($ma_sel); | |
| # if (scalar(@MAC) > 0) { | |
| # for (my $mi=0;$mi<=scalar(@MAC)-1 ;$mi++) { | |
| # my ($mName,$mId,$mType,$mObj) = split(',',$MAC[$mi]); | |
| # $ma_msg .= sprintf "--%-40s %s\n",$mName,$mId; | |
| # $sd_ext .= "pdm_extract -f \"select * from Spell_Macro where id = $mId\" > \%sla\%\n"; | |
| # } | |
| # } | |
| # } | |
| # } | |
| #$ma_msg = &displayMessageInBox($ma_msg); | |
| #$sd_msg.=$ma_msg; | |
| } | |
| } else { | |
| $ret_msg .= " via STATIC METHOD! - ** PLEASE REVIEW **"; | |
| print " ** Unable to locate pdm_ectract, using static package ** -- PLEASE REVIEW PACKAGE\n"; | |
| open (DAFH,">> $dFile"); | |
| print DAFH "\n"; | |
| print DAFH ":: ### $ret_msg ###\n"; | |
| print DAFH "set slaFull=sla_full_\%COMPUTERNAME\%-\%TODAY\%-\%TIME\%\n"; | |
| print DAFH "pdm_extract Service_Desc > \%slaFull\%\n"; | |
| print DAFH "pdm_extract SLA_Template >> \%slaFull\%\n"; | |
| print DAFH "pdm_extract Events >> \%slaFull\%\n"; | |
| print DAFH "pdm_extract Lrel_Table >> \%slaFull\%\n"; | |
| print DAFH "pdm_extract Spell_Macro >> \%slaFull\%\n"; | |
| close(DAFH); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment