• The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
Menu
  • The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
  • 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
  • Guru: Retrieving The Long And Short Object Name

    August 14, 2023 Bob Cozzi

    Many releases ago, IBM i received “Long SQL Names” for files and libraries. These new longer names (up to 128 characters) were well received by SQL enthusiasts, but largely ignored by the mainstream IBM i developer. As each version of IBM i emerged, more and more shops experienced one or more objects with a longer-than-10-character name.

    Recently I created a file named BOAT_TRAFFIC. This name is clearly longer than 10 characters. I used SQL DDL (the CREATE or REPLACE TABLE statement) to create the file. Using SQL DDL is the only real way to create an object with a long …

    Read more

Previous Articles Next Articles

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