Picture strings for scan arguments

Picture strings for scan arguments

General syntax

Use the following general syntax when defining scan arguments:

To search for a ...

Enter the following argument:

string

string
or
'string'

hexadecimal string

X'hex_string'

pattern

P'picture'

Enclosing a search argument in single quotation marks

You may enclose the entire search string in single quotation marks. For example, the following two search arguments will lead to the same result:

  • ABC
  • 'ABC'

You must enclose the search string in single quotation marks if the search string includes blanks (see sidehead "Searching for blanks").

Picture strings

The following characters can be used to define picture strings in scan arguments:

This character ...

Represents ...

A

any alphabetic character

U

any uppercase alphabetic character

L

any lowercase alphabetic character

9

any numeric character

B

a space character (blank)

N

any non-space character

*

any single character

S

any of the following special characters (see hexadecimal notation in table; the characters from codepage 037 (English) and codepage 273/1141 (German) are examples only):

 

Hex

037

273

Hex

037

273

Hex

037

273

 

4D

(

(

7A

:

:

6B

,

,

 

5D

)

)

5E

;

;

6E

>

>

 

5C

*

*

7F

"

"

4C

<

<

 

50

&

&

7D

'

'

4E

+

+

 

6C

%

%

60

-

-

6F

?

?

 

5B

$

$

7E

=

=

4F

|

|

 

7B

#

#

61

/

/

 

 

 

 

7C

@

§

4B

.

.

 

 

 

Searching for single quotation marks

Place two single quotation marks in the scan argument when looking for this character in the list.

For example, to search for a string consisting of two uppercase letters (AB, BC, DE, etc.) enter the following in the scan argument:

  • P'UU'

To search for a string of two uppercase letters enclosed in single quotation marks ('AB', 'BC', 'DE', etc.), enter the following in the scan argument:

  • P''UU''

You may also enter the entire search string or part of the search string in hexadecimal notation (see "Searching for hexadecimal strings").

Searching for blanks

Use single quotation marks to enclose a search string that contains one or several blanks.

Alternatively, you can also code a blank in a search argument as follows:

  • Using a search pattern ( P'B' )
  • Using hexadecimal notation ( X'40' )

P'B' or enter a hexadecimal string instead.

The following three search strings are equivalent:

  • 'ABC DEF'
  • ABCP'B'DEF
  • 'ABCP'B'DEF'

Searching for hexadecimal strings

You can also use hexadecimal notation when defining scan arguments.

For example, to search for the string "ABC DEF" (EBCDIC) of the previous example, you can enter the entire search string or part of the search string in hexadecimal notation:

  • X'C1C2C340C4C5C6'

    entering the entire search string in hexadecimal notation

  • ABCX'40'DEF

    entering the blank in hexadecimal notation (ABCX'40'DEF)

  • 'ABCX'40'DEF'

    entering the blank in hexadecimal notation ('ABCX'40'DEF') and enclosing the entire string in single quotation marks ('ABCX'40'DEF')

Combining strings, hex strings, and patterns

You may combine strings, hex strings, and patterns in a scan argument.

For example, to search for the string "LSTn.REPORTn", where n refers to any numeric character, enter one of the following in the scan argument:

  • LSTP'9'.REPORTP'9'
  • 'LSTP'9'.REPORTP'9''

The following examples combine a string, a hex string (EBCDIC), and a pattern:

  • LSTP'9'X'4B'REPORTP'9'
  • 'LSTP'9'X'4B'REPORTP'9''

More examples

The following examples illustrate how you can define scan arguments using picture strings.

This pattern ...

Will find ...

But not ...

P'999S999'

123.456
124-568
123/421

123-ABC
125####
1234567
123A456

P'999'-P'999'

123-456
124-568

123-ABC
125.123

P'AAAS999'

ABC.456
xyz-568

123-456
123-ABC
ABC-ABC

P'999SUUU'

123.ABC
456-XYZ

123-456
123-abc
XYZ-XYZ

P'LLLS999'

abc.456
xyz-568

123-456
ABC.123
ABC-ABC

Even more examples

The following examples illustrate how you can combine a fixed string and a picture strings when defining scan arguments.

This pattern ...

Will find ...

But not ...

CUST#P'9'
or
'CUST#P'9''

CUST#0
CUST#1
CUST#2
CUST#9

CUST#A
CUST#a
CUST##
CUST#

CUST-P'A'
or
'CUST-P'A''

CUST-A
CUST-B
CUST-Z

CUST-1
CUST-#
CUST

CUST-P'U'
or
'CUST-P'U''

CUST-A
CUST-B
CUST-Z

CUST-a
CUST-1
CUST-#
CUST

CUST-P'L'
or
'CUST-P'L''

CUST-a
CUST-b
CUST-z

CUST-A
CUST-1
CUST-#
CUST

CUSTP'S*'
or
'CUSTP'S*''

CUST#9
CUST-a
CUST-Z
CUST##

CUSTAA
CUST01
CUST1
CUSTA

CUSTP'B*'
or
'CUST P'*''

CUST 9
CUST a
CUST Z
CUST #

CUSTAA
CUST01
CUST1
CUSTA

CUSTP'N*'
or
'CUSTP'N*''

CUST-9
CUST1a
CUST#Z

CUST 9
CUST a
CUST Z
CUST #