PARM ACCT
echo
echo Security DB to User check: !acct
echo Users who are in MACS but do not have USERS
echo
setvar dbnum vedbopen('MACITM.MACSDATA.!ACCT,READALL,5')
setvar dbset "MOD-ACCESS"
setvar dbmode "2"
setvar dblist "USER-ID,U-NAME"
WHILE vedbgetv('u_DATA','!dbnum','!dbset',!dbmode,'!dblist') DO
setvar c_data '![strchange("!u_data","'"," ")]'
SETVAR UID "![LFT('!c_DATA',8)]"
setvar tuid "![strltrim('!uid')]"
setvar tuid2 "![strrtrim('!tuid')]"
SETVAR UNAME "![RHT('!c_DATA',20)]"
errclear
continue
listuser !tuid2.!acct >$null
IF !cierror <> 0
errclear
continue
listuser !tuid2.@ >$null
echo ** !tuid2 - !uname
if !cierror = 0
repeat
SETVAR P1 "![ruser.password]"
veaudit forusers !tuid2.@
ELSE
SETVAR P1 "![LFT('!TUID2',2)]![STRWRITE(CLOCK:'%024h%0m%0s')]"
PAUSE 1
endif
NEWUSER !TUID2.!ACCT;HOME=PUB;PASS=!P1
sec add !tuid2.!acct;name=![strrtrim('!uname')];nopass
endif
ENDWHILE
setvar dbmode "1"
IF vedbclose("!dbnum","!dbset",!dbmode) THEN
CONTINUE
ENDIF
echo
echo User to Security DB check
echo
setvar dbnum vedbopen('MACITM.MACSDATA.!ACCT,READALL,5')
setvar dbset "MOD-ACCESS"
setvar dbmode "7"
setvar dblist "U-NAME"
repeat
setvar u_id "![ruser.user]"
setvar dbkey "![strwrite('!u_id':8)]"
continue
IF vedbgetv('u_name','!dbnum','!dbset',!dbmode,&
'!dblist','!dbkey') THEN
CONTINUE
ELSE
PURGEUSER !U_ID.!ACCT
endif
veaudit forusers @.!ACCT
setvar dbmode "1"
IF vedbclose("!dbnum","!dbset",!dbmode) THEN
CONTINUE
ENDIF