OS/2 Procedures Language 2/REXX


Inf-HTML [About][Toc][Index] 0.9b (c) 1995 Peter Childs


SysFileSearch

 
 Function: SysFileSearch 
 Syntax:   call SysFileSearch target, file, stem, [options] 
      target    The string to search for. 
      file      The file to search. 
      stem      The name of the stem variable to place the results. 
                Note:    stem.0 contains the number of lines found. 
      options   Any logical combination of the following: 
           C         Case sensitive search. 
           N         Give line numbers when reporting hits. 
                     Note:    Default is case insensitive without line 
                     numbers. 
 Purpose:  Finds all lines in specified file which contain a specified 
           target string, and places said lines in a stem variable. 
 RC:       Return Codes 
      0         Successful. 
      2         Error.  Not enough memory. 
      3         Error.  Error opening file. 

           Examples:
           
            /* Find DEVICE statements in CONFIG.SYS */
            call SysFileSearch 'DEVICE', 'C:\CONFIG.SYS', 'file.'
            do i=1 to file.0
             say file.i
            end
           
            /* Output */
            DEVICE=C:\OS2\DOS.SYS
            DEVICE=C:\OS2\PMDD.SYS
            DEVICE=C:\OS2\COM02.SYS
            SET VIDEO_DEVICES=VIO_IBM8514A
            SET VIO_IBM8514A=DEVICE(BVHVGA,BVH8514A)
            DEVICE=C:\OS2\POINTDD.SYS
            DEVICE=C:\OS2\MSPS202.SYS
            DEVICE=C:\OS2\MOUSE.SYS TYPE=MSPS2$
           
           
            /* Find DEVICE statements in CONFIG.SYS (along with */
            /* line nums) */
            call SysFileSearch 'DEVICE', 'C:\CONFIG.SYS', 'file.', 'N'
            do i=1 to file.0
             say file.i
            end
           
            /* Output */
            20 DEVICE=C:\OS2\DOS.SYS
            21 DEVICE=C:\OS2\PMDD.SYS
            22 DEVICE=C:\OS2\COM02.SYS
            33 SET VIDEO_DEVICES=VIO_IBM8514A
            34 SET VIO_IBM8514A=DEVICE(BVHVGA,BVH8514A)
            40 DEVICE=C:\OS2\POINTDD.SYS
            41 DEVICE=C:\OS2\MSPS202.SYS
            42 DEVICE=C:\OS2\MOUSE.SYS TYPE=MSPS2$
           
 
 

Inf-HTML End Run - Successful