If I understand you correctly, you want the file field description copied and written to a file.
In a CL do a DSPFFD to an outfile and then call a pgm (RPG etc) read in that file extracting the description as required.
Neil.
Last Wiki Answer Submitted: November 19, 2009 10:59 am by NeilD380 pts.
If you live outside the United States, by submitting your email address you consent to having your personal data transferred to and processed in the United States.
If we knew more on why you want to do this, we may be able to come up with better answers.
The only reason I can think of for a flat file to contain column headings is so it can be converted to a .CSV. If this is the case then google for a command called CVTPFXLS. This will take the file and convert it to an excel spread sheet complete with column headings. You can then save the file as a .CSV
If at all possible, don’t query QSYS/QADBIFLD. Better would be to use the views provided over it rather than the PF itself. Query QSYS2/SYSCOLUMNS instead.
Consider a specific function that can create a single row for any list of columns from any table. If you’re going to need to do this once, you’ll probably need it again. If you can generate a single row for column headings, you can always append additional rows for column data.
I am very interested in this, having the same problem.
I do get labeltext, column headings from QSYS2.syscolumns with sql, but it is in one row per label, and I am looking how to change it to columns, so i can make a union with another sql that has the data but without column headings?
Can somebody help me on that. and files will be diffrent, so column headings will be different.
Query the systemfile QSYS/QADBIFLD.
Maybe this sample code can help you:
Replace the squared brackets and content with your own library and filname.
You may find other interesting info in the other sytem database files. Use command
to find these files.
You may use Query/400 also.
Warning: DO NOT try to update these files.
Good luck
DanTheDane
If we knew more on why you want to do this, we may be able to come up with better answers.
The only reason I can think of for a flat file to contain column headings is so it can be converted to a .CSV. If this is the case then google for a command called CVTPFXLS. This will take the file and convert it to an excel spread sheet complete with column headings. You can then save the file as a .CSV
If at all possible, don’t query QSYS/QADBIFLD. Better would be to use the views provided over it rather than the PF itself. Query QSYS2/SYSCOLUMNS instead.
Consider a specific function that can create a single row for any list of columns from any table. If you’re going to need to do this once, you’ll probably need it again. If you can generate a single row for column headings, you can always append additional rows for column data.
Tom
I am very interested in this, having the same problem.
I do get labeltext, column headings from QSYS2.syscolumns with sql, but it is in one row per label, and I am looking how to change it to columns, so i can make a union with another sql that has the data but without column headings?
Can somebody help me on that. and files will be diffrent, so column headings will be different.