open-insight/LSL2/STPROC/MODS_NEW_PROJECT.txt
Infineon\StieberD 7762b129af pre cutover push
2024-09-04 20:33:41 -07:00

72 lines
1.8 KiB
Plaintext

function mods_new_project()
$insert logical
$insert rlist_equates
$insert msg_equates
declare function utility, msg, set_property, get.reccount
declare subroutine record_lock, clear_table
open 'MODS' to ModsTable else
Void = msg( '', 'Unable to open MODS...' )
return 0
end
Flag = ''
Count = get.reccount(ModsTable, Flag, 0)
if Count > 0 then
MsgInfo = ''
MsgInfo<micon$> = 'H'
MsgInfo<mtext$> = 'There are rows in the MODS table. You either need to apply them or clear the MODS table.'
Void = msg( '', MsgInfo )
return 0
end
MsgInfo = ''
MsgInfo<micon$> = '?'
MsgInfo<mtext$> = 'Are you sure that you want to start a new project...This will clear the BACKREPOS table and start with a fresh copy from SYSREPOS'
MsgInfo<mtype$> = 'BNY'
Resp = msg( '', MsgInfo )
if Resp = 1 else
return 0
end
clear_table('BACKREPOS')
*
open 'BACKREPOS' to BReposTable else
msg( '', 'Unable to open BACKREPOS' )
return 0
end
open 'SYSREPOS' to SysReposTable else
msg( '', 'Unable to open SYSREPOS' )
return 0
end
* new copy each SYSREPOS into BACKREPOS
Stmt = 'SELECT SYSREPOS'
Stat = utility( 'CURSOR', 'H' )
rlist( Stmt, target_activelist$, '', '', '' )
if @reccount then
Eof = false$
loop
readnext Id else Eof = true$
until eof
SysreposRec = xlate( 'SYSREPOS', Id, '', 'X' )
record_lock( BReposTable, 'BACKREPOS', Id )
write SysreposRec on BReposTable, Id else
Void = msg( '', 'Unable to write BACKREPOS ':Id )
return 0
end
unlock BReposTable, Id else
Void = msg( '', 'Unable to unlock BACKREPOS ':Id )
return 0
end
repeat
end
Void = set_property( @window:'.PSD', 'TEXT', oconv( date(), 'D4/' ) )
Stat = utility( 'CURSOR', 'A' )
return 0