Query/400: Scanning for the Percent Symbol

Follow these steps to scan for the percent symbol (%) using the LIKE or NLIKE test in Query/400:

1. Create a table to convert the percent symbol:
   CrtTbl Tbl( QGPL/WLDCRDQRY )
          SrcFile( *PROMPT )                                        
          TblType( *CVT )

2. Scroll down to input hexadecimal value X'6C' (which signifies the 
   percent symbol) and replace the output value, specifying X'5C', for 
   example, which is the hex equivalent of an asterisk. In place of the 
   percent symbol, you can insert any symbol that doesn't appear in the
   fields you want to test.

3. Press F6 to create the table.

4. Go to Query/400's Select Collating Sequence panel.

5. Select option 4 (Translation table) and enter the newly created table
   name and library in the fields at the bottom of the screen.

6. On Query/400's Specify Processing Options panel, verify that Y is
   specified for Use Collating Sequence for All Character Comparisons.

7. Enter a SELECT statement with the following specification to select 
   all records having the % anywhere in the NAME field:
   NAME      LIKE  '%*%'

This method lets you easily enter the replaced wildcard search for any query by simply repeating steps 4 to 7 as required.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s