I have a batch script that is writing all files inclusive of path and version number to a TMP file for a physical device. This batch script then writes any lines that demonstrate a file version number greater than a provided variable.
DIRECTORYX := DIRECTORY /NODATE /NOHEADING /NOTRAILING
DIR_OUTPUT_FILENAME = "TOPAS$UTILLOG:" + F$UNIQUE() + ".TMP"
DEVICE = $1$DGA1112
DIRECTORYX 'DEVICE':[000000...]*.*;* /NOSIZE /OUTPUT='DIR_OUTPUT_FILENAME'
At the same time I have files to which I am not interested in being reported back to me. In this case i want to remove any lines that potentially contain this filename (filename.ext;) fromt he TMP file so that the batch script can continue through it and only report files that i dont explicity want to ignore.
How would I go about reading the file while inside a loop using 'IGNORE_FILE' as the variable for the text string to match and remove the associated line of text so that when my batch script proceeds through the file it will not report files requested to be ignored.
Many Thanks for any help
Both comments are a great start. Check them carefully. Which OpenVMS version? Something from the last 2 decades?
Just grab and use DFU !
You could also consider sticking F$SEARCH in a loop and parse out version and other interesting components to implement your excludes....
DFU will probably be 10* faster than DIR DIR will be 10* faster that F$SEARCH, but you'll loose that in the processing.
Good luck! Hein
Allright... Now I see where you coming from.
Well, you could just loop starting with i=7, or you could use a "quote" the string and use the quote as new separator. Here is an example with both, using a double-quote as almost natural second separator choice
In the code we see: Checking ''DEVICE' for high file versions (>= ;''HVERNO') - may take some time...>
I urge you to check out DFU The big loop code "READ FH3 /END_OF_FILE=LABEL$_EOF_DIRLIST1 BUFF2..." will simplify to:
This will run in seconds almost no matter how many files. Toss the whole warning stuff, include it always checking for 32000 as it is (almost) free. After executing the DFU command, create the 'fancy' output if tmp.tmp is not empty by creating your header, and appending tmp.tmp. Always delete tmp.tmp ($ CLOSE/DISP=DELETE )
Free advice...
Those 15 deep nested IF-THEN-ELSE-ENDIF to pick up a message looks terrible (to maintain) Consider an array lookup ?! Here is a worked out example:
Cheers, Hein