increament values

1355 pts.
Tags:
as400 pf file
RPGLE Program
hi, I have a pf with three records (1,2,3) now i want to update with 1 increment every values Current values are 1,2,3 after update 2,3,4

Answer Wiki

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

For updating the Database records, you should first read and then update.
In your scenario, Read the PF in a loop till EOF, increment each record with ’1′ and then update.

Pradeep.

Discuss This Question: 13  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
  • 9783444184
    Sorry,here i improve my post i have done in sqlrpgle but in rpgle how can i do this
    1,355 pointsBadges:
    report
  • 9783444184
    [fTEMP2 uf a e k disk c read temp2 c dow %eof(temp2) c eval tcod =tcod+10 c update tempr c* read temp2 c enddo c eval *inlr=*on ]
    1,355 pointsBadges:
    report
  • 9783444184
    above i post my code what is wrong in this please check
    1,355 pointsBadges:
    report
  • deepu9321
    You are almost there. But, a minor mistake on looping condition is making the program to end without updating. It should be c dow %eof(temp2) and, I think you should remove the Comment on read remp2 inside loop. Pradeep.
    3,695 pointsBadges:
    report
  • 9783444184
    i have processed in debug mod it directly going to end loop after reading file
    1,355 pointsBadges:
    report
  • pdsathishkumar
    it directly going to end loop after reading file just change in your code like c dow not %eof(temp2)
    3,790 pointsBadges:
    report
  • 9783444184
    now it goes to infinity loop
    fTEMP2     uf a e           k disk           
    c                   read      temp2          
    c                   dow       not%eof(temp2) 
    c                   if        %eof(temp2)    
    c                   leave                    
    c                   endif                    
    c                   eval      tcod =tcod+10  
    c                   update    tempr          
    c                   read      temp2          
    c                   enddo                    
    c                   eval      *inlr=*on      
    1,355 pointsBadges:
    report
  • deepu9321
    Inifity loop?? How many records you are having in your file? fTEMP2 uf a e k disk c read temp2 c dow not %eof(temp2) c eval tcod =tcod+10 c update tempr c read temp2 c enddo c eval *inlr=*on this should work fine. Try debugging. Pradeep.
    3,695 pointsBadges:
    report
  • 9783444184
    only 3 records. but i found the solution thanks
    fTEMP2     uf   e           k disk                   
    c                   read      temp2                  
    c                   dow       not%eof(temp2)         
    c                   if        %eof(temp2)            
    c                   leave                            
    c                   endif                            
    c                   eval      tcod1=tcod1+10         
    c                   update    tempr                  
    c                   read      temp2                  
    c                   enddo                            
    c                   eval      *inlr=*on              
    
    1,355 pointsBadges:
    report
  • 9783444184
    here i update keyed field that why its not updated
    1,355 pointsBadges:
    report
  • 9783444184
    i have add new field tcod1 and tcod is my key field with same data now its ok
    1,355 pointsBadges:
    report
  • pdsathishkumar
    are you got the answer or not.....
    3,790 pointsBadges:
    report
  • 9783444184
    Yes Got the Answer
    1,355 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