Question

  Asked: Jun 13 2008   4:47 PM GMT
  Asked by: Alicsc


Last record Updated at the end of PGM


AS/400, RPG/400, PGM, PGM2, PGM1

I have Pgm1 which uses file file1 to write some reords to this file.After at the end of PGM1 it is calling PGM2 to read file1 records to update file1 records but here I have a problem last record written by Pgm1 is actually writing to this file at the end of PGM1(after calling PGM2 because of this PGM2 not reading this last record)

Subscribe to Alerts! Get questions and answers delivered to your Inbox.


E-mail me updates on this question



   SUBSCRIBE

hidden modal window

Answer Wiki (Improve, edit or add to this answer)


 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0



USE op code FEOD (Force end of data). Then, to finnaly nail all updates, before going out of the program. SETON LR then RETRN.
  • AddThis Social Bookmark Button

Browse more Questions and Answers on AS/400.

Looking for relevant AS/400 Whitepapers? Visit the Search400.com Research Library.


Discuss This Answer


You must be logged-in to discuss a question. Log-in/Register

Gilly400  |   Jun 16 2008  8:10AM GMT

Hi,

To be able to use CLOSE you will need to put your file under user control by specifiying UC on your F spec, then you will also need to specify OPEN before using your file and CLOSE before you call your PGM2.

Regards,

Martin Gilbert.

 

BigKat  |   Jun 16 2008  1:55PM GMT

Not true Gilly, You can CLOSE a file at any time you want to even if it is AUTOMATICALLY OPENed by the during initialization. All User Control does it prevents the file from being opened automatically.

As far as writing out the last record, you can also code an FEOD to force the data buffer to write out to the file.

Kevin - Affiliated

 

Gilly400  |   Jun 16 2008  2:29PM GMT

Hi BigKat,

Well, you learn something everyday. I’ve always coded UC and OPEN and CLOSE when I needed files closed.

I seem to remember there was also something on the OVRDBF command to force records to write - switches record blocking off - I think it was the SEQONLY parameter?

Regards,

Martin Gilbert.

 

Alicsc  |   Jun 16 2008  4:14PM GMT

I was away from this Discussion.Now I reliaze how Imp your Answers.
Thanks to

Martin
Kevin,

 

BigKat  |   Jun 17 2008  2:09PM GMT

if you OVRDBF file FRCRATIO(1) you can force the buffer to write after every record is written, but the FEOD is more efficient in this case, as you can buffer the I/O until you are done and then force everything to the file in time for the other program.