[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference evms::y2k

Title:OpenVMS Year 2000
Moderator:EVMS::MARIONN
Created:Mon Aug 26 1996
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:82
Total number of notes:427

8.0. "Search tool" by EVMS::MARION (So many fish ...) Thu Feb 27 1997 13:05

    This note will contain a copy of the OSSG Y2K search tool.  This 
    searches on a given list (in OpenVMS' case, the one posted in note
    6.7, and in EVMS::DOCD2$:[Y2K]).  This tool is a prototype, and if
    there are suggestions for improvements, please send them to me.
    
    Extract the search patterns (currently in EVMS::Y2K(6.7)) ...
    
    ... and place them in SEARCH_Y2K.LIST in the same directory you place
    the SEARCH_Y2K.COM. To use this tool:
    
            $ @CENTRAL_LOCATION:SEARCH_Y2K RESD$:[*.LIS]*.LIS
    
    This will produce a SEARCH_Y2K.OUT in your default directory.
    
    There are three (two optional) arguments to this tool, for HELP, type:
    
            $ @CENTRAL_LOCATION:SEARCH_Y2K ?
    
    Currently, help provides the following:
    
    P1 (required) is a filename or wildcard of source files to search
    P2 (optional, default=SEARCH_Y2K.OUT) is the results of the search
    P3 (optional, default=<ThisDirectory>SEARCH_Y2K.LIST) is list of
    date-oriented
       interfaces, routines, data-cells, or patterns to seek in those
    source files
T.RTitleUserPersonal
Name
DateLines
8.1SEARCH_Y2K.COMEVMS::MARIONSo many fish ...Thu Feb 27 1997 16:32228
$ VERIFY = 'f$verify(f$trnlnm("SEARCH_Y2K$VERIFY"))
$
$!++
$!
$! FUNCTIONAL DESCRIPTION:
$!
$!	SEARCH_Y2K.COM is used to identify source files that contain
$!	the names of one or more of several well-known date-oriented
$!	interfaces, routines, or data-cells.  This searching is part
$!	of the Y2K (Year 2000) investigation project, where we must
$!	discover, repair, and predict how ready we are for the turn
$!	of the century/millenium in all our code.
$!
$! AUTHOR:	Chris Whitaker
$!
$! MODIFICATION HISTORY:
$!
$!	John R. Lawson, Jr., Developer-at-Large, 26-Feb-1997
$!	Added comments, and planned for suped-up SEARCH command for
$!	significant performance improvement (factor of about 25 over
$!	and above Richard Bishop's improvements).
$!
$!	Richard Bishop
$!	Performance enhancements to do up to 20 pattern searches 
$!	simultaneously, improving performance by a factor of about 20.
$!
$!	Chris Whitaker
$!	Original realization of tool.
$!
$!--
$
$!+
$!	Retrieve the arguments ...
$!-
$
$			! Does the user need help?
$ if (P1 .eqs. "?") .or. (f$extract(0,2,P1) .eqs. "-h")
$ then
$     write SYS$OUTPUT "P1 (required) is a filename or wildcard of source files to search"
$     write SYS$OUTPUT "P2 (optional, default=SEARCH_Y2K.OUT) is the results of the search"
$     write SYS$OUTPUT "P3 (optional, default=<ThisDirectory>SEARCH_Y2K.LIST) is list of date-oriented"
$     write SYS$OUTPUT "   interfaces, routines, data-cells, or patterns to seek in those source files"
$     exit
$ endif
$
$			! P1 is a filename or wildcard of files to search
$ if P1 .eqs. ""
$ then
$    write SYS$OUTPUT "%SEARCH_Y2K-E, please specify a source file or wildcard to search"
$    exit
$ endif
$			! P2 is the output file containing the results
$ if P2 .eqs. "" then -
$     P2 = f$parse("SEARCH_Y2K.OUT",,,,"syntax_only")
$			! P3 is the input file containing the list of patterns
$ if P3 .eqs. "" then -
$     P3 = f$parse("",".LIST",f$env("procedure"))
$
$			! Do we want progress reports?
$ if "''f$trnlnm("SEARCH_Y2K$VERBOSE")'"
$ then
$     VERBOSE = ""
$ else
$     VERBOSE = "!"
$ endif
$
$!+
$!	Create a work-area ...
$!-
$
$ MESSAGE = f$environment("message")
$ on control_y then $ goto CLEANUP
$
$ PID = f$getjpi("","pid")
$ DIRNAM = "Y2K_''PID'"
$ WORKAREA = "[.''DIRNAM']"
$
$ create/directory 'WORKAREA /protection=o:rwed 'VERBOSE /log
$
$!+
$!	Initialize ... Open files ... We're going to collect
$!	up to 20 search patterns into one GROUP of patterns.
$!-
$
$ GROUP = ""
$
$ open/read SEARCH_Y2K$LIST 'P3
$ open/write SEARCH_Y2K$GROUPS 'WORKAREA'GROUPS.TMP
$
$LIST_LOOP:
$ read/end=ENDLIST_LOOP SEARCH_Y2K$LIST PATTERN
$			! Filter out comments from the pattern file
$     if f$extract(0,1,PATTERN) .eqs. "!" then -
$         goto LIST_LOOP
$			! Limit the group of patterns to 20 or 250 characters
$     if (f$length(GROUP)+f$length(PATTERN) .ge. 250) .or. (f$element(20,",",GROUP) .nes. ",")
$     then
$         GROUP = GROUP - ","
$         write SEARCH_Y2K$GROUPS GROUP
$         GROUP = ""
$     endif
$			! Clear out comments from the pattern file
$     PATTERN = f$edit(PATTERN,"trim")
$     if f$extract(0,2,PATTERN) .nes. "!%" then -
$         PATTERN = f$edit(PATTERN,"uncomment,trim")
$     if f$length(PATTERN) .eq. 0 then -
$         goto LIST_LOOP
$			! Add another pattern to the group
$     GROUP = GROUP + "," + """" + PATTERN + """"
$
$ goto LIST_LOOP
$ENDLIST_LOOP:
$ close SEARCH_Y2K$LIST
$			! Write the last group ...
$ if GROUP .nes. ""
$ then
$     GROUP = GROUP - ","
$     write SEARCH_Y2K$GROUPS GROUP
$ endif
$
$ close SEARCH_Y2K$GROUPS
$
$!+
$!	Now loop for all the files that match P1 ...
$!-
$
$ FILE_NUM = 0
$
$FILE_LOOP:
$ FILE = f$search(P1,42)
$
$     if FILE .eqs. "" then -
$         goto ENDFILE_LOOP
$
$!+
$!	Now loop for each group of patterns ...
$!-
$
$     'VERBOSE write SYS$OUTPUT "Processing ''FILE'..."
$
$     SEQ = 0
$     open/read SEARCH_Y2K$GROUPS 'WORKAREA'GROUPS.TMP
$
$READ_LOOP:
$     read/end=ENDREAD_LOOP SEARCH_Y2K$GROUPS PATTERN
$			! Search the file for each group of patterns
$         set message /nofacility/noseverity/noident/notext
$             search/noheader/number 'FILE 'PATTERN /output='WORKAREA'SEARCH.TMP'SEQ
$         set message 'MESSAGE
$			! Advance to the next group
$         SEQ = SEQ + 1
$
$     goto READ_LOOP
$ENDREAD_LOOP:
$     close SEARCH_Y2K$GROUPS
$
$!+
$!	Assemble the list of pattern matches, as if they were all generated by one SEARCH ...
$!-
$
$     I = 0
$     open/write SEARCH_Y2K$RESULT 'WORKAREA'RESULT.TMP
$
$     write SEARCH_Y2K$RESULT ""
$     write SEARCH_Y2K$RESULT "        ****************************** "+f$search(FILE)
$     write SEARCH_Y2K$RESULT ""
$
$APPEND_LOOP:
$     open/read SEARCH_Y2K$SEARCH 'WORKAREA'SEARCH.TMP'I
$			! Move all the matches for each group
$APREAD_LOOP:
$         read/end=ENDAPREAD_LOOP SEARCH_Y2K$SEARCH RECORD
$             write SEARCH_Y2K$RESULT RECORD
$         goto APREAD_LOOP
$ENDAPREAD_LOOP:
$         close SEARCH_Y2K$SEARCH
$			! Advance to the next group of matches
$         I = I + 1
$     if I .lt. SEQ then $ goto append_loop
$ENDAPPEND_LOOP:
$     close SEARCH_Y2K$RESULT
$
$!+
$!	Sort the lines, so that they are chronologically correct ...
$!	This will also eliminate lines that match two different groups.
$!-
$
$     sort/nodup 'WORKAREA'RESULT.TMP 'WORKAREA'RESULT.TMP'f$fao("!10ZL",FILE_NUM)
$     delete 'WORKAREA'SEARCH.TMP*;*,RESULT.TMP;*
$
$     FILE_NUM = FILE_NUM + 1
$ goto FILE_LOOP
$ENDFILE_LOOP:
$
$!+
$!	Assemble all the single-file search results into one output file ...
$!-
$
$ 'VERBOSE write SYS$OUTPUT "%SEARCH_Y2K-I, collecting results and cleaning up"
$
$ if FILE_NUM .ne. 0
$ then
$     copy 'WORKAREA'RESULT.TMP* 'f$parse(P2,"SEARCH_Y2K.OUT",,,"syntax_only")
$     delete 'WORKAREA'RESULT.TMP*;*
$ endif
$
$!+
$!	We're done!
$!
$
$CLEANUP:
$ set message 'MESSAGE
$ 			! Make sure all DCL files are closed
$ if f$trnlnm("SEARCH_Y2K$LIST") .nes. "" then -
$     close SEARCH_Y2K$LIST
$ if f$trnlnm("SEARCH_Y2K$GROUPS") .nes. "" then -
$     close SEARCH_Y2K$GROUPS
$ if f$trnlnm("SEARCH_Y2K$SEARCH") .nes. "" then -
$     close SEARCH_Y2K$SEARCH
$ if f$trnlnm("SEARCH_Y2K$RESULT") .nes. "" then -
$     close SEARCH_Y2K$RESULT
$			! Get rid of the WORKAREA
$ if f$search("''WORKAREA'*.*") .nes. "" then -
$     delete 'WORKAREA'*.*;*
$ if f$search("''DIRNAM'.DIR;1") .nes "" then -
$     delete 'DIRNAM'.DIR;1
$
$ exit
8.1Tool TBSEVMS::MARIONSo many fish ...Fri Feb 28 1997 15:494
    I've deleted the tool until we can shake out some bugs.  The tool was
    logging much more information then needed.
    
    Karen.
8.1Updated tool availableEVMS::MARIONSo many fish ...Tue Mar 04 1997 16:2511
    I'm posting an updated tool.  We may continue to refine the search
    list, as we seem, in some cases, to get more hits than necessary, but
    I've run the tool on modules that have been marked n/a in the
    investigation, and it confirmed that any time related entities are not
    date related.  
    
    Note that this tool cannot replace a closer inspection.  I would be
    inclined to use it as a sanity check to make sure you haven't missed
    anything.  
    
    Karen.
8.2SEARCH_Y2K.COMEVMS::MARIONSo many fish ...Tue Mar 04 1997 16:25236
$ VERIFY = 'f$verify(f$trnlnm("SEARCH_Y2K$VERIFY"))
$
$!++
$!
$! FUNCTIONAL DESCRIPTION:
$!
$!	SEARCH_Y2K.COM is used to identify source files that contain
$!	the names of one or more of several well-known date-oriented
$!	interfaces, routines, or data-cells.  This searching is part
$!	of the Y2K (Year 2000) investigation project, where we must
$!	discover, repair, and predict how ready we are for the turn
$!	of the century/millenium in all our code.
$!
$! AUTHOR:	Chris Whitaker
$!
$! MODIFICATION HISTORY:
$!
$!	John R. Lawson, Jr., Developer-at-Large, 26-Feb-1997
$!	Added comments, and planned for suped-up SEARCH command for
$!	significant performance improvement (factor of about 25 over
$!	and above Richard Bishop's improvements).
$!
$!	Richard Bishop
$!	Performance enhancements to do up to 20 pattern searches 
$!	simultaneously, improving performance by a factor of about 20.
$!
$!	Chris Whitaker
$!	Original realization of tool.
$!
$!--
$
$!+
$!	Retrieve the arguments ...
$!-
$
$			! Does the user need help?
$ if (P1 .eqs. "?") .or. (f$extract(0,2,P1) .eqs. "-h")
$ then
$     write SYS$OUTPUT "P1 (required) is a filename or wildcard of source files to search"
$     write SYS$OUTPUT "P2 (optional, default=SEARCH_Y2K.OUT) is the results of the search"
$     write SYS$OUTPUT "P3 (optional, default=<ThisDirectory>SEARCH_Y2K.LIST) is list of date-oriented"
$     write SYS$OUTPUT "   interfaces, routines, data-cells, or patterns to seek in those source files"
$     exit
$ endif
$
$			! P1 is a filename or wildcard of files to search
$ if P1 .eqs. ""
$ then
$    write SYS$OUTPUT "%SEARCH_Y2K-E, please specify a source file or wildcard to search"
$    exit
$ endif
$			! P2 is the output file containing the results
$ if P2 .eqs. "" then -
$     P2 = f$parse("SEARCH_Y2K.OUT",,,,"syntax_only")
$			! P3 is the input file containing the list of patterns
$ if P3 .eqs. "" then -
$     P3 = f$parse("",".LIST",f$env("procedure"))
$
$			! Do we want progress reports?
$ if "''f$trnlnm("SEARCH_Y2K$VERBOSE")'"
$ then
$     VERBOSE = ""
$ else
$     VERBOSE = "!"
$ endif
$
$!+
$!	Create a work-area ...
$!-
$
$ MESSAGE = f$environment("message")
$ on control_y then $ goto CLEANUP
$
$ PID = f$getjpi("","pid")
$ DIRNAM = "Y2K_''PID'"
$ WORKAREA = "[.''DIRNAM']"
$
$ create/directory 'WORKAREA /protection=o:rwed 'VERBOSE /log
$
$!+
$!	Initialize ... Open files ... We're going to collect
$!	up to 20 search patterns into one GROUP of patterns.
$!-
$
$ GROUP = ""
$
$ open/read SEARCH_Y2K$LIST 'P3
$ open/write SEARCH_Y2K$GROUPS 'WORKAREA'GROUPS.TMP
$
$LIST_LOOP:
$ read/end=ENDLIST_LOOP SEARCH_Y2K$LIST PATTERN
$			! Filter out comments from the pattern file
$     if f$extract(0,1,PATTERN) .eqs. "!" then -
$         goto LIST_LOOP
$			! Limit the group of patterns to 20 or 250 characters
$     if (f$length(GROUP)+f$length(PATTERN) .ge. 250) .or. (f$element(20,",",GROUP) .nes. ",")
$     then
$         GROUP = GROUP - ","
$         write SEARCH_Y2K$GROUPS GROUP
$         GROUP = ""
$     endif
$			! Clear out comments from the pattern file
$     PATTERN = f$edit(PATTERN,"trim")
$     if f$extract(0,2,PATTERN) .eqs. "!%"
$     then
$         PATTERN = "!%" + f$edit(f$extract(2,f$length(PATTERN)-2,PATTERN),"uncomment,trim")
$     else
$         PATTERN = f$edit(PATTERN,"uncomment,trim")
$     endif
$     if f$length(PATTERN) .eq. 0 then -
$         goto LIST_LOOP
$			! Add another pattern to the group
$     GROUP = GROUP + "," + """" + PATTERN + """"
$
$ goto LIST_LOOP
$ENDLIST_LOOP:
$ close SEARCH_Y2K$LIST
$			! Write the last group ...
$ if GROUP .nes. ""
$ then
$     GROUP = GROUP - ","
$     write SEARCH_Y2K$GROUPS GROUP
$ endif
$
$ close SEARCH_Y2K$GROUPS
$
$!+
$!	Now loop for all the files that match P1 ...
$!-
$
$ FILE_NUM = 0
$ FILE_OLD = ""
$
$FILE_LOOP:
$ FILE = f$search(P1,42)
$
$     if FILE .eqs. "" then -
$         goto ENDFILE_LOOP
$     if FILE .eqs. FILE_OLD then -
$         goto ENDFILE_LOOP
$     FILE_OLD = FILE
$
$!+
$!	Now loop for each group of patterns ...
$!-
$
$     'VERBOSE write SYS$OUTPUT "Processing ''FILE'..."
$
$     SEQ = 0
$     open/read SEARCH_Y2K$GROUPS 'WORKAREA'GROUPS.TMP
$
$READ_LOOP:
$     read/end=ENDREAD_LOOP SEARCH_Y2K$GROUPS PATTERN
$			! Search the file for each group of patterns
$         set message /nofacility/noseverity/noident/notext
$             search/noheader/number 'FILE 'PATTERN /output='WORKAREA'SEARCH.TMP'SEQ
$         set message 'MESSAGE
$			! Advance to the next group
$         SEQ = SEQ + 1
$
$     goto READ_LOOP
$ENDREAD_LOOP:
$     close SEARCH_Y2K$GROUPS
$
$!+
$!	Assemble the list of pattern matches, as if they were all generated by one SEARCH ...
$!-
$
$     I = 0
$     open/write SEARCH_Y2K$RESULT 'WORKAREA'RESULT.TMP
$
$     write SEARCH_Y2K$RESULT ""
$     write SEARCH_Y2K$RESULT "        ****************************** "+f$search(FILE)
$     write SEARCH_Y2K$RESULT ""
$
$APPEND_LOOP:
$     open/read SEARCH_Y2K$SEARCH 'WORKAREA'SEARCH.TMP'I
$			! Move all the matches for each group
$APREAD_LOOP:
$         read/end=ENDAPREAD_LOOP SEARCH_Y2K$SEARCH RECORD
$             write SEARCH_Y2K$RESULT RECORD
$         goto APREAD_LOOP
$ENDAPREAD_LOOP:
$         close SEARCH_Y2K$SEARCH
$			! Advance to the next group of matches
$         I = I + 1
$     if I .lt. SEQ then $ goto append_loop
$ENDAPPEND_LOOP:
$     close SEARCH_Y2K$RESULT
$
$!+
$!	Sort the lines, so that they are chronologically correct ...
$!	This will also eliminate lines that match two different groups.
$!-
$
$     sort/nodup 'WORKAREA'RESULT.TMP 'WORKAREA'RESULT.TMP'f$fao("!10ZL",FILE_NUM)
$     delete 'WORKAREA'SEARCH.TMP*;*,RESULT.TMP;*
$
$     FILE_NUM = FILE_NUM + 1
$ goto FILE_LOOP
$ENDFILE_LOOP:
$
$!+
$!	Assemble all the single-file search results into one output file ...
$!-
$
$ 'VERBOSE write SYS$OUTPUT "%SEARCH_Y2K-I, collecting results and cleaning up"
$
$ if FILE_NUM .ne. 0
$ then
$     copy 'WORKAREA'RESULT.TMP* 'f$parse(P2,"SEARCH_Y2K.OUT",,,"syntax_only")
$     delete 'WORKAREA'RESULT.TMP*;*
$ endif
$
$!+
$!	We're done!
$!
$
$CLEANUP:
$ set message 'MESSAGE
$ 			! Make sure all DCL files are closed
$ if f$trnlnm("SEARCH_Y2K$LIST") .nes. "" then -
$     close SEARCH_Y2K$LIST
$ if f$trnlnm("SEARCH_Y2K$GROUPS") .nes. "" then -
$     close SEARCH_Y2K$GROUPS
$ if f$trnlnm("SEARCH_Y2K$SEARCH") .nes. "" then -
$     close SEARCH_Y2K$SEARCH
$ if f$trnlnm("SEARCH_Y2K$RESULT") .nes. "" then -
$     close SEARCH_Y2K$RESULT
$			! Get rid of the WORKAREA
$ if f$search("''WORKAREA'*.*") .nes. "" then -
$     delete 'WORKAREA'*.*;*
$ if f$search("''DIRNAM'.DIR;1") .nes "" then -
$     delete 'DIRNAM'.DIR;1
$
$ exit
8.3MILORD::BISHOPThe punishment that brought us peace was upon HimFri Apr 11 1997 10:446
    next reply is an updated version of the search tool that allows 
    a comma-separated list of files in P1. Usual "sticky filenames"
    apply so you don't need to specify device/directory etc on every
    entry in the list.
    
    - Richard.
8.4updated to accept comma-separated list of filesMILORD::BISHOPThe punishment that brought us peace was upon HimFri Apr 11 1997 10:45255
$ VERIFY = 'f$verify(f$trnlnm("SEARCH_Y2K$VERIFY"))
$
$!++
$!
$! FUNCTIONAL DESCRIPTION:
$!
$!	SEARCH_Y2K.COM is used to identify source files that contain
$!	the names of one or more of several well-known date-oriented
$!	interfaces, routines, or data-cells.  This searching is part
$!	of the Y2K (Year 2000) investigation project, where we must
$!	discover, repair, and predict how ready we are for the turn
$!	of the century/millenium in all our code.
$!
$! AUTHOR:	Chris Whitaker
$!
$! MODIFICATION HISTORY:
$!
$!	Richard Bishop
$!	Allowed P1 to be a comma-separated list of files, complete
$!	with "sticky" filespecs
$!
$!	John R. Lawson, Jr., Developer-at-Large, 26-Feb-1997
$!	Added comments, and planned for suped-up SEARCH command for
$!	significant performance improvement (factor of about 25 over
$!	and above Richard Bishop's improvements).
$!
$!	Richard Bishop
$!	Performance enhancements to do up to 20 pattern searches 
$!	simultaneously, improving performance by a factor of about 20.
$!
$!	Chris Whitaker
$!	Original realization of tool.
$!
$!--
$
$!+
$!	Retrieve the arguments ...
$!-
$
$			! Does the user need help?
$ if (P1 .eqs. "?") .or. (f$extract(0,2,P1) .eqs. "-h")
$ then
$     write SYS$OUTPUT "P1 (required) is a filename or wildcard of source files to search"
$     write SYS$OUTPUT "P2 (optional, default=SEARCH_Y2K.OUT) is the results of the search"
$     write SYS$OUTPUT "P3 (optional, default=<ThisDirectory>SEARCH_Y2K.LIST) is list of date-oriented"
$     write SYS$OUTPUT "   interfaces, routines, data-cells, or patterns to seek in those source files"
$     exit
$ endif
$
$			! P1 is a filename or wildcard of files to search
$ if P1 .eqs. ""
$ then
$    write SYS$OUTPUT "%SEARCH_Y2K-E, please specify a source file or wildcard to search"
$    exit
$ endif
$			! P2 is the output file containing the results
$ if P2 .eqs. "" then -
$     P2 = f$parse("SEARCH_Y2K.OUT",,,,"syntax_only")
$			! P3 is the input file containing the list of patterns
$ if P3 .eqs. "" then -
$     P3 = f$parse("",".LIST",f$env("procedure"))
$
$			! Do we want progress reports?
$ if "''f$trnlnm("SEARCH_Y2K$VERBOSE")'"
$ then
$     VERBOSE = ""
$ else
$     VERBOSE = "!"
$ endif
$
$!+
$!	Create a work-area ...
$!-
$
$ MESSAGE = f$environment("message")
$ on control_y then $ goto CLEANUP
$
$ PID = f$getjpi("","pid")
$ DIRNAM = "Y2K_''PID'"
$ WORKAREA = "[.''DIRNAM']"
$
$ create/directory 'WORKAREA /protection=o:rwed 'VERBOSE /log
$
$!+
$!	Initialize ... Open files ... We're going to collect
$!	up to 20 search patterns into one GROUP of patterns.
$!-
$
$ GROUP = ""
$
$ open/read SEARCH_Y2K$LIST 'P3
$ open/write SEARCH_Y2K$GROUPS 'WORKAREA'GROUPS.TMP
$
$LIST_LOOP:
$ read/end=ENDLIST_LOOP SEARCH_Y2K$LIST PATTERN
$			! Filter out comments from the pattern file
$     if f$extract(0,1,PATTERN) .eqs. "!" then -
$         goto LIST_LOOP
$			! Limit the group of patterns to 20 or 250 characters
$     if (f$length(GROUP)+f$length(PATTERN) .ge. 250) .or. (f$element(20,",",GROUP) .nes. ",")
$     then
$         GROUP = GROUP - ","
$         write SEARCH_Y2K$GROUPS GROUP
$         GROUP = ""
$     endif
$			! Clear out comments from the pattern file
$     PATTERN = f$edit(PATTERN,"trim")
$     if f$extract(0,2,PATTERN) .eqs. "!%"
$     then
$         PATTERN = "!%" + f$edit(f$extract(2,f$length(PATTERN)-2,PATTERN),"uncomment,trim")
$     else
$         PATTERN = f$edit(PATTERN,"uncomment,trim")
$     endif
$     if f$length(PATTERN) .eq. 0 then -
$         goto LIST_LOOP
$			! Add another pattern to the group
$     GROUP = GROUP + "," + """" + PATTERN + """"
$
$ goto LIST_LOOP
$ENDLIST_LOOP:
$ close SEARCH_Y2K$LIST
$			! Write the last group ...
$ if GROUP .nes. ""
$ then
$     GROUP = GROUP - ","
$     write SEARCH_Y2K$GROUPS GROUP
$ endif
$
$ close SEARCH_Y2K$GROUPS
$
$!+
$!	Now loop for all the files that match P1 ...
$!-
$
$ FILE_NUM = 0
$ PRIOR_FILE = "*.*"
$ FILE_ELEM = 0
$
$OUTER_FILE_LOOP:
$ P1_ELEMENT = F$ELEMENT (FILE_ELEM, ",", P1)
$ IF P1_ELEMENT .EQS. "" THEN GOTO ENDFILE_LOOP
$ IF P1_ELEMENT .EQS. "," THEN GOTO OUTER_ENDFILE_LOOP
$ P1_ELEMENT = F$PARSE (P1_ELEMENT,,PRIOR_FILE)
$ PRIOR_FILE = P1_ELEMENT
$
$ FILE_OLD = ""
$
$FILE_LOOP:
$ FILE = f$search(P1_ELEMENT,42)
$
$     if FILE .eqs. "" then -
$         goto ENDFILE_LOOP
$     if FILE .eqs. FILE_OLD then -
$         goto ENDFILE_LOOP
$     FILE_OLD = FILE
$
$!+
$!	Now loop for each group of patterns ...
$!-
$
$     'VERBOSE write SYS$OUTPUT "Processing ''FILE'..."
$
$     SEQ = 0
$     open/read SEARCH_Y2K$GROUPS 'WORKAREA'GROUPS.TMP
$
$READ_LOOP:
$     read/end=ENDREAD_LOOP SEARCH_Y2K$GROUPS PATTERN
$			! Search the file for each group of patterns
$         set message /nofacility/noseverity/noident/notext
$             search/noheader/number 'FILE 'PATTERN /output='WORKAREA'SEARCH.TMP'SEQ
$         set message 'MESSAGE
$			! Advance to the next group
$         SEQ = SEQ + 1
$
$     goto READ_LOOP
$ENDREAD_LOOP:
$     close SEARCH_Y2K$GROUPS
$
$!+
$!	Assemble the list of pattern matches, as if they were all generated by one SEARCH ...
$!-
$
$     I = 0
$     open/write SEARCH_Y2K$RESULT 'WORKAREA'RESULT.TMP
$
$     write SEARCH_Y2K$RESULT ""
$     write SEARCH_Y2K$RESULT "        ****************************** "+f$search(FILE)
$     write SEARCH_Y2K$RESULT ""
$
$APPEND_LOOP:
$     open/read SEARCH_Y2K$SEARCH 'WORKAREA'SEARCH.TMP'I
$			! Move all the matches for each group
$APREAD_LOOP:
$         read/end=ENDAPREAD_LOOP SEARCH_Y2K$SEARCH RECORD
$             write SEARCH_Y2K$RESULT RECORD
$         goto APREAD_LOOP
$ENDAPREAD_LOOP:
$         close SEARCH_Y2K$SEARCH
$			! Advance to the next group of matches
$         I = I + 1
$     if I .lt. SEQ then $ goto append_loop
$ENDAPPEND_LOOP:
$     close SEARCH_Y2K$RESULT
$
$!+
$!	Sort the lines, so that they are chronologically correct ...
$!	This will also eliminate lines that match two different groups.
$!-
$
$     sort/nodup 'WORKAREA'RESULT.TMP 'WORKAREA'RESULT.TMP'f$fao("!10ZL",FILE_NUM)
$     delete 'WORKAREA'SEARCH.TMP*;*,RESULT.TMP;*
$
$     FILE_NUM = FILE_NUM + 1
$ goto FILE_LOOP
$
$ENDFILE_LOOP:
$ FILE_ELEM = FILE_ELEM + 1
$ GOTO OUTER_FILE_LOOP
$
$OUTER_ENDFILE_LOOP:
$
$!+
$!	Assemble all the single-file search results into one output file ...
$!-
$
$ 'VERBOSE write SYS$OUTPUT "%SEARCH_Y2K-I, collecting results and cleaning up"
$
$ if FILE_NUM .ne. 0
$ then
$     copy 'WORKAREA'RESULT.TMP* 'f$parse(P2,"SEARCH_Y2K.OUT",,,"syntax_only")
$     delete 'WORKAREA'RESULT.TMP*;*
$ endif
$
$!+
$!	We're done!
$!
$
$CLEANUP:
$ set message 'MESSAGE
$ 			! Make sure all DCL files are closed
$ if f$trnlnm("SEARCH_Y2K$LIST") .nes. "" then -
$     close SEARCH_Y2K$LIST
$ if f$trnlnm("SEARCH_Y2K$GROUPS") .nes. "" then -
$     close SEARCH_Y2K$GROUPS
$ if f$trnlnm("SEARCH_Y2K$SEARCH") .nes. "" then -
$     close SEARCH_Y2K$SEARCH
$ if f$trnlnm("SEARCH_Y2K$RESULT") .nes. "" then -
$     close SEARCH_Y2K$RESULT
$			! Get rid of the WORKAREA
$ if f$search("''WORKAREA'*.*") .nes. "" then -
$     delete 'WORKAREA'*.*;*
$ if f$search("''DIRNAM'.DIR;1") .nes "" then -
$     delete 'DIRNAM'.DIR;1
$
$ exit