SETGT and SETLL

635 pts.
Tags:
AS/400
SETGT
SETLL
I have tried using SETLL and SETGT command to read a record which is not present in file FILEA eg: A B D E Suppose in my program I have given the value C to read the file FILEA using command: C SETGT FILEA C READE FILEA and C SETLL FILEA C READE FILEA But the values retrieved are NULL. Can any1 explain me why this is happening. i m using RPGLE.

Answer Wiki

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

The values are null as there is nothing to read.

If you did a SETLL on C and then a READ, you would read the D record.

The READE will set on the %EOF flag

I hope this helps

Discuss This Question: 5  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
  • Vids
    If you are using READE with SETLL / SETGT that means, first you are setting pointer to a particular record and then you are trying to read equal record with the same key value which is not there in example given by you in queston. Thats the reason its giving you null values as it reached end of file. So as suggested above you should use READ to see the effect of SETLL and SETGT.
    295 pointsBadges:
    report
  • joederoche
    I would suggest that you either use the %Found() BIF or an indicator on the SETLL or the SETGT. If you get a %Found() you can read the file. Remember that normally SETGT is used inconjuction with a READP or READPE. If you are doing a READE, you will need to make sure that you are using the key to the file that you expect to see data for.
    55 pointsBadges:
    report
  • TomLiotta
    I would suggest that you either use the %Found() BIF or an indicator on the SETLL or the SETGT. With SETLL, the circumstances in the question would be far better served with %EQUAL() than %FOUND(). The %FOUND() indication would be on whether record "C". existed or not. But %EQUAL() would come on only if "C" existed. %FOUND() comes on because SETLL checks for a "Lower Limit" which is 'found' just in front of record "D". But %EQUAL() requires an exact match with "C". Tom
    125,585 pointsBadges:
    report
  • Splat
    Read equal is just that. If you're reading with a key that has no match, you won't retrieve anything. If you're trying to position the file to read from a particular key, the following will work:
    SetLl (C) FileA;
    Dou %eof(FileA);
     Read(E) FileA;
     If %eof(FileA) or
        %error;
      Leave;
     EndIf;
    
     ~ process ~
    EndDo;
    7,235 pointsBadges:
    report
  • nasrunisar

    I have a file where in filed1, field2 and field3 are key fields. Now these key fields are not unique, I need to update field 4, 5 and 6 based on the selection by user via subfile. Please help.

     

    55 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