LIKE FUNCTION IN RPGILE

310 pts.
Tags:
AS/400
RPG ILE
Hi All.. suppose i want to access all records in wich any field begins with 'S' ... how can i do this in RPG ILE without using %subst Please help me.. Regards Ambrish

Answer Wiki

Thanks. We'll let you know when a new response is added.

Hi Ambrish 82
“suppose i want to access all records in which any field begins with ‘S’ …
how can i do this in RPG ILE without using %subst”

You asked how to limit access not how to read all records and only use selected records.
Access can be limited by:
– logical files with select or omit clause
– SQL select commands with where clause
– OPNQRY files with QRYSLT command

Did you want to explore any of these or change the question?

Phil

————————————–
No wild card in RPG

if flda >= ‘S’ and flda <‘T’

or

D flda1 S 1 overlays(flda)

if flda1 = ‘S’

Phil

Discuss This Question: 4  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Ambrish 82
    Hi.. Thanks for your responce.. but i just wanted to know that we use wild card in open query for aceess same kind of record.. in the same way i want to do in RPG ILE Ambrish
    310 pointsBadges:
    report
  • hafwhit
    Have you considered writing a SQLRPGLE program for what you attempting to do? I use SQLRPGLE programs when I want to search for records using a prompt and wish to narrow the search containing a certain string of data.
    1,145 pointsBadges:
    report
  • Sloopy
    So why do you NOT want to use %SUBST ? Is this some question you've got to answer for a test? In which case, you ought to work it out for yourself. The code for wildcard checks at the start of a field are quite easy using %SUBST. First, you normalise the search term by %TRIM, and then get the trimmed length of the search term. Then when you read a record you test the term against the field using %SUBST : If %Subst( Term : 1 : LenTerm ) = &Subst( FieldA : 1 : LenTerm ) Et Voila! Now do it without using %SUBST and see why %SUBST is so useful. Sloopy
    2,195 pointsBadges:
    report
  • Satsho
    Have you tried using the %SCAN function ? This is what I did - SRCH = your search criteria - you can set the length to any size. FND = %Scan(%Trim(SRCH):SEARCHFIELD); FND = 0 - search criteria not met FND = 1 = 1st position. I can use this to search with the criteria anywhere in the field.
    1,245 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following