Robelle | Products | Library | Support | Partners | Contact Us | Qedit for Windows

QW Scripting: ListAll

ListAll 1.02 September 7, 2000

ListAll is a script that searches for a string, a regular expression or a pattern in the current file and, optionally, all associated Include, Use or COBOL Copy library files. It contains the main logic for searching files and uses the FindAll document method. The ListInclude, ListUse and ListCopy scripts only contain On Command blocks which invoke a ListAll method (subroutine) with appropriate parameters. This means these scripts will not work if ListAll has not been previously loaded.

The search string can be a simple string, a regular expression or a pattern. The appropriate string format is selected using the corresponding entry point implemented using On Command blocks.

The script is designed to be loaded. It is distributed in the autoload subdirectory of the Robelle script library so it should load automatically. If it is not, you can load it manually using the Manage scripts command of the Script menu. The driver subroutine is called ProcessListRequest.

Information on Listlines is organized as follows:

ProcessListRequest Parameters

The main subroutine is called ProcessListRequest and accepts 2 parameters.

Invoking ListAll

The script is designed to be loaded. It can be invoked from the Script menu or from any other script.

Running From the Script Menu

The scripts can be loaded manually. Their commands are added to the Robelle command group of the Script menu. The subcommand names are List All, List Copy, List Include and List Use. Each subcommand offers 4 different options:

Running From Another Script

The following sample script provides an example that searches all $include files referred to in the file on the connection Production MPE. The search uses a simple string. This sample script takes advantage of the fact that the QSLUtilListAll script is distributed with Qedit for Windows as a loadable script (in this case, already loaded):
	file = open(connection: "Production MPE", filename: "");
	searchType = 1;		-- Search for a string
	scanInclude = "Include";

	QSLUtilListAll.ProcessListRequest(searchType, scanInclude);


Execution Logic Overview

The ListAll script uses the same approach whether you use the menu command or invoke it from another script.
  1. The script assumes the currently active document is the main source.
  2. If there is no active selection, the script prompts for a search string. If a string is entered, it is used in subsequent steps.
  3. If the user chooses to search for a regular expression or a pattern, the script always prompts for one. If there is an active selection, the selection is used as the default search string.
  4. If there is an active selection and the user chooses to search for a simple string, the script uses the selection as the search string.
  5. The script then calls the FindAll document method. The method returns the matching lines in a record variable.
  6. The script scans the record and inserts the lines in a new local file.

ListAll Results

The ProcessListRequest subroutine displays informative messages in the log window of the Script Control dialog box. These messages include the version number, error messages (if any) and termination message.

The actual list is displayed in a new local file. If the search is done on a host file, the result lines show the host absolute line numbers. If the main file is local, the result lines show the relative line numbers. The script creates a new file for each execution. It is up to the user to dispose of these files.

String Search Results

Here is a sample ouput after searching for a string:
	Searching CV- Green: K.DATA.DEVACCT for STRING 'next'
	Include files ARE searched!
	Actual line numbers are displayed
	Started at 11/30/2000 11:39:56 AM

	CV- Green:K.DATA.DEVACCT: 1 line(s) found **
	    2    : fix next line: $control nolist/$control list,map >>
	CV- Green:DATABASE.INCLUDE.DEVACCT: 1 line(s) found **
	   36    : <<  The next equates define the sub-portions of an MPE filname.

	Completed at 11/30/2000 11:39:56 AM