Evaluate Weigh the pros and cons of technologies, products and projects you are considering.

Easy column headings for query output files

When using Query/400 to output a file the column headings can become less than meaningful. Use this technique to update the column headings.

When using Query/400 to output a file the column headings can become less than meaningful. Use this technique to update the column headings -- it was done via SQL statements in QMQRY.

It's easy, here is the process:

Your query must output the file with an option 4 -- replace member (otherwise you would overlay the file's attributes each time). Enter source into a source file in your library -- I call mine QQMQRYSRC.

LABEL ON library/filename

                                            

     (field1     is   'heading 1',                                      

      field2     is   'heading 2',                                      

      field3     is   'heading 3',                                      

      field4     is   'heading 4',                                      

      field4     is   'heading 4')     

After you have saved your source you must compile using the following command:

CRTQMQRY QMQRY(yourlibrary/qmqryname)
SRCFILE(yourlibrary/QQMQRYSRC)

Next, run the QMQRY to add the columns
STRQMQRY yourlibrary/qmqryname

The file should now have the new column headings and there should be no need to run the QMQRY again.

Do this for your own files only and not for any production files. If your file is created by query you must use the replace member option, which is option 4 of the output options.

==================================
MORE INFORMATION ON THIS TOPIC
==================================

The Best Web Links: tips, tutorials and more.

Visit the ITKnowledge Exchange and get answers to your developing questions fast.

Ask the Experts yourself: Our application development gurus are waiting to answer your programming questions.


Dig Deeper on iSeries application development tools

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchDataCenter

Close