AS/400 :search string in database

160 pts.
Tags:
AS/400
AS/400 search
One file has 10 fields,all are in CHAR & Len 10. (arrival seqnence)

This file having 1 Million record and want to search perticular value in a record,say 'SAMUL400',also not aware in which field have to search.

Plz help me to build a logic for the above ...thanks

 

 

Answer Wiki

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

You could do something like this
creat a data structure

D DS

D FIELD100 100
D FIELD1 10
D FIELD2 10
D FIELD3 10
D FIELD4 10
D FIELD5 10
D FIELD6 10
D FIELD7 10
D FIELD8 10
D FIELD9 10
D FIELD10 10

MOVE YOUR 10 FIELDS INTO THE DATA STRUCTURE
THEN SCAN THE “FIELD100″ FOR YOUR VALUE

C EVAL FOUND = %SCAN(‘TESTVALUE’ : FIELD100)

IF “FOUND” HAS A VALUE, THAT IS THE STARTING POS OF WHERE IT’S FOUND

YOU COULD THEN DIVIDE THE “FOUND” VALUE BY 10 AND
USE IT TO FIND THE CORRECT FIELD CONTAINING THE VALUE

Discuss This Question: 1  Reply

 
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
  • philpl1jb
    so in RPG if you wanted the record and the field you might do this Select When %SCAN('TESTVALUE' : FIELD1) > 0 ... When %SCAN('TESTVALUE' : FIELD2) > 0 etc. but you could also to this in SQL where Field1 like '%TESTVALUE%' or Field2 like '%TESTVALUE%' etc or in Query with the equilivant... Phil
    50,505 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