Power Global

 View Only
  • 1.  File Concurrency Problem

    Posted Thu May 12, 2022 04:53 PM
    I'm working on a problem that involves rpgle programs using standard I/O: chain, reade, etc. The programs run in OPM. One program opens a file reads, processes and deletes records from an externally defined file. Another job can and sometimes does run at the same time writing records to the same file.The expectation is that the when the first job runs at the end of the run the file will be empty. However, sometimes the file will contain a few records that are picked up and processed on the next run. I think that when the jobs run concurrently the job writing records could have deposited records that are not picked up by the job reading and deleting records.However, i have forgotten the rules on how this concurrency scenario would play out. Can't seem to find it in the manuals. Can anyone please explain? thanks, keith

    ------------------------------
    keith galligos
    ------------------------------


  • 2.  RE: File Concurrency Problem

    Posted Mon May 16, 2022 09:31 AM
    I think the EOFDLY (end-of-file delay) parameter for OVRDBF will help you. Here is what the help for that parameter says:

    EOF retry delay in sec (EOFDLY)

    Specifies the number of seconds of delay before trying to read additional records when end of file is reached. This delay is used to allow other jobs an opportunity to add records to the file, and have the new records processed without having to start the job again. When the delay time ends, the job is made active, and data management determines whether any new records were added. If no new records were added, the job waits for another time delay without informing the application program. When a number of seconds is given, no end of file occurs on the given database file until an End Job (ENDJOB) command or forced end of data (FEOD) occurs.

    Note: This parameter cannot be specified if *ALL was specified previously on the Overriding member (MBR) parameter.

    There are several ways to end a job that is waiting for records due to an EOFDLY. They are:

    • Write a record to the specified file which is recognized by the application program as a last record. The application program may then do a force end of data (FEOD) to start the end-of-file processing or close the file.
    • End the job using the controlled value (ENDJOB OPTION(*CNTRLD)) with a delay time greater than the time specified on the EOFDLY time. The DELAY parameter time specified must allow for the EOFDLY time to run out, plus time to process any new records that may have been added to the file, and any end-of-file processing that is done in the user's application. The end-of-file is set by database, and a normal end-of-file condition occurs after new records are retrieved.
    • End the job immediately (ENDJOB OPTION(*IMMED)).
    • If the job is interactive, start a system request and end the previous request.
    *NONE
    Normal end-of-file processing is done.
    1-99999
    Specify the number of seconds that the program waits between attempts to get a record when an end of file condition occurs. No end of file is signaled until force end of data occurs, or until the job is ended with the *CNTRLD option.


    ------------------------------
    Barbara Morris
    ------------------------------