• The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
Menu
  • The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
  • Reader Feedback and Insights: SQL to the Rescue!

    October 25, 2002 Timothy Prickett Morgan

    Hey, Ted:

    I am writing in regard to the September 20, 2002 Midrange Guru article, “Comparing Lists of Numbers to a Value .” I would like to offer the following embedded SQL example as an alternative solution:

    D found           s              1a              
    D
     * if (field1 or field2 or field3) > 25 
    C/exec sql                                       
    C+    select case                                
    C+      when max(:field1, :field2, :field3) > 25 
    C+         then '1'                              
    C+         else '0'                              
    C+      end                                      
    C+    into :found                                
    C+    from (any file with one record)
    C/end-exec                                       
    C                                                
    C                   if        found = *on        
     .................. whatever ..................
    C                   else 
    ................... whatever ..................
    C                   endif
    

    This program uses the SQL CASE statement to evaluate whether any one of a list of input host variable values is greater than a control value. A pseudo-Boolean character value is returned, indicating whether the condition was satisfied. The appropriate program logic can then be executed based upon the resulting value.

    — Jeff

    Thanks for the idea, Jeff. Isn’t it silly that you have to have a one-record dummy file for these things?

    — Ted

    Sponsored By
    ADVANCED SYSTEMS CONCEPTS

    Business Analytics
    – Practical –
    – Cost Effective –
    – Easy to Deploy –

    SEQUEL FYI

    User Quote:
    “I love SEQUEL FYI because it lets me look at the data any way I need to see it, instantly. This is the easiest tool to manage complex product relationships that I have ever seen.”

    SEQUEL FYI offers outstanding OLAP business intelligence functionality for a fraction of the cost of comparable solutions.

    Read More > View Streaming Video

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Tags: Tags: mgo_rc, Volume 2, Number 82 -- October 25, 2002

    Sponsored by
    Rocket Software

    Two Steps Forward, No Steps Back

    For over 35 years, Rocket Software’s solutions have empowered businesses to modernize their infrastructure, unlock data value, and drive transformation – all while ensuring modernization without disruption.

    LEARN MORE

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Type2 IFS Directories Reader Feedback and Insights: Thanks for the Information

    Leave a Reply Cancel reply

MGO Volume: 2 Issue: 82

This Issue Sponsored By

    Table of Contents

    • Reader Feedback and Insights: SQL to the Rescue!
    • Another Way to Dump an IFS File
    • Johnny Can’t Read and RPG Can’t Do Math

    Content archive

    • The Four Hundred
    • Four Hundred Stuff
    • Four Hundred Guru

    Recent Posts

    • Liam Allan Shares What’s Coming Next With Code For IBM i
    • From Stable To Scalable: Visual LANSA 16 Powers IBM i Growth – Launching July 8
    • VS Code Will Be The Heart Of The Modern IBM i Platform
    • The AS/400: A 37-Year-Old Dog That Loves To Learn New Tricks
    • IBM i PTF Guide, Volume 27, Number 25
    • Meet The Next Gen Of IBMers Helping To Build IBM i
    • Looks Like IBM Is Building A Linux-Like PASE For IBM i After All
    • Will Independent IBM i Clouds Survive PowerVS?
    • Now, IBM Is Jacking Up Hardware Maintenance Prices
    • IBM i PTF Guide, Volume 27, Number 24

    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