function mods_prep()

$insert logical
$insert rlist_equates
$insert msg_equates
declare function utility, msg, mods_load_control

Stmt = 'SELECT MODS BY APP BY TABLE BY ROW BY UPDATE_TYPE BY-DSND MOD_DATE BY-DSND MOD_TIME'

Stat = utility( 'CURSOR', 'H' )

rlist( Stmt, target_activelist$, '', '', '' )

Stat = utility( 'CURSOR', 'A' )

if @reccount then
   Stat = utility( 'CURSOR', 'H' )
   open 'MODS' to ModsTable else
      Void = msg( '', 'Unable to open MODS...' )
      return 0
   end
	PrevID = ''
	CurID  = ''
	RemIDs = ''
	Eof    = false$
	loop
	  readnext Id else Eof = true$
	 until eof
	   CurID = field( Id, '`', 1, 3 ) ;* FIRST THREE PARTS ARE: APP*TABLE*ROW
	   CurID:= field( Id, '`', 6, 1 ) ;* LAST PART IS THE MODE
	   if CurId = PrevId then
	      * DELETE
	      delete ModsTable, Id else
            Void = msg( '', 'Unable to delete MODS ':Id )
            return 0
	      end
	   end else
	      * DIFFERENT MOD
	      PrevId = CurID
	   end  
	repeat
	Stat = utility( 'CURSOR', 'A' )
   void = mods_load_control()	
end else
   MsgInfo = ''
   MsgInfo<mtext$> = 'There are no rows in the MODS table.'
   MsgInfo<micon$> = '!'
   Void = msg( '', MsgInfo )
   return 0
end
return 0


