ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Force Copy

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Force Copy

    Is there an option in CPYF to force a file to copy even if it is empty?

  • #2
    Re: Force Copy

    MBROPT(*REPLACE) cancels if the from-file is empty. MBROPT(*ADD) does not cancel. Can you tell us more about what you need to do?
    Last edited by TedHolt; February 9, 2015, 09:15 AM.

    Comment


    • #3
      Re: Force Copy

      Below is my copy command running in my CL. When I run my CL, based on the data in the files, I do not know if the file I am coping is empty or not. If I run my CL more than once with the same CL, the copy command errors out saying empty member not copied. Just want the error to go away and copy the file if it has data or not.

      CPYF FROMFILE(COAF010) TOFILE(TICKET/SVCOA40101) MBROPT(*REPLACE) CRTFILE(*YES)

      Comment


      • #4
        Re: Force Copy

        I'm assuming that what you want is the target file to be cleared if the source file is empty. Unfortunately, there is no way in the CPYF command to do that. The easy fix is to clear the target file first (CLRPFM) and then perform the copy with MBROPT(*ADD).

        Comment


        • #5
          Re: Force Copy

          Here's an example of what Brian is talking about:

          http://www.itjungle.com/fhg/fhg090810-printer02.html
          Last edited by TedHolt; February 16, 2015, 04:00 PM.

          Comment


          • #6
            Re: Force Copy

            Here's a follow-up to the article I mentioned:

            http://www.itjungle.com/fhg/fhg030211-story02.html

            Comment


            • #7
              Re: Force Copy

              I ended up doing this a different way. I delete the "to" file, then copy with create set to yes.

              Comment

              Working...
              X