ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

cpytoimpf

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

  • cpytoimpf

    Hi guys,

    I wanto to export a PF to Excel as comma delimited, but I want to headers of the PF exported also. How do I do this? I'm using the command cpytoimpf to copy the PF into a flat file as comma delimited. Any help on how to get the headers of the PF also exported?

  • #2
    Re: cpytoimpf

    there is no really simple way to do this with CL.

    Guess you could use QSHELL write the ifs file first with the headings
    then use cpytoimpf making sure that you are adding not replacing
    Code:
    Replace or add records . . . . . MBROPT         *ADD
    or you could use rpg and write directly to the IFS.
    Replace or add records . . . . . MBROPT *ADD

    All my answers were extracted from the "Big Dummy's Guide to the As400"
    and I take no responsibility for any of them.

    www.code400.com

    Comment


    • #3
      Re: cpytoimpf

      You might copy the PF to another PF writing out the header constants as the first record. I have an account that has folks unable or unwilling to learn Excel and I generate csv files with headers, spacing records and total records...

      Comment


      • #4
        Re: cpytoimpf

        Originally posted by mlcoolj
        Any help on how to get the headers of the PF also exported?
        Convert the data into XML would be my option with the Guiseppe Perotti's tool named DB2XTOOL. This tool gives you a simple command that you can insert into your CL to convert your data w/ headers to the IFS as xml.
        You can find this tool free to d/l however after registration here.
        Philippe

        Comment


        • #5
          Re: cpytoimpf

          Use VBA and OLE DB from within the Excel spreadsheet to connect to the server and execute a "Select" SQL statement to retrieve the data. Here's an example.
          Attached Files
          "Time passes, but sometimes it beats the <crap> out of you as it goes."

          Comment


          • #6
            Re: cpytoimpf

            Hey Littlepd:

            Nice.....Very Very Nice....

            I put that little baby to work already

            Thanks
            GLS
            The problem with quotes on the internet is that it is hard to verify their authenticity.....Abraham Lincoln

            Comment


            • #7
              Re: cpytoimpf

              yes very nice...If I could bake I'd send you a cake

              jamie
              All my answers were extracted from the "Big Dummy's Guide to the As400"
              and I take no responsibility for any of them.

              www.code400.com

              Comment


              • #8
                Re: cpytoimpf

                Thanks! Just bump my Rep Power and we'll call it even!
                "Time passes, but sometimes it beats the <crap> out of you as it goes."

                Comment


                • #9
                  Re: cpytoimpf

                  Already done...

                  GLS
                  The problem with quotes on the internet is that it is hard to verify their authenticity.....Abraham Lincoln

                  Comment


                  • #10
                    Re: cpytoimpf

                    Thanks!

                    (Just between you and me, I'm shootin' for the highest Rep-to-Posts ratio! but don't tell anybody!)
                    "Time passes, but sometimes it beats the <crap> out of you as it goes."

                    Comment


                    • #11
                      Re: cpytoimpf

                      Originally posted by mlcoolj View Post
                      Hi guys,

                      I wanto to export a PF to Excel as comma delimited, but I want to headers of the PF exported also. How do I do this? I'm using the command cpytoimpf to copy the PF into a flat file as comma delimited. Any help on how to get the headers of the PF also exported?
                      I usually call an RPG program from my CL to write the header and then i do the CPYTOIMPF. Do not if its efficient but it surely is simple and it works.
                      Regards,
                      KR

                      Comment


                      • #12
                        Re: cpytoimpf

                        A program we found easy to use is CVTPFXLS. It has options to include headings, text, etc. Available at <http://www.geocities.com/SiliconValley/Pines/5581/tips.htm>

                        Comment


                        • #13
                          Re: cpytoimpf

                          We have used CRTCSVF from: http://homepage1.nifty.com/uzaemon/

                          Good stuff there.

                          Pete

                          Comment


                          • #14
                            Re: cpytoimpf

                            ...here is example of using RPG and XML to generate Excel files:

                            Comment

                            Working...
                            X