Handling pointer while updating a key value in rpgle

Posted by abhinav singh on Stack Overflow See other posts from Stack Overflow or by abhinav singh
Published on 2010-04-23T11:30:17Z Indexed on 2010/04/23 11:33 UTC
Read the original article Hit count: 412

Filed under:

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

© Stack Overflow or respective owner

Related posts about as400