• The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
Menu
  • The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
  • Use SQL to Easily Update Multi-Key Files

    July 27, 2005 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


    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Tags:

    Sponsored by
    Midrange Dynamics North America

    Git up to speed with MDChange!

    Git can be lightning-fast when dealing with just a few hundred items in a repository. But when dealing with tens of thousands of items, transaction wait times can take minutes.

    MDChange offers an elegant solution that enables you to work efficiently any size Git repository while making your Git experience seamless and highly responsive.

    Learn more.

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Cozzi Updates RPG xTools, Partners with Linoma DRV Technologies Gets Hip to Forms

    Leave a Reply Cancel reply

Volume 5, Number 29 -- July 27, 2005
THIS ISSUE
SPONSORED BY:

ProData Computer Svcs
Advanced Systems Concepts
Patrick Townsend & Associates

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

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