How to search a record in sequential order in V5R1 with two input parameters

2630 pts.
Tags:
AS/400
RPG
I am new to AS/400 and RPG. I want to search a record not on a single key field but with multiply search arguments. how can I do this. One thing in my mind is to create a DataStructure and in Read or Chain operation populate that DS and match field values, but in my version I didn't find LIKEREC keyword for Data Structure. Any idea will be appreciated. Thanks!

Answer Wiki

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

Discuss This Question: 8  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
  • philpl1jb

    Are the search arguements the first, second, etc keys of the physical or a logical file?

    If a file has a key of LNAME, FNAME, MI (in that order) and you have values for all three then you can use the chain operation with a keylist.  But if only FNAME is provided that logical wouldn't be useful.

    51,365 pointsBadges:
    report
  • philpl1jb
    Are you RPG or RPGLE???
    51,365 pointsBadges:
    report
  • CharlieBrowne
    You can do this in SQL or as Phil suggest create a multi key logical file.
    41,430 pointsBadges:
    report
  • hunshabbir7
    Thanks for reply, verion on which I am working is V5R1, I want to search through Chain method with multiple key values but it is giving me error : "Factor 1 is not valid for specified operation". I build a keylist and added logical file's key fields to it and trying to search........
    2,630 pointsBadges:
    report
  • rajeshece

    FACTOR1       OPCODE            FACTOR2       RESULT
    KFILE             KLIST
                          KFLD                                      KEY1
                          KFLD                                      KEY2
    Move the Values to Key1, Key2
      KFILE          CHAIN               FILENAME           
              

    1,215 pointsBadges:
    report
  • philpl1jb
    Structure of fields key1 and key2 in rajeshece example must be the same structure as the first two key fields in the file, FNAME.
    51,365 pointsBadges:
    report
  • philpl1jb
    And f-spec record access type should be K (for keyed)
    51,365 pointsBadges:
    report
  • hunshabbir7
    Actually Chain with multiple key values is not allowed in V5R1. Thats why it was giving me error.
    2,630 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