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.
Last Wiki Answer Submitted: February 16, 2012 8:54 am by deepu93213,520 pts.
If you live outside the United States, by submitting your email address you consent to having your personal data transferred to and processed in the United States.
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
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
Sorry,here i improve my post i have done in sqlrpgle but in rpgle how can i do this
[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 ]
above i post my code what is wrong in this please check
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.
i have processed in debug mod it directly going to end loop after reading file
it directly going to end loop after reading file
just change in your code like
c dow not %eof(temp2)
now it goes to infinity loop
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.
only 3 records.
but i found the solution
thanks
here i update keyed field that why its not updated
i have add new field tcod1 and tcod is my key field with same data
now its ok
are you got the answer or not…..
Yes Got the Answer