Find String Using PDM (FNDSTRPDM)

Where allowed to run: All environments (*ALL)
Threadsafe: No
Parameters
Examples
Error messages

The Find String Using PDM (FNDSTRPDM) command allows you to search for character or hexadecimal strings in source physical file members or data physical file members. You can use any Programming Development Manager (PDM) option or one of your own user-defined options on each member that contains a match for the string.

Top

Parameters

Keyword Description Choices Notes
STRING Find 'string' Character value Required, Positional 1
FILE File Qualified object name Required, Positional 2
Qualifier 1: File Name
Qualifier 2: Library Name, *LIBL, *CURLIB
MBR Member Values (up to 300 repetitions): Character value, *ALL Required, Positional 3
OPTION Operation to perform Element list Required, Positional 4
Element 1: Option Character value, *EDIT, *COPY, *DLT, *DSP, *PRT, *RNM, *DSPD, *SAVE, *CHGT, *CMPR, *CMPL, *MOD, *MRG, *RUNP, *SDA, *DFU, *RLU, *NONE
Element 2: Prompt *NOPROMPT, *PROMPT
COL Columns to search Element list Optional
Element 1: From column Character value, 1, *RCDLEN
Element 2: To column Character value, *RCDLEN
CASE Kind of match *IGNORE, *MATCH Optional
PRTMBRLIST Print list *NO, *YES Optional
PRTRCDS Print records Single values: *NONE
Other values: Element list
Optional
Element 1: Number to find Character value, '     ', *ALL
Element 2: Print format *CHAR, *HEX, *ALTHEX
Element 3: Mark record *MARK, *NOMARK
Element 4: Record overflow *FOLD, *TRUNCATE
PARM Parameters Character value Optional
Top

Find 'string' (STRING)

Specifies the string you want to search for

This is a required parameter.

character-value
Specify the string to search for, enclosed in single quotation marks. The string can be character or hexadecimal.
Top

File (FILE)

Specifies the file that contains the members you want to search. The file to be searched can be a source physical file or a data physical file.

This is a required parameter.

Qualifier 1: File

name
Specify the name of the physical file that contains the members you want to search.

Qualifier 2: Library

*LIBL
All libraries in the job library list will be searched for the specified file.
*CURLIB
The current library for the job will be searched for the specified file. If no current library is defined, QGPL is used as the current library.
name
Specify the name of the library to be searched for the specified file.
Top

Member (MBR)

Specifies the member or members to be searched. You can use this parameter to search all the members or a subset of members in the specified file.

This is a required parameter.

You can specify 300 values for this parameter.

*ALL
Search all the file members for the specified string.
generic-name
Specify the generic name of the file members to be searched.

The generic name can be in one of the following formats:

ABC*
Searches all members with names that begin with the characters ABC. For example, ABC, ABCD, or ABCTEST.
*ABC
Searches all members with names that end with the characters ABC. For example, ABC, DABC, or TESTABC.
*B*
Searches all members that have the character B anywhere in the member name. For example, B, BALL, ABCD.
A*C
Searches all members that begin with the character A and end with the character C. For example, AC, ABC, or AZZZC.
"a*"
Searches all members with quoted names that start with the letter a. For example, "a", "aB", "aD".
**ALL
Searches all members with names ending with ALL. For example, ALL, BALL, or TESTALL. The double asterisk is needed in this case, since *ALL is defined as the special value to search all members of the file.
name
Specify the name of the member to be searched.
Top

Operation to perform (OPTION)

Specifies the Programming Development Manager (PDM) option that you want performed on each member for which a match for the string is found. The parameter is comprised of two elements, one for choosing an option and one for prompting. The option can be any PDM option that is valid for this type of file, or any user-defined option in your active option file. The valid options differ for source physical files and data physical files.

This is a required parameter.

Element 1: Option

*NONE
No action is performed on the member that contains the string. Use this value when printing the list of members or records that contain the string.

Source physical file member list options

*EDIT
Edit one or more members using the SEU (source entry utility) editor.
*CHGT
Change some of the attributes of one or more members.
*CMPL
Compile one or more members. The system creates an object based on the member being compiled. The member is compiled interactively or in batch mode, depending on what you have specified on the Change Defaults display or the Change PDM Defaults (CHGPDMDFT) command.

The following member types can be compiled: BAS, BAS36, BAS38, C, CBL, CBLLE, CBL36, CBL38, CICSC, CICSCBL, CICSSQLCBL,CLD, CLLE, CLP, CLP38, CMD, CMD38, CPP, DSPF, DSPF36, DSPF38, FTN, ICFF, LF, LF38, MENU, PAS, PF, PF38, PLI, PLI38, PNLGRP, PRTF, PRINT38, QRY38, RMC, RPG, RPGLE, RPG36, RPG38, RPT, RPT36, RPT38, SPADCT, SQLC, SQLCPP, SQLCBL, SQLCBLLE, SQLFTN, SQLPLI, SQLRPG, SQLRPGLE, and TBL.

When the programming development manager compiles a program using the necessary create commands, the object name to create is always specified as the source member name. You may change the object name parameter to another object name by prompting the option or typing the correct parameter on the command line. The programming development manager will check if the object name already exists, and if it does, the Confirm Compile of Member display appears. This display gives you the option of deleting the existing object.

Note: This screen will not appear if the Replace object prompt on the Change Defaults display (or CHGPDMDFT command) is set to Y (or *YES).

If you have changed the object name parameter to a special value, PDM will not check to see if the object exists. For example, if you compile an RPG program and change the Program prompt to *CTLSPEC, the programming development manager will not check if the object exists.

*CMPR
Compare one or more members.
*COPY
Copy one or more members to one or more new members. You can also copy members to another file, another library, or both.
*DLT
Delete one or more members from the file.
*DSP
Display one or more members using SEU (source entry utility).
*DSPD
Display information about one or more members.
*MOD
Create a module object for an ILE source type.
*MRG
Merge the target member with another member.
*PRT
Print one or more members using SEU (source entry utility).
*RNM
Rename one or more members.
*RUNP
Run a source member with a member type of REXX, OCL36, BASP, or BASP38. If you try to run a member with a type that cannot be run, you receive an error message. To run an OCL36 procedure, the file name must be QS36PRC. You can have the member run in batch mode or interactively depending on what you specified in the Run in batch prompt on the Change Defaults display or CHGPDMDFT command.
*SAVE
Save a member on diskette or tape.
*SDA
Use SDA (screen design aid) to work with the chosen members.
  • If the member type is DSPF or DSPF38, SDA is called to work with a display.
  • If the member type is MNU, MNUDDS or MNUCMD, SDA is called to work with a menu.
  • If the member type is DSPF36 or MNU36, then the System 36 SDA main menu is displayed.
  • If the former type of member MNU is entered, SDA converts this to MNUDDS.
  • Note that menu members for PDM have type MNUDDS for the image member and type MNUCMD for the command source member. The two are linked together to constitute a group, so that specifying one of the types means that you also operate on the linked member at the same time.
*RLU
Use RLU (report layout utility) to work with the chosen members.

Data physical file member list options

*CHGT
Change some of the attributes of one or more members in a physical file.
*CMPR
Compare one or more members.
*COPY
Copy one or more members to one or more new members. You can also copy members to another file, another library, or both.
*DFU
Call DFU (data file utility) to change the chosen members.
*DLT
Delete one or more members from the file.
*DSP
Display one or more members.
*DSPD
Display information about one or more members.
*RNM
Rename one or more members.
*SAVE
Save a member on diskette or tape.

User-defined member list option

character-value
Specify the name of an option you have defined in your active option file.

Element 2: Prompt

The prompt portion of this parameter specifies whether or not you want to be prompted each time the command for the option is carried out.

*NOPROMPT
Do not prompt for the command to be carried out for each member that matches the string.
*PROMPT
Prompt for the command to be carried out for each member that matches the string.
Top

Columns to search (COL)

Specify the starting and ending column numbers of the part of each file record to be searched. This allows you to search the beginning, ending, or middle of each record.

The starting column number cannot exceed the record length.

Element 1: From column

1
Searching will start in column 1 of each record.
*RCDLEN
Only the last column of each record will be searched.
number
Specify the first column of the part of each record to be searched.

Element 2: To column

*RCDLEN
The part of each record to be searched extends from the specified starting column to the last column of the record.
number
Specify the last column of the part of each record to be searched.
Top

Kind of match (CASE)

Specifies whether the search is case sensitive.

*IGNORE
Search the member for the specified string without case sensitivity.
*MATCH
Search for an exact match to the specified string.
Top

Print list (PRTMBRLIST)

Specified whether the list of those members for which a match is found is to be printed.

*NO
Do not print the list of members that contain a match to the string.
*YES
Print the list of members that contain a match to the specified string.
Top

Print records (PRTRCDS)

Specifies which records that contains the string are to be printed.

Single values

*NONE
Do not print any of the records that contain the specified string.

Element 1: Number to find

*ALL
Print all the records that contain the specified string.
1-99999
Specify the number of records to be printed that contain the specified string.

Element 2: Print format

*CHAR
Print the records in character format.
*HEX
Print the records in hexadecimal, over/under style format. This means that the character value is printed with the hexadecimal below it.
*ALTHEX
Print the records in hexadecimal side-by-side style format.

Element 3: Mark record

You can mark the string on the printed record. The string itself is used as a marker for character searches for quick recognition. For hexadecimal searches, the string is marked with asterisks (*).

*MARK
Mark the occurrence of the string in the record.
*NOMARK
Do not mark the occurence of the string in the record.

Element 4: Record overflow

You can specify whether the record will be folded or truncated if it is greater than the length of the print line.

*FOLD
Print the entire record over multiple print lines.
*TRUNCATE
Print only the part of the record that fits on a single print line. When *ALTHEX is used, only columns 1 - 32 are printed, and when *CHAR or *HEX are used, columns 1 - 100 are printed.
Top

Parameters (PARM)

Specifies the parameters that you want to be added to the command carried out as a result of the value specified for element 1 of the Operation to perform (OPTION) parameter.

character-value
Specify the parameters to be passed to the command associated with the value specified for the OPTION parameter. The default for this parameter is blank which will pass no parameters.
Top

Examples

Example 1: Find String Occurrences in One Member

FNDSTRPDM   STRING('Ms') FILE(*LIBL/CUST)
            MBR('NEW')  CASE(*MATCH)
            OPTION(*NONE)  PRTRCDS(*ALL *CHAR)

This command finds all records of member NEW in file CUST that contain the string Ms. The file will be located using the job list list. The search will be case sensitive. A spooled file is generated that lists each record that contains the search string.

Example 2: Find String in a Set of Members

FNDSTRPDM   STRING('*TEST*')  FILE(MYLIB/MYFILE)
            MBR('*APP') CASE(*IGNORE)
            OPTION(FIX)

This command finds occurrences of the string *TEST* in members of file MYFILE in library MYLIB with member names that end with the letters APP. The search is not case sensitive so records with *test* or *Test* will be considered as matching the search string. For each member that contains the search string, user-defined option FIX will be run from the active option file.

Top

Error messages

*ESCAPE Messages

PDM0055
Error while processing the &1 command.
Top