• 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

  • IBM i Has a Future ‘If Kept Up To Date,’ IDC Says
  • When You Need Us, We Are Ready To Do Grunt Work
  • Generative AI: Coming to an ERP Near You
  • Four Hundred Monitor, March 22
  • IBM i PTF Guide, Volume 25, Number 12
  • Unattended IBM i Operations Continue Upward Climb
  • VS Code Is The Full Stack IDE For IBM i
  • Domino Runs on IBM i 7.5, But HCL Still Working on Power10
  • Four Hundred Monitor, March 6
  • IBM i PTF Guide, Volume 25, Number 11

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 © 2023 IT Jungle