* NebulaDecatalog program * Tony Gravagno, Nebula Research and Development * http://Nebula-RnD.com * * Open Source v1.0 for D3 : 12-jan-2008 * * Please e-mail comments, enhancements, and other platform-specfic * versions to Freeware@Nebula-RnD.com. * * Updates may be available at http://Nebula-Rnd.com/freeware * * Responsibility for implementation and use of this program rests * entirely with the user. Nebula R&D will not be liable for any * time, data, financial, or other loss incurred as a result of * execution of this program. This software is distributed as-is * with no warranties or guarantees, explicit or implied. * * Please be sure to include comments for changes, note * conventions being used for Mod 1. * Author: Tony Gravagno (TG) * Contributors: xxxxxxxxxxxx * * Mod-001 TG 080112 display message when skipping decatalog because of MD * Mod-00n XX yymmdd text.... * * To use, let's say you put this program in MYACCT and the file is BP. * compile this program MYACCT. * Re-catalog the program using: * CATALOG BP NEBULADECATALOG (F * That puts "MYACCT,BP, NEBULADECATALOG" in the catalog entry * Logto an application account. * Copy MD DECATALOG to D3.DECATALOG * Copy MYACCT,, NEBULADECATALOG (O * to: (MD DECATALOG * * The DECATALOG verb will now always call this program, and this * program will use D3.DECATALOG. * * commandline expected to be * DECATALOG FILENAME ID1 ID2 ID3 (Options * or DECATALOG FILENAME (Options ... with active select list * CMD = TRIM(SENTENCE()) OPTS = '' POS = INDEX(CMD,\(\,1) IF POS THEN OPTS = FIELD(CMD[POS+1,9],\)\,1) CMD = CMD[1,POS-1] END IF SYSTEM(11) THEN LIST.ACTIVE = 1 ELSE LIST.ACTIVE = 0 * * IF NOT(LIST.ACTIVE) THEN IF FIELD(CMD,' ',3) # "" THEN * one or more item id's. make a list * see if there is an option first EXECUTE \SSELECT \:OCONV(CMD,'G1 9999') CAPTURING OUT IF SYSTEM(11) THEN LIST.ACTIVE = 1 END END IF NOT(LIST.ACTIVE) THEN CRT 'No items to decatalog' STOP END * OPEN 'MD' TO F.MD ELSE STOP 201,'MD' FNAME = FIELD(CMD,' ',2) DONE = 0 LOOP READNEXT ID ELSE DONE = 1 UNTIL DONE DO * OK.TO.DEL = 1 ; * assume OK to delete, 0 means skip * 1 = MD agrees with commandline * 0 = MD doesn't agree with commandline - shift? * -1 = no MD item, safe to decatalog * -2 = delete object only, swap the MD item to avoid deletion * * If commandline includes (O) for delete Object Only, OK.TO.DEL=-2. * Shift the MD item out of the way for a second to ensure the MD * item isn't deleted. * READV MDINFO FROM F.MD,ID,4 THEN ; * catalog entry atb4 has filename IF FIELD(MDINFO,' ',1) # FNAME THEN IF INDEX(OPTS,'O',1) THEN OK.TO.DEL = -2 END ELSE OK.TO.DEL = 0 ; * don't shift, don't delete END END ELSE OK.TO.DEL = -1 * PUT.IT.BACK = 1 MDITEM = '' IF OK.TO.DEL = -2 THEN READ MDITEM FROM F.MD,ID ELSE PUT.IT.BACK=0 ; * Impossible, we just read it OK.TO.DEL = 1 END * MOD-001-START-INSERT IF OK.TO.DEL = 0 THEN CRT \'\:ID:\' Not Decataloged, MD points to different file.\ END * MOD-001-END-INSERT * * future option might be added to not remove object if there's no MD item * so don't replace -1 with 1 IF OK.TO.DEL = 1 OR OK.TO.DEL = -1 THEN EXECUTE "D3.DECATALOG ":FNAME:" ":ID IF MDITEM # '' AND PUT.IT.BACK THEN WRITE MDITEM ON F.MD,ID CRT \'\:ID:\' Not Removed from MD.\ END END * REPEAT * END