CL question on file - IBM AS400

This is a discussion on CL question on file - IBM AS400 ; I think with CL I can only use one file? I wrote a C/L program to create a file at 8:00 each night and process it, then when it's done it closes the file and deletes it. But in the ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: CL question on file

  1. CL question on file

    I think with CL I can only use one file?

    I wrote a C/L program to create a file at 8:00 each night and process
    it, then when it's done it closes the file and deletes it. But in the
    code, I write it to loop back to near the top of the program to reset
    it for the next night.

    Question is, if I create/read/delete the file in the program, when it
    loops back to the top can it do the same steps again the next day or
    once I have deleted the file will it not recreate it.

    For some reason, it worked the first night, but even though the job
    was running the second night, it didn't do anything at 8:00 and it
    should have. Problem is, if any kind of a joblog was generated, the
    system operator deleted it.

    Perhaps a better way would be just to resubmit the job??

    thanks
    ga
    ga
    nospam@nospam.fmctc.com

  2. Re: CL question on file

    Google group search on RCVF TFRCTL. The base support allowed only
    one file and once EOF [End Of File] was reached, the declared file could
    no longer be used in that invocation; i.e. permanently closed at that
    invocation level. TFRCTL or resubmit the job, either would work, but
    there is no longer any reason to do so. Just use the new DCLF & RCVF
    support which allows an OPNID [Open IDentifier] to be specified, then
    use OPNDBF and CLOF commands to act on the Open ID.
    The system design being object-based, it is best to create the object
    and leave it; replace only the data. Both the CLRPFM command and the
    typical MBROPT(*REPLACE) parameter for *OUTFILE processing will enable
    reuse of the object so as to avoid delete and create.

    Regards, Chuck
    --
    All comments provided "as is" with no warranties of any kind
    whatsoever and may not represent positions, strategies, nor views of my
    employer

    ga wrote:
    > I think with CL I can only use one file?
    >
    > I wrote a C/L program to create a file at 8:00 each night and process
    > it, then when it's done it closes the file and deletes it. But in the
    > code, I write it to loop back to near the top of the program to reset
    > it for the next night.
    >
    > Question is, if I create/read/delete the file in the program, when it
    > loops back to the top can it do the same steps again the next day or
    > once I have deleted the file will it not recreate it.
    >
    > For some reason, it worked the first night, but even though the job
    > was running the second night, it didn't do anything at 8:00 and it
    > should have. Problem is, if any kind of a joblog was generated, the
    > system operator deleted it.
    >
    > Perhaps a better way would be just to resubmit the job??


  3. Re: CL question on file

    On Aug 10, 7:59 am, ga wrote:
    > I think with CL I can only use one file?
    >
    > I wrote a C/L program to create a file at 8:00 each night and process
    > it, then when it's done it closes the file and deletes it. But in the
    > code, I write it to loop back to near the top of the program to reset
    > it for the next night.
    >
    > Question is, if I create/read/delete the file in the program, when it
    > loops back to the top can it do the same steps again the next day or
    > once I have deleted the file will it not recreate it.
    >
    > For some reason, it worked the first night, but even though the job
    > was running the second night, it didn't do anything at 8:00 and it
    > should have. Problem is, if any kind of a joblog was generated, the
    > system operator deleted it.
    >
    > Perhaps a better way would be just to resubmit the job??
    >
    > thanks
    > ga
    > ga
    > nos...@nospam.fmctc.com


    What version/release are you at ? The current release (V5R4) allows
    CL to open up to 5 files.


  4. Re: CL question on file

    ga wrote:

    > Question is, if I create/read/delete the file in the program, when it
    > loops back to the top can it do the same steps again the next day or
    > once I have deleted the file will it not recreate it.


    The simplest answer is to have the loop in one program and have it CALL
    a second program that handles all file related actions. Write the second
    program to simply process one file. Each time it's called from within
    the loop, it will be reinitialized.

    Any values needed from the loop-control program may be passed in as parms.

    --
    Tom Liotta
    http://zap.to/tl400

+ Reply to Thread