Extending DDDAUDIT functionality

Extending DDDAUDIT functionality

Running the DDDAUDIT.SQR process is something every PeopleSoft administrator should do on a regular basis, because it detects flaws between objects in the database and the corresponding definitions in the PeopleSoft data dictionary.

In normal maintenance life however this process doesn’t run that often, so the output can be quite large. Also, when running a DDDAudit during upgrades, there can be a lot of records (TABLE-3 check) and views (VIEWS-2 check) that are obsolete in the new version thus have to be removed. These objects have to be removed manually, which can be a lot of work.

By adjusting the DDDAudit script a bit this work can be reduced a lot. The trick is to write a drop statement to a new file after the record or view that has to be deleted is printed to the output report.

I’ll illustrate it by adding the necessary code to the TABLE-3 check for a Microsoft SQL Server database. In the dddtable.sqc file (which is called from the dddaudit.sqr) add the following lines:

!———————————————————————-!
begin-procedure DDDTABLE-Table-in-DB-and-not-in-DD
!———————————————————————-!
move 0 to #rows
let $AuditDescr = ‘(TABLE-3) SQL Table defined in the Database ‘ || ‘and not found in the Application Designer:’

!– [Frank Kortekaas (LogicaCMG)-Send sql statements to file -Start]

let $FileName = ‘c:tempaz_drop_table3.sql’

open $FileName as 1 for-writing record=100:vary

write 1 from ‘– Frank Kortekaas (LogicaCMG)’

write 1 from ‘–Fix DDDAUDIT TABLE-3 errors by running this script’

write 1 from ‘–’

!– [Frank Kortekaas(LogicaCMG)- end sql statements to file -End]

do MSTabChk

!– [Frank Kortekaas (LogicaCMG)-Send sql statements to file-Start]

write 1 from ‘– EOF’

close 1

!– [Frank Kortekaas (LogicaCMG)-Send sql statements to file-End]

do Print-Audit-Result

do Commit-Transaction

end-procedure

!———————————————————————-!

begin-procedure MSTabChk

!———————————————————————-!

begin-Select on-Error=Rpt-SQL-Error

convert(varchar(128),A.NAME) &Table2_SQLTable

move &Table2_SQLTable to $PSTabName

LET $IsRecPrsnt = ‘N’

LET $PSTabPrefix = SUBSTR($PSTabName,1,3)

if $PSTabPrefix = ‘PS_’

LET $PSColName = SUBSTR($PSTabName, 4,30)

do FindMSTab

if $IsRecPrsnt = ‘N’

do FindMSTmpTab

if $IsRecPrsnt = ‘N’

LET $Tmp1 = substr($PSColName, 1, length(rtrim($PSColName, ‘ ‘)) – 1)

LET $PSColName = $Tmp1

do FindMSTmpTab

if $IsRecPrsnt = ‘N’

LET $Tmp1 = substr($PSColName, 1, length(rtrim($PSColName, ‘ ‘)) – 1)

LET $PSColName = $Tmp1

do FindMSTmpTab

if $IsRecPrsnt = ‘N’

do Table2-Page-Control

print &Table2_SQLTable (+1,{C_One})

!– [ Frank Kortekaas (LogicaCMG) - Send sql statements to file - Start ]

let $SQLStatement = ‘drop table ‘ || &Table2_SQLTable || ‘;’

write 1 from $SQLStatement

!– [ Frank Kortekaas (LogicaCMG) - Send sql statements to file - End ]

end-if

end-if

end-if

end-if

else

LET $PSColName = $PSTabName

do FindMSTab

if $ISRecPrsnt = ‘N’

do Table2-Page-Control

print &Table2_SQLTable (+1,{C_One})

!– [ Frank Kortekaas (LogicaCMG) - Send sql statements to file - Start ]

let $SQLStatement = ‘drop table ‘ || &Table2_SQLTable || ‘;’

write 1 from $SQLStatement

!– [ Frank Kortekaas (LogicaCMG) - Send sql statements to file - End ]

end-if

end-if

FROM SYSOBJECTS A

WHERE A.TYPE = ‘U’ and A.NAME like ‘PS%’

ORDER BY A.NAME

end-SELECT

end-procedure

In this case for every table found in the TABLE-3 check a drop statement is written to the file c:tempaz_drop_table3.sql. This file will look like this:

– Frank Kortekaas (LogicaCMG)

– Fix DDDAUDIT TABLE-3 errors by running this script

drop table PSRECFIELD_TMP;

drop table PSROLEDEFNLG81;

drop table PSTIMEZONELANG2;

drop table PSX_PAGEACTION;

drop table PS_ACCMOTPN_TEO1;

drop table PS_ACCMOTPN_TEO2;

drop table PS_ACCMOTPN_TEO3;

drop table PS_ACCMOTPN_TEOA;

etc…

The only thing you have to do now is run this script. You can also add code like this to the VIEWS-2 check in the dddviews.sqc file (or any check you like) to drop views defined in the database but not in de Application Designer.

 

 Viewed 10155 times by 2249 visitors

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值