INCLUDE OMIT Numeric test

You can use one of the numeric test capabilities of the INCLUDE OMIT Numeric test statement to collect the records you want. You can use one of the numeric test capabilities of the INCLUDE OMIT Alphanumeric test statement to collect the records you want. You can use the INCLUDE OMIT Substring Comparison statement in conjunction with other options to select/omit the number of records to be processed.

INCLUDE OMIT Numeric Test

Syntax: INCLUDE COND=(Field-1 starting position, Field-1 length, Field-1 format, Relational Operator, NUM)

INCLUDE COND=(18,4,FS,NE,NUM)
  • Use NUM to indicate a test for numerics or non-numerics.
  • Use EQ to test for numerics, or NE to test for non-numerics.
  • Use FS format for the field if you want to test for character numerics (‘0’-‘9’ in every byte).
  • Use ZD format for the field if you want to test for zoned decimal numerics (‘0’-‘9′ in all non-sign bytes; X’F0′-X’F9′, X’D0′-X’D9′ or X’C0′-X’C9’ in the sign byte).
  • Use PD format for the field if you want to test for packed decimal numerics (0-9 for all digits; F, D or C for the sign).

INCLUDE OMIT Numeric Test Examples

Example-01

Here’s an INCLUDE statement that only includes records in which the Revenue field and Profit field have packed decimal numeric (that is, there is no invalid packed decimal values in these fields).

INCLUDE COND=(22,6,PD,EQ,NUM,AND,28,6,PD,EQ,NUM)

Example-02

Let’s say we have a 4 bytes Employee ID which is supposed to be numeric but you want to find the invalid non-number in this field and you want to select the records with those values. Each byte of the 4-byte Employees field should contain ‘0’ through ‘9’; you would consider any other character, such as ‘A’ or ‘.’ to be invalid.

INCLUDE COND=(18,4,FS,NE,NUM)

INCLUDE OMIT Alphanumeric Test

Testing for alphanumeric or non-alphanumeric is similar to testing for numeric or non-numeric. Use BI for the format. Use EQ to test for alphanumeric or NE to test for non-alphanumeric. Instead of NUM, use one of the following corresponding to the set of alphanumeric characters you need:

  • UC: Uppercase characters (A-Z)
  • LC: Lowercase characters (a-z)
  • MC: Mixed case characters (A-Z, a-z)
  • UN: Uppercase and numeric characters (A-Z, 0-9)
  • LN: Lowercase and numeric characters (a-z, 0-9)
  • MN: Mixed case and numeric characters (A-Z, a-z, 0-9)

Syntax:: INCLUDE COND=(Field-1 starting position, Field-1 length, Field-1 format, Relational Operator, Alphanumeric Character)

INCLUDE OMIT Alphanumeric Test Examples

Example-01

Here is an INCLUDE statement that only includes records that have uppercase or numeric characters in positions 11 to 15:

INCLUDE COND=(11,5,BI,EQ,UN)

If every position from 11 to 15 in a record has A-Z or 0-9, that record is included. If any position from 11 to 15 in a record does not have A-Z or 0-9, that record is not included. So a record with ‘B03RS’ in 11 to 15 would be included, whereas records with ‘B03rS’ or ‘B,ABC’ would not be included.

Example-02

Here is an INCLUDE statement that removes any record that has only A-Z or a-z in positions 1 to 8:

INCLUDE COND=(1,8,BI,NE,MC)

So a record with ‘RsTUVxyz’ in 1-8 would not be included, whereas a record with ‘Rs$UVxyz’ in 1-8 would be included.

SYNCSORT Manual: Click Here

Scroll to Top