Handling pointer while updating a key value in rpgle

420 pts.
Tags:
AS/400
AS/400 administration
RPGLE
[table] [tbody] [tr] [td class="votecell">
 
 
[/td] [td]
my code goes like this femp uf e k disk dvar1 s 5p 0 c *loval setll emp c read emp c dow not %eof(emp) C eval ecode = ecode + 10 c eval var1=ecode c update recemp

c var1 setgt emp c read emp c enddo c eval *inlr=*on

here is a file named emp with record format name recemp with ecode as the key ...now when i am reading the file and then updating the ecode without using setgt ..the pointer is not moving ahead it is updating the same ecode value many time ...now when i use set gt pointer picks the next record but it dint work when two ecode values are same ...else also it will not be working with descending key values...is there any solution so that i can set pointer regardless of the fact whether the values are same or ascending or descending .......thanks

[/td] [/tr] [/tbody] [/table]

Software/Hardware used:
as400

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: 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
  • TomLiotta
    Your code doesn't explain what you are trying to do. You need to tell us what you want to happen; then we can suggest ways to change your code. If you paste code here, click the <code> before you paste and after you paste, or paste all of your code, then select all of the code and click the <code> button. The <code> button tells the editor that it should present program code in a neat format. What are you trying to do? SETGT and SETLL work fine, but we can't tell you how to use them until we know what you are trying to accomplish. Tom
    125,585 pointsBadges:
    report
  • philpl1jb
    As Tom said, specs are unclear. If you are trying to update every records key value. You can do this easier by 1. Changing the F spec - remove the K 2. Remove the setGT Phil
    49,590 pointsBadges:
    report
  • munduuu
    dvar1 s 5p 0
    c *loval setll emp
    c read emp
    c dow not %eof(emp)
    C eval ecode = ecode + 10
    c eval var1=ecode
    c update recemp 
    
    c var1 setgt emp
    c read emp
    c enddo
    c eval *inlr=*on 
    
    420 pointsBadges:
    report
  • philpl1jb
    That's not a spec. Describe what you want to change. Perhaps it's to increase ecode by 10 for every record in the file? Phil
    49,590 pointsBadges:
    report
  • TomLiotta
    Describe to us what you want to happen. The program doesn't things that make a lot of sense. If your file had these values for ECODE, what values should be in the file after you run:
    ECODE
    001
    002
    010
    011
    020
    If you show us how the values should be updated, that should tell us what you want done. Tom
    125,585 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