sponsored links

Collapse

Announcement

Collapse
No announcement yet.

DB file to CSV, with column headings

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

  • DB file to CSV, with column headings

    Is there a way to copy an iSeries data base file to a CSV file with column headings in row 1 of the CSV file or does this have to be built one line at a time with an RPGLE program. CPYTOIMPF only transfers the data but does not include column headings. I would like to use the text or column headings from the DB file as the column heading in the CSV file, if possible. I want to store it on the IFS or a DB2 library, if necessary

  • #2
    CPYFRMIMPF has an option to include the column names, aka field names. But not the "column headings" -- this is the first time I've heard someone ask for that. Are you trying to use this as a replacement for creating a report? You may have to write that yourself.

    Comment


    • jtaylor___
      jtaylor___ commented
      Editing a comment
      I have a DIY command I wrote years ago that allows you to export to CSV using column names, heading or text. Headings/text allow end-users to pull the data into Excel and not have to interpret cryptic DDS-style column names.

  • #3
    Originally posted by Scott Klement View Post
    CPYFRMIMPF has an option to include the column names, aka field names. But not the "column headings" -- this is the first time I've heard someone ask for that. Are you trying to use this as a replacement for creating a report? You may have to write that yourself.
    I have to send the file to another non-iSeries system that supports long column heading names. I had to do this one other time and had to write a program to do it. Shoulda kept a copy.

    Comment


    • #4
      If the headings are always the same, a quick way would be to create a STMF template with the headings. When you want to create your CSV, copy the template somewhere, then use CPYTOIMPF to copy the data to the STMF with the *ADD records option . You could of course create a program to generate the headings which would be more versatile.

      Comment

      Working...
      X