ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

IFS files

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

  • IFS files

    Hi,

    There are mutliple files placed on IFS folder with timestamp. How do I copy all the FILES from ifs files and place it it single PF

    Please advise

    Sudha-K
    The Secret Of Achieving Your Goals Is Revealed Before Your Eyes.
    System Engineer

    Sudha...

  • #2
    Re: IFS files

    CPYFRMIMPF and CPYFRMSTMF have a MBROPT parameter. Use *REPLACE on the first copy and *ADD on the rest of them.

    Comment


    • #3
      Re: IFS files

      How to copy all files record(data) from IFS foldet to flatfile?

      Example

      /home/xyz/file1.txt
      /home/xyz/file2.txt
      /home/xyz/file3.txt
      ........................
      ......................
      /home/xyz/file24.txt

      So present there are 24 files inside IFS folder, now i need to copy all records from 24 files and then put into flat file

      Sudha-K
      The Secret Of Achieving Your Goals Is Revealed Before Your Eyes.
      System Engineer

      Sudha...

      Comment


      • #4
        Re: IFS files

        Ted has already given you the answer. What are you missing?

        Comment


        • #5
          Re: IFS files

          It really depends on the format of your stream files (I assume these are stream files) vs. the format of your PF. What you need to do will vary greatly depending on how you need to transform the files.

          If the only thing needed for transformationis to look for newline characters and use that to determine where records start/stop. (But the format of the records themselves already matches the PF) then you could do something like this:

          QSH CMD('cat /home/xyz/*.txt | Rfile -wQ YOURLIB/YOURFILE')

          But if a more sophisticated transformation is required, you'd probably want to spin through the list of files and call CPYFRMIMPF for each one. There are several ways to do that... Here are a few alternatives you might consider:
          1. Write a shell script that runs through the list of files, and runs a command on each.
          2. Use QShell to list the filenames to a PF, then write a CL program that reads the PF and runs a command for each file.
          3. Use the IFS APIs to read the list of files, and then process each one.


          The first option is the easiest to code, but it requires some shell script knowledge, and is the slowest running of the choices.
          The second option is probably easier to someone who is more familiar with CL.
          The third option is the most complex, but is the most efficient and versatile.

          Unfortunately, we don't have a lot of information about what you want/need to do, here... Maybe this message will give you some food for thought so you tell us more about what you need done?

          Comment


          • #6
            Re: IFS files

            I pieced a program together to do it.. Basically it reads each character of the IFS file. I had to do this b/c of different formats etc...
            Send me your email and I can send you the code..

            Comment

            Working...
            X