Home > AS/400 Tips > iSeries administrator tips > Writing to a file from CL -- revisited
iSeries 400 Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

ISERIES ADMINISTRATOR TIPS

Writing to a file from CL -- revisited


Steve Riedmueller
06.15.2005
Rating: -3.92- (out of 5) Hall of fame tip of the month winner


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


You Can View User Feedback To This Tip

In a previous tip, Who said you can't write to file from CL? Clive Griffiths published his WRTREC command/CL combination which allows one to write a record to a physical file from a CL program.

I have been using this code for a few years and it is very useful. The implementation seemed very complex for a simple idea. I came up with an alternative that runs five times faster according to my primitive testing. My implementation uses the QSH "echo" command, redirecting output to the physical file in "append" mode.

USER FEEDBACK TO THIS TIP

  • I would like to add a correction to this tip.
    1. Qshell should be installed (ss1 33)
    2. Max rec length 512

    — Avi Hecht
  • CL has been able to do a few forms of writing to files for many years. CL can call the Sort (QLGSORT) API and pass records into the API through the input buffer -- the API can send those to output files which can be copied/appended to other files. CL can call QM queries to effect SQL INSERTs to files.

    But in Version 5 of OS/400, CL got even closer through the QShell DB2 utility (see example #1). And with a little research, you can see that the DB2 utility is a symbolic link to program QZDFMDB2 (see example #2).

    Still not perfect, but pretty workable.

    #1
    QSH CMD('db2 "INSERT INTO QIWS.QCUSTCDT (CUSNUM, LSTNAM, INIT) VALUES(876543, ''Liotta'', ''T'')"')
    #2
    CALL QZDFMDB2 ('INSERT INTO TOML.QCUSTCDT (CUSNUM, LSTNAM, INIT) VALUES(876543, ''Liotta'', ''T'') ')

    — Tom Liotta

==================================
MORE INFORMATION ...


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   



RELATED CONTENT
iSeries administrator tips
Analyze the health of your IBM i server with iScore
Researching high availability for your System i shop
Translating Linux for IBM i admins: Using GUI to make it easy
Translating Linux for IBM i admins: Working with jobs and networking
OpenOffice: What to know before making the transition from Microsoft Office
OpenOffice: An enterprise open source solution
Database performance comparisons on IBM i
Translating Linux for IBM i admins: User profile commands
Modern System i reports using Client Access
Tips for installing Lotus Domino server on a System i partition

iSeries CL programming
Taking advantage of CL advancements, starting with V5R3
Checking in on your IBM i authorization lists
Running PHP open source applications: NOBODY needs authority
Simplify the process of converting a spool file from iSeries into an Excel spreadsheet
CL program for daily backups
An automated CL method of moving a query from AS/400 to Excel
Changing user password expiration
Eight steps for creating program documentation using AS/400 utilities
DAYSPAST CLLE program for AS/400: Compares object creation date with today's date
Advanced Job Scheduler help

Performance
Will overloaded discs impact iSeries performance?
Extend storage capacity on an IBM i without negatively effecting system performance
Database drivers on the i: MySQL vs. IBM Toolbox
Performance tuning for IBM i: The basics and beyond
IBM releases new Power products for the midrange
Top System i admin tips for 2006
Catholic Charities keeps track of homeless with iSeries
i5 error messages: What you need to know
IBM races for clock speed
System shutting down after cleanup

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary


ON THIS TOPIC
==================================

The Best Web Links: Tips, tutorials and more.

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

Read this Search400.com Featured Topic: Take control of your iSeries.

Ask the Experts yourself: Our systems management gurus are waiting to answer your technical questions.


Rate this Tip
To rate tips, you must be a member of Search400.com.
Register now to start rating these tips. Log in if you are already a member.


Submit a Tip




DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



iSeries Security - Security Tools, Physical Security and System Security
HomeNewsTopicsITKnowledge ExchangeTipsBlogsAsk the ExpertsMultimediaWhite PapersProducts
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 1999 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts