Newsletters   Subscriptions  Forums  Store   Career  Media Kit  About Us  Contact  Search   Home 
fhg
Volume 5, Number 29 -- July 27, 2005

Use SQL to Easily Update Multi-Key Files


Hey, Ted:


Updating a single record in a file that has a lot of key fields often requires SQL commands with complicated WHERE clauses. I use a technique with web applications that greatly simplifies the WHERE clause. I have never seen this technique published before, so I hope you can use it.

When I retrieve a record that will be updated through a Web browser, I select the relative record number along with the data.

SELECT RRN(MyFile) as storedRRN, MyFile.* 
  FROM MyFile 
 WHERE ENBBTYPE = 'COPY' and ENBBTCH# = 4062

When I update, I need only refer to the relative record number.

UPDATE MyFile 
   SET SomeCode = 'FRO', Description = 'Front' 
 WHERE RRN(MyFile) = storedRRN

--Chuck Wakelee, Cardone Industries


Since I favor making things as simple as possible, I am glad to publish Chuck's tip. It may not be worth my mentioning it, but Chuck's SQL statements are bare-bones illustrations. To use this technique in a program will require the use of host variables.

--Ted


Sponsored By
ADVANCED SYSTEMS CONCEPTS

SEQUEL can be used for virtually ALL data access functions on the iSeries.

A Windows-based user interface makes it easy to design queries and reports.

SEQUEL offers executive dashboards, drill-down data analysis and run-time prompts to deliver important iSeries data to managers and other non-technical users.

E-mail and FTP delivery let you deliver information to remote users and servers.

www.asc-iseries.com


Technical Editors: Howard Arner, Joe Hertvik, Ted Holt,
Shannon O'Donnell, Kevin Vandever
Contributing Technical Editors: Joel Cochran, Wayne O. Evans, Raymond Everhart,
Bruce Guetzkow, 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:

ProData Computer Svcs
Advanced Systems Concepts
Patrick Townsend & Associates


Four Hundred Guru

BACK ISSUES

TABLE OF
CONTENTS
Of Middle-Tested Loops

Use SQL to Easily Update Multi-Key Files

Admin Alert: To Each Its Own in Spooled File Management


The Four Hundred
iSeries Programmers Irate Concerning CGIDEV2 Limbo

Is Security the First Step Toward Regulatory Compliance?

iSeries Sales Increase by 10 Percent in Q2

As I See It: In Defense of Entitlement

Four Hundred Stuff
SafeData Launches Hosting Service for HA and DR

Circuit City Streamlines Tedious Testing Tasks with TestBench

SoftLanding Enhances Open Source Change Management System

Cozzi Updates RPG xTools, Partners with Linoma

Four Hundred Monitor


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