In RPGLE, how to fetch the particular record in 1 lakh record without a key

15 pts.
Tags:
AS/400
RPGLE
Hi, I have some 1 lakh record. I need to fetch from 250th record with no key in it. What is the possible optimed way we can achieve it.
1

Answer Wiki

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

You Can use SETLL by using RRN# to position to 250th Record of a File.

Wrk_RRN#                 SETLL                    FILENAME
                                   Read                      FILENAME
Pradeep.

Discuss This Question: 7  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.
  • BigKat
    that may not work if there are deleted records in the file.  The 250th RRN may not be the 250th record in the file.
    9,460 pointsBadges:
    report
  • Splat
    Try this
    SetLl (*Loval) File
    For rrn = 1 to 250;
     Read(e) File;
    EndFor;
    12,875 pointsBadges:
    report
  • BigKat
    @Splat you can't use *loval with a non-keyed file.

    You need to use *start
    setll *start file; 
    for rrn = 1 to 250;
      read(e) file;    
    endfor;            
    9,460 pointsBadges:
    report
  • BigKat
    or setll 1 file if you are at a release level that does not support *start 
    9,460 pointsBadges:
    report
  • BigKat
    see the article Don't Be Misled by SETLL *LOVAL for more information on why you should use *start and *end instead of *loval and *hival
    9,460 pointsBadges:
    report
  • Splat
    BigKat, you're right.  I missed that the file wasn't keyed in the original question.  Thanks for the correction.
    12,875 pointsBadges:
    report
  • KirManoj
    BigKat, that works!!! Thanks a lot!!!
    15 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.

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

Following

Share this item with your network: