Newsletters Subscriptions Media Kit About Us Contact Search Home

mgo
OS/400 Edition
Volume 3, Number 26 -- April 16, 2003

Compiling a Program that Uses an Outfile


Hey, Ted:

I am considering using APIs from now on, rather than outfiles, because it is such a chore to run the commands to build the outfiles before compiling a program. Besides, APIs are faster. What do you think?

--Bobby


APIs are faster, but outfiles are much easier to use. I use outfiles whenever I can because I always have more work than I can do. I use an API if performance is an issue or if an API has functionality that is not available with an outfile.

The reason why that compilation is a problem for you is that you are not taking advantage of the outfiles that IBM has already created for you. I always write my programs to use IBM's outfiles, and override them to my own outfiles at runtime.

To find the name of IBM's outfile, prompt the command that will build the outfile, change the OUTPUT parameter to the value *OUTFILE, and press Enter. The command prompter opens the OUTFILE parameter. Tab to the OUTFILE parameter, and press F1 to open the help text, which tells the name of IBM's file and its record format name.

In the following example, a CL program (or procedure) runs the Display Object Description (Display Object Description) command to build an outfile. The help text says that the output will be based on IBM's QADSPOBJ file, which is available at compilation time.

DCLF       FILE(QADSPOBJ)                                  
                                                              
/* Create list of DSPxxx and WRKxxx commands from QSYS */  
DSPOBJD    OBJ(QSYS/DSP*) OBJTYPE(*CMD) +                  
             OUTPUT(*OUTFILE) OUTFILE(QTEMP/QADSPOBJ)      
DSPOBJD    OBJ(QSYS/WRK*) OBJTYPE(*CMD) +                  
             OUTPUT(*OUTFILE) OUTFILE(QTEMP/QADSPOBJ) +    
             OUTMBR(*FIRST *ADD)                           
                                                              
   OVRDBF     FILE(QADSPOBJ) TOFILE(QTEMP/QADSPOBJ)
READ:                                              
   RCVF                                            
   MONMSG     MSGID(CPF0864) EXEC(GOTO EOF)
... more source code omitted ...
   GOTO  READ

EOF:
   DLTOVR   FILE(QADSPOBJ)

The data goes to file QTEMP/QADSPOBJ. The override causes the program to read the data in QTEMP.

--Ted


Sponsored By
CLIENT SERVER DEVELOPMENT

LEARN SQL BY EXAMPLE!

Reader Feedback: A great book! Interestingly, it could have two completely different audiences. One is the audience of traditional AS/400 people like myself, that need to learn how SQL works. And the other is the experienced SQL person, who needs to know how SQL on the AS/400 is different.
-- Jerry K.

Buy your copy of iSeries and AS/400 SQL at Work direct from the author, Howard F. Arner, Jr. This is THE book to teach you SQL on the iSeries.

The book is chock full of information that is useful for beginners and experts alike. The book comes with a CD that has all of the sample data and queries used in the book and a FREE copy of SQLThing so you can work through the examples in the book. You learn by doing!

With Howard's expert guidance, you'll learn and understand many topics, including the following:

  • Relational Concepts and Terms
  • SQL Select Basics
  • Manipulating Data with SQL
  • Advanced Select Statements for Powerful Reports
  • Cursors, Transactions, Journals, and Logging
  • Debugging SQL Statements and Enhancing Performance
  • Stored Procedures/Using Legacy Programs in SQL
  • Embedded SQL in RPG

Howard F. Arner, Jr., is a programmer who has published extensively on AS/400 integration and database topics. In his book, iSeries and AS/400 SQL at Work, Howard provides detailed coverage of SQL for business environments by using practical examples--available on the CD--to be performed by the reader. More advanced chapters teach how to become proficient in industry-standard SQL to manipulate AS/400 data, use scalar functions to summarize data, and integration of SQL into RPG and COBOL. This is the perfect guide for beginners and advanced SQL users.

Here's what readers are saying about iSeries and AS/400 SQL at Work by Howard F. Arner:

Anyone working with AS/400 query should look into buying this book. Now using AS/400 query seems a little odd and very cumbersome. His writing is laid out very well and is easy to read. While reading this, I felt that he was actually there explaining the chapters to me as a one-on-one instructor.
-- Jonathan Tripp, Deerfield Beach, Florida

If you wondered how to call AS/400 programs from your Visual Basic program correctly, this book is your one source for how to do so. It's the first book on the market that answered all of my client/server questions when I deal with PC to AS/400 programming tasks.
Not only does Howard do a good job of explaining how stored procedures work, but he gives some great coding examples on how to get you up and running correctly. Howard goes the extra mile and talks about performance, too--one thing that normally is lacking in many other books.

-- Bob Butcher, Sidney, New York

Learn how SQL can make your job easier and you more productive.
Order your copy at SQLThing.com today!


THIS ISSUE
SPONSORED BY:

Damon Technologies
Client Server Development


BACK ISSUES

TABLE OF
CONTENTS

Securing File Overrides

Compiling a Program that Uses an Outfile

Reader Feedback and Insights: More Feedback on 'Why Java?'


Editors
Howard Arner
Joe Hertvik
Ted Holt
David Morris

Managing Editor
Shannon Pastore

Publisher and
Advertising Director:

Jenny Thomas

Advertising Sales Representative
Kim Reed

Contact the Editors
Do you have a gripe, inside dope or an opinion?
Email the editors:
editors@itjungle.com

Copyright © 1996-2008 Guild Companies, Inc. All Rights Reserved.