ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

CPYTOIMPF question

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

  • CPYTOIMPF question

    I want to copy a physical file to the IFS as a CSV file. The physical file has 10 million records and takes about 7 minutes to run. I have been asked to try copying pieces of the file to five different files on the IFS; that is, submit five jobs that copies 2 million record chunks. I just assumed that the CPYTOIMPF gave me a start record and end record parameter like CPYF, but I guess I should never assume because it not appear to be the case. Does anyone have any advice about how I might accomplish this? I thought maybe OVRDBF, but that allows me to start but not end at a specific record. Thanks in advance!

  • #2
    I am trying creating a view where it selects by RRN and copy from that file name.
    Seems to work, but not sure this is the best approach.

    CREATE VIEW MYFILEVIEW AS SELECT * FROM MYFILE WHERE RRN(MYFILE)
    >= 1 AND RRN(MYFILE) <= 2000000​

    Comment


    • #3
      Well an alternative you might consider is to use my Open Access IFS handler program then simply write RPG code using it that splits the file into any number of files of any size you like.

      You can find details and the download link etc. here: https://authory.com/JonParisAndSusan...dler-Revisited

      It links back to an earlier article and if you decide that you need to read that just skip down to the part titled: The OAR Approach. The first part of the article will not be relevant.

      Comment


      • #4
        Thank you!

        Comment


        • #5
          You can also use QSHELL and the SPLIT function.

          Reading the manual

          I can see that it can split by bytes or by lines.
          The last I think is what you are looking for.

          So you could copy the entire file to the IFS and then split it into smaller files.

          Comment

          Working...
          X