• The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
Menu
  • The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
  • Guru: Fooling Around With SQL And RPG

    April 15, 2024 Gregory Simmons

    Editor’s Note: This was originally scheduled to be published on April 1. No joke. And for a lot of complex reasons, that could not happen. But, it’s still fun, so enjoy.

    I started out one morning, purely interested in having a bit of fun. Honest. In RSS within ACS, I often like to run this SQL:

     select *
     from json_table(
          QSYS2.HTTP_GET('https://icanhazdadjoke.com/',
                  '{"header": "Accept,application/json", "sslTolerate":"true"}'),
                  'lax $' columns ("joke" varchar(200) CCSID 1208)
          )
    

    Okay, that was fun. This is harmless, good fun. But then I thought, what if I put this into a simple RPG program? Then I …

    Read more
  • Guru: Assertions, Take 2

    February 12, 2024 Ted Holt

    It’s been almost 20 years since Cletus the Codeslinger introduced assertions to the IBM midrange world, and in that time, I have included many assertions in my RPG programs. During that 20 years, RPG has changed a bit and Cletus has quit writing articles (but not source code), so I’ve taken it upon myself to update the code he gave us.

    First, however, it might be a good idea to briefly review the topic of assertions for readers who don’t know what they are. An assertion is a program statement or command that cancels a program if a fatal condition …

    Read more
  • Guru: Getting Started With The Code 4 i Extension Within VS Code

    January 22, 2024 Gregory Simmons

    The Code for IBM i extension is growing in popularity and has certainly become my favorite source code editor. This article is not an attempt to convince you to drop RDi and switch to VS Code. Rather, I aim to share with you a few of my favorite settings and features in VS Code.

    Join In The Discussion

    Can’t figure out how to do something? Have a suggestion for a new enhancement? I am continually impressed with the speed at which I get responses when I post something. The team of coders and contributors to the Code for IBM i …

    Read more
  • Guru: Using Mixed Lists To Add “Data Structures” To CL Commands

    January 15, 2024 Ted Holt

    I can’t remember the last time I worked on an RPG program that had no data structures, but it was probably on a System/34. Everybody uses data structures, and with good reason – they are as handy as a pocket. When writing CL commands, it is possible to include parameters that are formatted as data structures. IBM calls them mixed lists. In the following paragraphs, I show how this is accomplished.

    You may not realize it, but you have used IBM-supplied commands that have mixed-list parameters. For example, the Copy File (CPYF) command has several such parameters: FROMKEY, TOKEY, INCCHAR, …

    Read more
  • Guru: Partitioning Result Sets Using SQL

    November 27, 2023 Mike Larsen

    While working on a project recently, I needed to retrieve attributes of an item. While that sounds like a simple task, there was a twist. While reviewing the contents of the item master table, I noticed there could be multiple rows for the same item and each row was active and valid from a business perspective.

    I won’t get into the business end of it, but my goal was to return the most recent iteration of the item for further processing in the program. After doing some research and trying some potential solutions, I came across the SQL partition by …

    Read more
  • Guru: Procedure Driven RPG Means Keeping Your Variables Local

    November 6, 2023 Gregory Simmons

    One of the things I love most about procedure driven RPG is that it allows me to keep my variables locally defined. Imagine this horror story that happens all too often in RPG shops.

    Jake: “Hey Gregory, Accounting just called; seems the rebalancing report program is acting up. Didn’t I hear you were working on that the other day?”

    Me: “Ugh, yes. All I had to do was reset this field that was used to show or not show the totaling line between branches. I tested in my library and the fix worked fine.”

    Jake: “Yeah, I had to change …

    Read more
  • Guru: The Transition From Modern RPG IV To Modern SQL

    October 30, 2023 Bob Cozzi

    Seven or eight years ago I was working with a client who needed more contemporary reporting than provided by the legacy Query/400 product. Initially I looked at Db2 Web Query and realized the documentation was sparse and the tutorials for most things, even “getting started” were virtually non-existent. It was also about four times more expensive than I felt it was worth to a P05 or P10 client. I mentioned the documentation issue to the folks at IBM and they agreed. Some of it was eventually resolved, but not enough in my opinion to get the masses to replace Query/400 …

    Read more
  • Guru: Search Source Code For Strings Using SQL

    October 9, 2023 Bob Cozzi

    The IBM-supplied Find String Using PDM (FNDSTRPDM) command and PDM option 25 are how most developers scan for a simple value in a list of source file members. But what if you need more? For example, what if you want to find something complex, such as the field named “CUST” but not the field named “CUSTNAME” “CUSTOMER” or “CUSTNO”? Go ahead, I’ll wait?

    While I do use FNDSTRPDM all the time, I now use the SQL READSRC (Read Source File Member) Table function more often.

    READSRC SQL UDTF

    The READSRC SQL Table function or UDTF (User-defined table function) uses an …

    Read more
  • Guru: TryIT – You’ll Like It

    October 2, 2023 Ted Holt

    I have watched children play Whac-a-mole, but I’ve never played it myself, perhaps because the game unpleasantly reminds me of programs that I have had to work on. I fix one bug, only to see another bug rear its ugly little head. Life’s too short to endure such nonsense. Besides, it is embarrassing for someone to tell me that the program I supposedly just fixed is still broken.

    Suppose you’re working on a 4,000-line RPG program and you comment out lines 650-660. What you don’t realize at the time is that a variable used in line 2755 has to …

    Read more
  • Guru: Procedure Driven RPG With Linear-Main Programs

    September 11, 2023 Gregory Simmons

    A number of years ago, I started migrating away from writing subroutines and started writing procedures instead. Yes, quite often, this was simply because it was “new and shiny” and served no real benefit from their subroutine counterpart. However, as the language and I evolved, I found that my method of approaching every project was what I call procedure driven RPG.

    Let’s have a look at a simple RPG program. In this little program, to give it a purpose, I’m going to have a little fun with math and demonstrate the Fibonacci sequence:

    1	**Free
    
    2	Dcl-s i    Uns(3) Inz(3);
    
    …

    Read more

Previous Articles Next Articles

Content archive

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

Recent Posts

  • To Comfort The Afflicted And Afflict The Comfortable
  • How FalconStor Is Reinventing Itself, And Why IBM Noticed
  • Guru: When Procedure Driven RPG Really Works
  • Vendors Fill In The Gaps With IBM’s New MFA Solution
  • IBM i PTF Guide, Volume 27, Number 27
  • With Power11, Power Systems “Go To Eleven”
  • With Subscription Price, IBM i P20 And P30 Tiers Get Bigger Bundles
  • Izzi Buys CNX, Eyes Valence Port To System Z
  • IBM i Shops “Attacking” Security Concerns, Study Shows
  • IBM i PTF Guide, Volume 27, Number 26

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