• 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

    …

    Read more
  • Another Way to Dump an IFS File

    October 25, 2002 Timothy Prickett Morgan

    Hey, Ted:

    When answering the question that was posed in the October 18 issue of Midrange Guru, “Hex Dump of an IFS File,” you provided a Qshell answer. If you don’t happen to have Qshell installed, you can use two CL commands instead. Here’s how:

    CPY OBJ('/somedir/somefile.txt') +
       TOOBJ('/qsys.lib/somelib.lib/hexifs.usrspc') +
       TOCODEPAGE(*CALC) DTAFMT(*TEXT)
    
    DMPOBJ DMPOBJ OBJ(somelib/hexifs) +
       OBJTYPE(*USRSPC)
    

    Experiment with the codepage and data format parameters of the Copy (CPY) command to give needed conversions.

    There are a couple of other details of which you should be aware:

    • CPY fails if the user space already exists.
    • Using CPY
    …

    Read more
  • Johnny Can’t Read and RPG Can’t Do Math

    October 25, 2002 Timothy Prickett Morgan

    Hey, Ted:

    I ran into an anomaly and was wondering if you could shed some light on it.

    A subprocedure that I wrote doesn’t return the correct value. The problem is caused by an expression that doesn’t return the value that I think it should.

    Why does the expression, which returns the correct value (.3) in the Test4 evaluation, apparently return an incorrect value (.29999) when combined in another expression?

    H EXPROPTS(*MAXDIGITS)
    D X               S              5  0 Inz(1)
    D Y               S              5  0 Inz(6)
    D  ABC            S             15A   Inz('13077.39')
    D  NUM            S             15  5 Inz(0000013077.00000)
    D  Digits         S             10    Inz('0123456789')
    
    …

    Read more

Content archive

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

Recent Posts

  • 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
  • Big Blue Raises IBM i License Transfer Fees, Other Prices
  • Keep The IBM i Youth Movement Going With More Training, Better Tools
  • Remain Begins Migrating DevOps Tools To VS Code
  • IBM Readies LTO-10 Tape Drives And Libraries
  • IBM i PTF Guide, Volume 27, Number 23

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