collecting foreign project databases

 
  • hello!

    i'm trying to collect foreign project databases in a script but the syntax is being rejected.

    var !MTGDB evaluate name for all db with PROJID eq 'MTG'

    can anyone see where i'm going wrong?


    many thanks
    Marc
  • -- Clean all databases, macro must be run in Admin module
    -- W.Ritter 14.08.2001
    --
    -- ADMIN
    var !BANNER BANNER
    IF(matchwild(|$!BANNER|,|*Admin*|))THEN
     --var !DBS collect all DB
     !DBS = dbs
     
     DO !I values !DBS
         --$!I
       --var !dbname (SUBS(NAME,3))
       skip if ( !I.foreign.lowcase().eq('foreign') )
       !dbname = !I.name
       DO !II FROM 1 TO 30
         EXPUNGE DB $!dbname USER $!II
         Handle(1,271)
           var !flag true      
         elsehandle none
           var !flag false      
         Endhandle
       ENDDO
       IF $!flag THEN
         $P Database $!dbname ignored
       ELSE
         $P Database $!dbname all user expunged
       ENDIF
     ENDDO
     $P
     $P READY, All User Expunged from Multiwrite Databases
    ELSE
      $P Macro must be started in Admin Module
    ENDIF

    Above is a macro for Admin to expunge users. As you can see it will skip the foreign DB's.

    Hth,
  • Thankyou both

    Unfortunately that won't do what i need.
    Our corp catalogue project is called MTG, i need to be able to separate it from other foreign project databases.

    I have tried:
    eq MTG
    eq 'MTG'
    match(PROJID,'MTG')
    matchw(PROJID,'*MTG*')
    match(name of PROJID,'MTG')
    match(name of PROJID,'*MTG*')
    match(PROJID,'MTG') eq true
    matchw(PROJID,'*MTG*') eq true

    I have the db names - i will hardcode them into my script instead.

    thanks again
    Marc
  • !dbs = dbs
    do !i indices !dbs  
     if ( !dbs[$!i].foreign.lowcase().eq('foreign') )then
         $P $!dbs[$!i]| Ignored... DB from foreign project
         skip
       endif
    enddo
  • its not mentioned in manuals as foreign