Newsletters   Subscriptions  Forums  Store  Media Kit  About Us  Contact  Search   Home 
fhg
Volume 4, Number 7 -- March 3, 2004

Different Record Formats Without Level Checks


Hey, Ted:

For some time now, you have touted the advantages of using SQL rather than native OS/400 and DB2/400 interfaces. A recent project that I worked on showed yet another advantage that you have not mentioned.

This project took place in a shop that uses a combination of packaged and homegrown software. Their production manufacturing system runs the current version of the package, but some of the homegrown software uses certain files from an old release of the package.

My task was to write a program that would read a certain file from both the homegrown and the packaged systems. The problem I faced was that certain fields had been enlarged with the current release. A certain quantity field, for example, had been expanded from five digits to nine.

Using native interfaces would have required me to compile my RPG program under the two different environments. I would have added a comment to the program, noting that the program must be compiled in both places, and hoped that anyone who modified the program in the future would notice the comment.

However, since I primarily use SQL rather than native interfaces, I was able to compile my program only once, into a library common to both environments, because SQL does not check record format levels.

To receive the quantity field mentioned above, I defined a nine-digit packed-decimal host variable. SQL did not care that this definition did not match the homegrown version of the field. SQL only complains when a host variable is not able to accept all the non-zero digits to the left of the decimal point of a field. In such a case, SQL sets the SQLSTT (SQL state) variable to 22003, which indicates that a numeric variable is out of range.

--Keith


Thanks for the tip, Keith. I'd like to emphasize that the host variable does not have to be as large as the field that it receives. The host variable only has to be big enough to contain the values that are stored in the field. For instance, suppose a field is defined with seven digits to the left of the decimal point, but the largest value is 101. SQL will not return status 22003 as long as the host variable has at least three significant digits.

--Ted

Sponsored By
CLIENT SERVER DEVELOPMENT

Never Worry About Time Again

Daylight savings time coming up? Need to synchronize your iSeries or AS/400 with a network time device? Is your AS/400 time in sync with other servers on your network? Participating in HIPAA or EDI transactions?

Let Atomic Time Manager 400 synchronize your clocks!

Atomic Time Manager 400 is an easy-to-use utility developed by Client Server Development. It resides on your iSeries and automatically adjusts your hardware and software clocks, keeping them in sync with other servers on your network.

The Atomic Time Manager 400 also automatically adjusts your clocks to "spring forward" and "fall back" when daylight savings time changes. Forget about complex offsets, SNTP configuration, and scheduling CL programs to adjust time--the Atomic Time Manager 400 does it for you.

The best part, at only $499 per iSeries or AS/400, the Atomic Time Manager 400 is the affordable solution for your time management needs.

Click here to learn more about the Atomic Time Manager 400
and order yours through Guild Companies now!


Editors: Howard Arner, Joe Hertvik, Ted Holt,
Shannon O'Donnell, Kevin Vandever
Managing Editor: Shannon Pastore
Contributing Editors: Raymond Everhart, G. Wayne Hawks,
Marc Logemann, David Morris
Publisher and Advertising Director: Jenny Thomas
Advertising Sales Representative: Kim Reed
Contact the Editors: To contact anyone on the IT Jungle Team
Go to our contacts page and send us a message.

THIS ISSUE
SPONSORED BY:

T.L. Ashford
Guild Companies
Client Server Development
WorksRight Sofware
COMMON


BACK ISSUES

TABLE OF
CONTENTS
Sleep Soundly with Hibernate

Practical Use of a Translation Table

Different Record Formats Without Level Checks

Admin Alert: Five Quick PC5250 Tricks for Administrators

OS/400 Alert: Have You Been Snarfed?



Copyright © 1996-2008 Guild Companies, Inc. All Rights Reserved.
Guild Companies, 50 Park Terrace East, Suite 8F, New York, NY 10034
Privacy Statement