• The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
Menu
  • The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
  • V6R1 Run SQL Scripts: Print and Save Result Sets

    June 24, 2009 Skip Marchesani

    The ability to print a Run SQL Scripts result set and/or save it in Excel spreadsheet format has been on my wish list and that of others for a long time. V6R1 has fulfilled these wishes and by doing so has made Run SQL Scripts more functional and easier to use.

    Print capability is now a standard function when a result set is displayed. However the Run SQL Scripts option to “Allow Save Results” must be selected to be able to save a result set in Excel or other file format. To select this option, click on Options in the toolbar and then select “Allow Save Results” in the dropdown menu, as shown in Figure 1.

    Figure 1.

    Note that that I’ve made selections on the Options dropdown menu to allow quick and easy execution of ad hoc SQL queries. It is not necessary to have the identical options selected. To print or save result sets, the option “Display Results in Separate Window” is not required, however “Allow Save Results” must be selected if you wish to save your result sets in Excel or another file format.

    To understand how to print or save a result set, use “Run SQL Scripts” to execute an SQL SELECT statement that will produce a result set and right-click on the result set. The Save Results–Copy–Print menu will appear as shown in Figure 2.

    Figure 2.

    Next click on Print and the Windows print dialogue will appear, as shown in Figure 3, which allows selection of a printer and printer options.

    Figure 3.

    To copy all or selected data from a result set to the clipboard, highlight the data, right-click on the result set, and select “Copy” from the Save Results–Copy–Print menu. The data will be copied to the clipboard, where it can then be pasted to the desired document or location.

    To save the result set in an Excel or other file format, right-click on the result set, and then click on “Save Results” in the Save Results–Copy–Print menu, as shown in Figure 4.

    Figure 4.

    The Save Results dialogue will appear, and it allows the attributes (file name and location, and character set) and format of the result set that is being saved to be determined, as shown in Figure 5.

    If saving to a spreadsheet or other file type format where column headings are desirable, select “Include column headings.” If the result set should be displayed in the saved format immediately after saving it, select “Display the output using.” In this case, since Microsoft Excel 4.0 Worksheet was selected as the file type, Excel would open the saved file displaying the result set as an Excel spreadsheet.

    Figure 5.

    Note that the result set can be saved in six different formats: comma separated; text or tab delimited; Lotus 1-2-3; Microsoft Excel XML; Microsoft Excel 4.0; and Microsoft Excel 3.0. See Figure 6.

    Figure 6.

    When all the file options for the Save Results dialogue have been selected, click OK on the lower right side, and a message will come up stating that the result set information was successfully saved, as shown in Figure 7. If a file with the same name already exists, a message will appear asking if the existing file should be overlaid with the new file.

    Figure 7.

    Click OK on the “Information successfully saved” message, and the result set saved (in this case) in .xls format will be displayed in Excel, as shown in Figure 8.

    Figure 8.

    Skip Marchesani retired from IBM after 30 years and is now a consultant with Custom Systems Corporation. He is also a founding partner of System i Developer and the RPG & DB2 Summit. Skip spent much of his IBM career working with the Rochester Development Lab on projects for S/38 and AS/400 and was involved with the development of the AS/400. He was part of the team that taught early AS/400 education to customers and IBM lab sites worldwide. Skip is recognized as an industry expert on DB2 for i and the author of the book DB2/400: The New AS/400 Database. He specializes in providing customized education for any area of the System i, iSeries, and AS/400; does database design and design reviews; and performs general System i, iSeries, and AS/400 consulting for interested clients. He has been a speaker for user groups, technical conferences, and System i, iSeries, and AS/400 audiences around the world. He is an award-winning COMMON speaker and has received its Distinguished Service Award. Send your questions or comments for Skip to Ted Holt via the IT Jungle Contact page.



                         Post this story to del.icio.us
                   Post this story to Digg
        Post this story to Slashdot

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Tags:

    Sponsored by
    New Generation Software

    FREE Webinar:

    Creating Great Data for Enterprise AI

    Enterprise AI relies on many data sources and types, but every AI project needs a data quality, governance, and security plan.

    Wherever and however you want to analyze your data, adopting modern ETL and BI software like NGS-IQ is a great way to support your effort.

    Webinar: June 26, 2025

    RSVP today.

    www.ngsi.com – 800-824-1220

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Sponsored Links

    New Generation Software:  FREE Query Migration Planning Webinar, June 25, 2 p.m. EST
    Tri-Delta Resources:  Free 90 Night Disaster Recovery Service For Your IBM i
    looksoftware:  Why Service-Enable? View the On-Demand Webinar

    IT Jungle Store Top Book Picks

    Easy Steps to Internet Programming for AS/400, iSeries, and System i: List Price, $49.95
    The iSeries Express Web Implementer's Guide: List Price, $49.95
    The System i RPG & RPG IV Tutorial and Lab Exercises: List Price, $59.95
    The System i Pocket RPG & RPG IV Guide: List Price, $69.95
    The iSeries Pocket Database Guide: List Price, $59.00
    The iSeries Pocket SQL Guide: List Price, $59.00
    The iSeries Pocket Query Guide: List Price, $49.00
    The iSeries Pocket WebFacing Primer: List Price, $39.00
    Migrating to WebSphere Express for iSeries: List Price, $49.00
    Getting Started With WebSphere Development Studio Client for iSeries: List Price, $89.00
    Getting Started with WebSphere Express for iSeries: List Price, $49.00
    Can the AS/400 Survive IBM?: List Price, $49.00
    Chip Wars: List Price, $29.95

    Rational and Happy: IBM Wins Evans’ Development Tool Survey Again Midrange Shops Shift Priorities This Year

    Leave a Reply Cancel reply

Volume 9, Number 21 -- June 24, 2009
THIS ISSUE SPONSORED BY:

Help/Systems
Profound Logic Software
CNX

Table of Contents

  • V6R1 Run SQL Scripts: Print and Save Result Sets
  • No More Global Variables!
  • Reader Input: /QOpenSys Redux, PC5250 Popup Keypads, and Even Farther Beyond Replication

Content archive

  • The Four Hundred
  • Four Hundred Stuff
  • Four Hundred Guru

Recent Posts

  • Public Preview For Watson Code Assistant for i Available Soon
  • COMMON Youth Movement Continues at POWERUp 2025
  • IBM Preserves Memory Investments Across Power10 And Power11
  • Eradani Uses AI For New EDI And API Service
  • Picking Apart IBM’s $150 Billion In US Manufacturing And R&D
  • FAX/400 And CICS For i Are Dead. What Will IBM Kill Next?
  • Fresche Overhauls X-Analysis With Web UI, AI Smarts
  • Is It Time To Add The Rust Programming Language To IBM i?
  • Is IBM Going To Raise Prices On Power10 Expert Care?
  • IBM i PTF Guide, Volume 27, Number 20

Subscribe

To get news from IT Jungle sent to your inbox every week, subscribe to our newsletter.

Pages

  • About Us
  • Contact
  • Contributors
  • Four Hundred Monitor
  • IBM i PTF Guide
  • Media Kit
  • Subscribe

Search

Copyright © 2025 IT Jungle