• The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
Menu
  • The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
  • SQL PL–The FOR Loop

    November 1, 2016 Ted Holt

    SQL PL has four looping structures. The most useful one, to my way of thinking, is the FOR structure. It is different from–and more powerful than–the RPG FOR op code, and it’s easy to learn and use. Here’s how it works.

    FOR iterates over a read-only result set and terminates when there are no more rows to process. Think of a FOR loop as a read-only cursor without the messiness of OPEN, FETCH, and CLOSE. Let me illustrate with a stored procedure.

    create or replace Procedure Billing (in p_BillingCycle dec(3))
    for One_Customer as
       select c.AccountNumber
         from customers as c 
        where 
    …

    Read more
  • SQL PL Conditional Structures

    October 18, 2016 Ted Holt

     Recently I gave a brief introduction to the SQL Procedures Language, or SQL PL, a procedural language that works with the DB2 family of database management systems. Today I present the conditional structures, IF and CASE. If you so choose, you will master them in minutes.

    But first, I need to clear up one matter. In my previous article, I referred to SQL PL as a proprietary language. Mike Cain, of the DB2 for i Center of Excellence, emailed to correct my error. Mike pointed out that SQL PL is based on SQL/Persistent Stored Modules (SQL/PSM), which is an

    …

    Read more
  • Replacing Source in The Twenty-First Century

    October 18, 2016 Ted Holt

    In Searching Source in The Twenty-First Century, I introduced the use of regular expressions for searching within a source member. Searching is great, but sometimes you need to replace what the system finds with something else. Here’s how to replace text when using regular expressions.

    Let’s begin with a source member.


    Notice that there are nine constants named Stat10 through Stat90. Let’s replace
    Stat with Status_. Obviously we can’t replace Stat with Status everywhere it’s found. That would be disastrous!

    Instead, let’s use a regular expression to find the instances where Stat is followed by a digit.


    I

    …

    Read more
  • A Style Guide for Modern RPG and ILE, Part 2

    October 18, 2016 Paul Tuohy

    One of the basic principles of programming is that coding conventions (guidelines and standards) improve the readability of source code and make software maintenance easier. Coding conventions provide the foundation for developing applications that are easy to maintain and modify. This article completes the style guide to coding RPG programs using free-form RPG in an ILE environment started in A Style Guide For Modern RPG And ILE, Part 1.

    Older Functions

    When using free-form RPG (and nothing but free-form RPG), a lot of the old RPG “functionality” is no longer available (e.g., operation codes such as MOVE, MOVEL, GOTO,

    …

    Read more
  • Searching Source In The Twenty-First Century

    October 4, 2016 Ted Holt

    I love it when IBM gives me a way for me to do something I couldn’t do before. When I think of the tools I had to work with three decades ago, I could almost weep. Recently I had to search a source member for a string of characters, and I was overjoyed that LPEX gave me what SEU couldn’t.

    To set the stage for my requirement, I should mention that as a matter of practice, I qualify data structures in my RPG programs. For me to omit the qualified keyword, I have to have a reason.

    dcl-ds  Status       qualified;
       
    …

    Read more
  • What’s In A Save File?

    October 4, 2016 Ted Holt

    Note: The code accompanying this article is available for download here.

    Juliet wondered, “What’s in a name?” Ted wondered, “What’s in a save file?” The Display Save File (DSPSAVF) command would show me only so much, so I wrote a utility to give me more information. Maybe it will be helpful to you.

    It’s common for me to exchange save files with other IBM i professionals. One problem I often run into is that someone (who might be me) cannot restore a save file to their system because the save file was created for a more recent release of

    …

    Read more
  • A Style Guide For Modern RPG And ILE, Part 1

    October 4, 2016 Paul Tuohy

    One of the basic principles of programming is that coding conventions (guidelines and standards) improve the readability of source code and make software maintenance easier. Coding conventions provide the foundation for developing applications that are easy to maintain and modify. This article and an article to follow are a style guide to coding RPG programs using free-form RPG in an ILE environment.

    When developing guidelines and standards, one of the major challenges is to determine what is a standard and what is a guideline. For example, code indentation would be a standard, but whether the code is indented by two,

    …

    Read more
  • RPG Talks To Watson

    September 27, 2016 Paul Tuohy

     

     

    Note: The code accompanying this article is available for download here.

    Yes, RPG can talk to Watson. No special software required, nothing to install, nothing to configure. You just need to be on V7R1, have the ability to use embedded SQL and write just a few lines of code–none of which are complicated. To see how it works, all you have to do is copy/paste the display file and RPG code in this article, compile and call.

    On the off chance that you don’t know what Watson is, Watson is the IBM computer that, in 2011, competed

    …

    Read more
  • A Brief Introduction To The SQL Procedures Language

    September 27, 2016 Ted Holt

    The SQL Procedures Language, or SQL PL, is a proprietary procedural language that IBM designed to work with the DB2 family of database management systems. I believe that it’s a good idea for anyone who works with DB2 to learn SQL PL. If you know RPG, CL, or COBOL, you’ll find it easy to learn.

    SQL PL is available for all the DB2s. Knowledge of SQL PL that you acquire by working with DB2 for i applies in large part to the mainframe and LUW (Linux-Unix-Windows) versions. You can use SQL PL to create stored procedures, functions, and triggers. You

    …

    Read more
  • How To Replace MOVE And MOVEL With Subprocedures

    September 27, 2016 Ted Holt

    Note: The code accompanying this article is available for download here.

    Google “what shall we do about” and you’ll find a lot of issues that people are concerned about. Now that RPG has gone fully free-form, the question of concern for RPG programmers is “what shall we do about MOVE and MOVEL?” Faithful reader Mark sent me a solution he used in his shop and gave me permission to pass it along in case it may be of help to you.

    I can think of two ways to replace MOVE and MOVEL with free-form code. The first is to

    …

    Read more

Previous Articles Next Articles

Content archive

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

Recent Posts

  • POWERUp 2025 –Your Source For IBM i 7.6 Information
  • Maxava Consulting Services Does More Than HA/DR Project Management – A Lot More
  • Guru: Creating An SQL Stored Procedure That Returns A Result Set
  • As I See It: At Any Cost
  • IBM i PTF Guide, Volume 27, Number 19
  • IBM Unveils Manzan, A New Open Source Event Monitor For IBM i
  • Say Goodbye To Downtime: Update Your Database Without Taking Your Business Offline
  • i-Rays Brings Observability To IBM i Performance Problems
  • Another Non-TR “Technology Refresh” Happens With IBM i TR6
  • IBM i PTF Guide, Volume 27, Number 18

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