!**********************************************************************
!* *
!* MODULE: TDAUDIT.SQR *
!* AUTHOR: TONY DELIA. *
!* DATE: 10/10/2000. *
!* SYSTEM: TD SQR UTILITY SERIES. *
!* DESC: PSAUDIT ANALYZER. *
!* *
!**********************************************************************
!* *
!* TABLES: psrecfield - Select *
!* psdbfield - Select *
!* *
!**********************************************************************
!* *
!* INPUT: A) Enter RECNAME: *
!* *
!* The PeopleSoft Record Definition. *
!* *
!* B) Enter Another Record? (Y/N): *
!* *
!* Repeats process starting with Step A. *
!* *
!**********************************************************************
!* *
!* LEGAL: CONFIDENTIALITY INFORMATION. *
!* *
!* This module is the original work of Tony DeLia. It *
!* can be considered ShareWare under the following *
!* conditions. *
!* *
!* A - The author's name (Tony DeLia) remains on any *
!* and all versions of this module. *
!* B - Any modifications must be clearly identified. *
!* C - A "vanilla" copy of this module must be kept *
!* alongside any revised versions. *
!* *
!**********************************************************************
!* *
!* WEBSITE: http://www.sqrtools.com *
!* *
!* Questions/Comments: tdelia@erols.com *
!* *
!**********************************************************************
!* REVISIONS: *
!**********************************************************************
!* *
!* DATE PROGRAMMER DESCRIPTION *
!* ---------- --------------- --------------------------------------- *
!* *
!* 10/10/2000 DELIA,TONY ORIGINAL CODING. *
!* *
!**********************************************************************
#include 'setenv.sqc' ! Set environment
!**********************************************************************
!* Setup Procedure *
!**********************************************************************
begin-setup
#Include 'setup02a.sqc' ! Printer and page-size init landscape
#define AUDsize 500 ! Override Audit Matrix Size
end-setup
!**********************************************************************
!* Headings *
!**********************************************************************
begin-heading 08
#include 'stdhdg01.sqc'
print '=' ( +1, 1,175 ) fill
print ' ' ( +1, 1, 0 )
print 'Recname' ( 0, 1, 15 )
print 'Fieldname' ( 0, +2, 18 )
print 'Type' ( 0, +2, 4 )
print 'Key?' ( 0, +2, 4 )
print 'Add?' ( 0, +2, 4 )
print 'Chg?' ( 0, +2, 4 )
print 'Del?' ( 0, +2, 4 )
print 'Subrecord' ( 0, +2, 15 )
print 'Key Mapping' ( 0, +2, 18 )
print '=' ( +1, 1,175 ) fill
end-heading
!**********************************************************************
!* Footing *
!**********************************************************************
begin-footing 04
print ' ' ( +1, 1, 1 )
print '=' ( +1, 1,175 ) fill
print 'PSAUDIT Analyzer' ( +1, 1, 0)
print 'by Tony DeLia' ( 0, +2, 0)
print 'tdelia@answerthink.com' ( 0, +5, 0)
end-footing
!**********************************************************************
!* Mainline Processing *
!**********************************************************************
begin-report
do Init-DateTime
do Get-Current-DateTime
move $AsOfToday to $AsOfDate
do Stdapi-Init
do Set-Defaults
do Process-Main
do Stdapi-Term
end-report
!**********************************************************************
!* Set Defaults *
!**********************************************************************
begin-procedure Set-Defaults
let $ReportId = 'TDAUDIT'
let $ReportTitle = 'PSAUDIT Analyzer'
display ' '
display $ReportId noline
display ' ' noline
display $ReportTitle
display ' '
end-procedure
!**********************************************************************
!* Process Main *
!**********************************************************************
begin-procedure Process-Main
let $sw = 'Y'
while upper($sw) = 'Y'
let $sw = 'N'
input $RECname maxlen=15 'Enter RECNAME'
uppercase $RECname
display $RECname
do REC-Func($RECname, 'Y', #O_ctr)
if #O_ctr > 0
do AUD-Func-Build($RECname, #O_ctr)
end-if
input $sw maxlen=1 'Enter Another Record? (Y/N)'
end-while
end-procedure
!**********************************************************************
!* Audit Substitution Variables *
!**********************************************************************
#define FLD_TYPES 'CharLongNbr SignDateTimeDtTm****'
#define AUD_KEY 1
#define AUD_ADD 8
#define AUD_CHG 128
#define AUD_DEL 1024
#define AUD_ANY 1161
#ifndef AUDsize
#define AUDsize 100 ! Default AUDmtx Size
#endif
!**********************************************************************
!* Define Audit Array *
!**********************************************************************
begin-procedure AUD-Array
create-array name=AUDmtx size={AUDsize} field=AUDrec:char -
field=AUDfld:char -
field=AUDsub:char -
field=AUDtyp:char -
field=AUDkey:char -
field=AUDadd:char -
field=AUDchg:char -
field=AUDdel:char
let #AUDmax = {AUDsize} - 1
let #AUDctr = 0
end-procedure
!**********************************************************************
!* Build Audit Array *
!**********************************************************************
begin-procedure AUD-Func-Build($I_main, #I_ctr)
clear-array name=AUDmtx
if #_AUDmax = 0
do AUD-Array
end-if
let #_AUDctr = 0
let #idx = 0
while #idx < #I_ctr
do REC-Func-Get(#idx, $rec, $fld, $sub, #lev)
if $sub <> 'Y'
do AUD-Func-Entry($I_main, $rec, $fld)
end-if
let #idx = #idx + 1
end-while
if #_AUDctr > 0
do AUD-Func-Print
end-if
end-procedure
!**********************************************************************
!* Build Audit Entry *
!**********************************************************************
begin-procedure AUD-Func-Entry($I_main, $I_rec, $I_fld)
begin-select
aud.recname
aud.fieldnum
aud.fieldname
aud.useedit
fld.fieldtype
let #pos = (&fld.fieldtype * 4) + 1
let $AUD_typ = rtrim(substr({FLD_TYPES}, #pos, 4),' ')
let $AUD_rec = $I_main
let $AUD_fld = $I_fld
let #AUD_opt = &aud.useedit
let $AUD_sub = ' '
if $I_main <> $I_rec
let $AUD_sub = $I_rec
end-if
do AUD-Process($AUD_rec, $AUD_fld, $AUD_sub, $AUD_typ, #AUD_opt)
from psrecfield aud,
psdbfield fld
where aud.fieldname = fld.fieldname
and aud.recname = $I_rec
and aud.fieldname = $I_fld
end-select
end-procedure
!**********************************************************************
!* Process Audit Entry *
!**********************************************************************
begin-procedure AUD-Process($AUD_rec, $AUD_fld, $AUD_sub, $AUD_typ, #AUD_opt)
do BOOL-Func('AND', {AUD_ANY}, #AUD_opt, #AUD_res)
let $AUD_key = 'N'
let $AUD_add = 'N'
let $AUD_chg = 'N'
let $AUD_del = 'N'
if #AUD_res > 0
! Test option bit - DELETE
if #AUD_res >= {AUD_DEL}
let $AUD_del = 'Y'
let #AUD_res = #AUD_res - {AUD_DEL}
end-if
! Test option bit - CHANGE
if #AUD_res >= {AUD_CHG}
let $AUD_chg = 'Y'
let #AUD_res = #AUD_res - {AUD_CHG}
end-if
! Test option bit - ADD
if #AUD_res >= {AUD_ADD}
let $AUD_add = 'Y'
let #AUD_res = #AUD_res - {AUD_ADD}
end-if
! Test option bit - KEY
if #AUD_res >= {AUD_KEY}
let $AUD_key = 'Y'
let #AUD_res = #AUD_res - {AUD_KEY}
end-if
end-if
! Insert into Array (REC, FLD, SUB, TYP, KEY, ADD, CHG, DEL)
let AUDmtx.AUDrec (#_AUDctr) = $AUD_rec
let AUDmtx.AUDfld (#_AUDctr) = $AUD_fld
let AUDmtx.AUDsub (#_AUDctr) = $AUD_sub
let AUDmtx.AUDtyp (#_AUDctr) = $AUD_typ
let AUDmtx.AUDkey (#_AUDctr) = $AUD_key
let AUDmtx.AUDadd (#_AUDctr) = $AUD_add
let AUDmtx.AUDchg (#_AUDctr) = $AUD_chg
let AUDmtx.AUDdel (#_AUDctr) = $AUD_del
let #_AUDctr = #_AUDctr + 1
end-procedure
!**********************************************************************
!* Print Audit Array (LOG File) *
!**********************************************************************
begin-procedure AUD-Func-Print LOCAL
let #AUD_key = 0
let #idx = 0
while #idx < #_AUDctr
let $AUD_rec = AUDmtx.AUDrec (#idx)
let $AUD_fld = AUDmtx.AUDfld (#idx)
let $AUD_sub = AUDmtx.AUDsub (#idx)
let $AUD_typ = AUDmtx.AUDtyp (#idx)
let $AUD_key = AUDmtx.AUDkey (#idx)
let $AUD_add = AUDmtx.AUDadd (#idx)
let $AUD_chg = AUDmtx.AUDchg (#idx)
let $AUD_del = AUDmtx.AUDdel (#idx)
let $KEY_fld = ' '
if $AUD_key = 'Y'
let #AUD_key = #AUD_key + 1
let $KEY_fld = 'KEY' || to_char(#AUD_key)
end-if
let $AUD_key = rtrim($AUD_key,'N')
let $AUD_add = rtrim($AUD_add,'N')
let $AUD_chg = rtrim($AUD_chg,'N')
let $AUD_del = rtrim($AUD_del,'N')
print ' ' ( +1, 1, 1 )
print $AUD_rec ( 0, 1, 15 )
print $AUD_fld ( 0, +2, 18 )
print $AUD_typ ( 0, +2, 4 )
print $AUD_key ( 0, +2, 4 )
print $AUD_add ( 0, +2, 4 )
print $AUD_chg ( 0, +2, 4 )
print $AUD_del ( 0, +2, 4 )
print $AUD_sub ( 0, +2, 15 )
print $KEY_fld ( 0, +2, 18 )
let #idx = #idx + 1
end-while
new-page
end-procedure
!**********************************************************************
!* Display Procedure *
!**********************************************************************
begin-procedure Display-Proc($SQR_proc)
display 'SQR Procedure: ' noline
display $SQR_proc
end-procedure
!**********************************************************************
!* Stdapi Init *
!**********************************************************************
begin-procedure Stdapi-Init
do Define-Prcs-Vars
do Get-Run-Control-Parms
end-procedure
!**********************************************************************
!* Stdapi Term *
!**********************************************************************
begin-procedure Stdapi-Term
if #prcs_process_instance > 0
do Update-Prcs-Run-Status
end-if
end-procedure
!**********************************************************************
!* Include Members: *
!**********************************************************************
#include 'tdfunc.sqc' !TD Custom SQR Function Library
#Include 'tdsub.sqc' !TD SubRecord Analyzer
#include 'prcsapi.sqc' !Update Process Request API
#include 'prcsdef.sqc' !Update Process Request variable declare
!Include 'stdapi.sqc' !Routines to Update Run Status
#Include 'curdttim.sqc' !Get-Current-DateTime procedure
#Include 'datetime.sqc' !Routines for date and time formatting
!Init-DateTime procedure
!**********************************************************************
!* End of Program *
!**********************************************************************
|