Q
Problem solve Get help with specific problems with your technologies, process and projects.

Searching part of a name or address in AS/400

In ILE RPG code can be written to conduct the search on part of a name or address using the field D#SFLN.

When working with AS400, can you query or search on part of a name or address?
Yes; but this, of course depends on what you mean by 'search.'

If you are referring to an application on your AS/400, it depends on the application. Either it allows such a search...

or it doesn't.

If you are referring to a programming language such as SQL or RPG, then of course you can write code to do the search. In ILE RPG, the code would look like this:

C If D1FIND <> *Blank and

C %Scan(%Subst(D1FIND:1:%Len(%TrimR(D1FIND)))

C :%Xlate(L_Case:U_Case:D#SFLN)) = *Zero

C Eval RecFound = *Off

C EndIf

...where the field to be searched is D#SFLN, and may contain both upper and lower case text. The field containing the word to search for is D1FIND, which can only contain upper case text. The code will turn OFF the indicator field RecFound if the search word is NOT found in the field to be searched.

So, if your address line contains '22 Murray Avenue, Nome, Alaska' and your search field contains 'OME', this scan will convert the D#SFLN data to all upper case, then conduct the scan, and will find the search term in the string.

This was last published in April 2008

Dig Deeper on iSeries ILE programming

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchDataCenter

  • How do I size a UPS unit?

    Your data center UPS sizing needs are dependent on a variety of factors. Develop configurations and determine the estimated UPS ...

  • How to enhance FTP server security

    If you still use FTP servers in your organization, use IP address whitelists, login restrictions and data encryption -- and just ...

  • 3 ways to approach cloud bursting

    With different cloud bursting techniques and tools from Amazon, Zerto, VMware and Oracle, admins can bolster cloud connections ...

Close