Previous Topic: FINDNext Topic: FINDLIM


Rules for Finding Packed Strings on the FIND Command

Use one of the following formats to find a packed string using the FIND command.

F P'v' [ss [ee]]
'v'

Specifies a value of 1 to 31 numeric digits.

The following conditions apply:

  • When you specify a '+' before a value or when you do not specify a sign, the FIND command searches for a positive packed string.
  • When you specify a '-' before a value, the FIND command searches for a negative packed string.
ss ee (optional)

Specifies the starting and ending columns for the search. The following conditions apply:

  • When you do not specify a starting column, the FIND command locates the first occurrence of the v value in any packed decimal field of valid length in the record. A valid length is 1-16 packed bytes or 1-31 packed decimal digits.
  • When you specify a starting column but not an ending column, the FIND command searches only in the starting column.
F PLn['vvvvv'][ss ee]
n

Specifies an integer value in the range 1-16 representing the length of the packed field.

'vvvvv'

Specifies the numeric value to search for. This value must be twice the specified length minus 1, and is limited to 31 digits in length.

ss ee (optional)

Specifies the starting and ending columns for the search. The following conditions apply:

  • When you do not specify a starting column, the FIND command locates the first occurrence of the v value in any packed decimal field of valid length in the record. A valid length is 1-16 packed bytes or 1-31 packed decimal digits.
  • When you specify a starting column but not an ending column, the FIND command searches only in the starting column.

Examples:

F P'0' 21

Finds packed zero of any valid length at column 21.

F P'0'

Finds packed zero of any valid length anywhere in the record.

F P'00000'

Finds five packed zeros anywhere in the record.

F P'-1' 30

Finds packed -1 of any valid length at column 30.

F PL5'0' 10

Finds five packed zeros at column 10.

F PL3'0'

Finds three packed zeros anywhere in the record.

F PL2 10

Finds any valid 2-byte packed number at column 10.

F PL16

Finds any valid 16-byte packed number anywhere in the record.