Depending on your Sequel version the following methods can be used to search and/or replace values within Sequel Script objects.
Starting with version R10M23, the new Search Script (SCHSCRIPT) command allows you to quickly and easily search for occurrences of any element defined in your Sequel Scripts. You can also do mass search and replace operations without creating source files and queries used in alternate methods. Built-in reports (SCRFNDRPL) will show you where specified items were found and, if replaced, where and how many times replacement occurred.
Simply issue the command SEQUEL/SCHSCRIPT and press F4 to prompt. Fill in the parameters and press Enter to run the command.
The parameters are as follows:
SCRIPT Parameter
Indicates the name and library of the script User Space to be searched.
Script Name
*ALL: All the scripts in the library will be searched.
generic*: Specify the generic name of the scripts to be searched. A generic name is a character string that contains one or more characters followed by an asterisk (*). If a generic name is specified, all scripts that have names with the same prefix as the generic name are searched.
name: Specify the name of the script to be searched.
Script Library
*CURLIB: Use the current library for the job.
name: Use the library name that contains the scripts.
FIND Parameter
Up to 50 characters of text to search for. The text must contain at least one non-blank character and must be enclosed in quotes. This parameter is required.
REPLACE Parameter
Up to 50 characters of text to replace the text found. Text is enclosed in quotes.
*NONE: No replacement will be made, making this a find only search.
TYPE Parameter
This defines which part of the script is to be searched.
*ALL: All aspects of the script will be searched.
*VAR: Only the prompted variable definitions will be searched in conjunction with the Variable Option Parameter.
*LINE: Only the script line statements will be searched.
*TITLE: Only the script title will be searched.
CASE Parameter
This specifies whether the search string should ignore the case of the data it is searching or if the case should match.
*IGNORE: The case of the search data is not a factor in the selection.
*MATCH: The case of the search data must exactly match the search FIND string.
If the REPLACE other than *NONE is used, the replaced value will be exactly as entered, regardless of this selection.
OUTPUT Parameter
Specifies whether to print a simple list of the selected scripts and the number of matches made based on the FIND string.
*YES: Print the list. The spooled file is named SCRFNDRPL.
*NO: Do not print the list.
VARELEM Parameter
Specifies which elements of runtime variables are searched. There are four elements of a variable that can have text that is searchable: Default Value, Prompt Text, Integrity Check, and Extended Help
*ALL All four elements of the variable are searched.
*DFT: Only searches the Default element of the variable.
*PMT: Only searches the Prompt Text element of the variable.
*INT: Only searches the Integrity Check element of the variable.
*HLP: Only searches the Extended Help element of the variable.
Using the Programming Development Manager (PDM) and some work files, you can find and replace values in multiple Sequel Scripts, and recreate the scripts with ease. Follow the steps below to use this method. This method works with Sequel version R10M23 and greater. This method allows you to see the script commands as they are changed.
DSPSCRIPTD SCRIPT(VIEW_LIB/*ALL) TYPE(*SRC) OUTPUT(*OUTFILE) OUTFILE(QTEMP/QCLSRC)
WRKMBRPDM FILE(QTEMP/QCLSRC)
CRTSCRIPT SCRIPT(VIEW_LIB/*ALL) SRCF(QTEMP/QCLSRC) SRCMBR(*ALL)
With this process, you can find any command, parameter, or value referenced in any of your Sequel script objects. Use this method if your version of Sequel is prior to R10M23
This method uses work files and Sequel functions (scripts and Sequel query statements).
DSPOBJD OBJ(LIB/*ALL) OBJTYPE(*USRSPC) OUTPUT(*OUTFILE) OUTFILE(MYLIB/OBJECTS)
10 MONMSG 20 DSPSCRIPTD SCRIPT(yourlib/&SCPTNM) TYPE(*SRC) OUTPUT(*OUTFILE) OUTFILE(QTEMP/SCPTNM) 30 EXECUTE SQL(‘select “&&scptnm” len(10) name(scptnm), *.1 from qtemp/scptnm’) OUTFILE(mylib/Scripts2) MBROPT(*ADD) 40 DLTF FILE(QTEMP/SCPTNM)
10 MONMSG 20 RUNCMD CMD(‘runscript script(yourlib/ScriptB) setvar((_&&scptnm ‘’_&&odobnm’’))’) SQL(‘select odobnm from mylib/objects where odobat contains “SQLSCRIPT”’)
DISPLAY (‘SELECT DISTINCT SCPTNM, SRCDTA FROM MYLIB/SCRIPTS2 WHERE UPPER(SRCDTA) CONTAINS “EXECUTE”’)
This request displays each script name that contains an EXECUTE command.
Still have questions? We can help. Submit a case to Technical Support.