The Leading Educational Resource for IT Professionals

SQL 101: Tools of the Trade - i Navigator’s Run SQL Scripts

0 Comments

A more “modern” alternative to STRSQL, discussed in the last two articles, is the i Navigator’s Run SQL Scripts tool. Let’s explore it together, shall we?

rafael victoria preiraWritten by Rafael Victória-Pereira

While STRSQL is a green-screen tool, Run SQL Scripts is part of the i Navigator package. You can access it by choosing the Run SQL Scripts option, either from the bottom-right pane of the i Navigator window after you’ve chosen the Databases tree node from the right panel, as shown in Figure 1, or by right-clicking the database name and choosing the respective option.

Continue Reading →

TechTip: C# for RPGers - Introducing Lists

0 Comments

Lists are a special type of “thing” in C#; they have no parallel in RPG. This is most unfortunate, because lists are awesome!

rafael victoria preiraWritten by Rafael Victória-Pereira

The last couple of TechTips introduced Arrays and explained the foreach loop. This kind of sets the stage for the List data type. You can think of a List as an Array with all the bells and whistles and none of its limitations. For instance, when you define an Array, you have to define its size. That value is (more or less) definitive, because the memory will be statically allocated to store the variable. Lists, however, are dynamically allocated, which means that you don’t have to specify the size of the List. Actually, you can’t specify it. Instead, you’re able to specify the initial capacity, but even that is optional.

Continue Reading →


RPG Academy: Write Better Code - Commenting and Documenting Strategies

0 Comments

Usually, programmers don’t comment their code appropriately, for a variety of reasons: “I don’t have the time,” “My code speaks for itself,” etc. Mostly, they simply hate doing it. Let me try to refute these excuses with practical strategies and tools.

rafael victoria preiraWritten by Rafael Victória-Pereira

As I’ve said throughout this series, a procedure’s name and parameter list should be enough for the programmer to understand the objective of that piece of code. However, there are times when this is not enough: complex procedures, generic names, uninspired input/output parameter names…and the list goes on and on. The next section of this TechTip will help you in the process of creating proper documentation for your newly created procedures and functions, with a few tips of what you should and shouldn’t do.

Continue Reading →

SQL 101: Tools of the Trade – Old, Reliable STRSQL, Part 2

0 Comments

Ready for more tips on STRSQL? Even if you’re familiar with this old and venerable tool, this article might show you something new.

rafael victoria preiraWritten by Rafael Victória-Pereira

The previous article started to discuss STRSQL and stopped short of explaining a very important set of features. So I’ll just pick up where I left off: I’m going to explain what Option 1 of the Interactive SQL Session Services screen, reachable by pressing F13 on the main screen, can be used for. This option brings up the Session Attributes screen, depicted in Figure 1.

Continue Reading →


TechTip: C# for RPGers - More on Arrays and a Different FOR Loop

0 Comments

Let’s continue to explore C# arrays and introduce a different FOR loop. It’s a very useful tool that has no equivalent in RPG.

rafael victoria preiraWritten by Rafael Victória-Pereira

In the last TechTip in this C# series, I introduced the array data type and showed how it’s defined and used. Now let’s explore some of its properties and methods, with the help of a different FOR loop: ForEach.

Continue Reading →

RPG Academy: Write Better Code - More Tips for Organizing Your Modules and Service Programs

0 Comments

The previous article of the series discussed module and service program organization. It’s now time to do the same for binding directories.

rafael victoria preiraWritten by Rafael Victória-Pereira

Let’s start with a quick recap of binding directories. Your modules will be composed of procedures. Some of these procedures are going to be available to the outside world; these are the module’s exports. The module’s procedures might call procedures from other service programs; these are the module’s imports. The problem is that the compiler has no idea where to find those procedures that your module’s code is calling, if they don’t belong to the same module/service program.

Continue Reading →


SQL 101: Date-Related Functions, Part 3 - Extracting Information from Dates

0 Comments

This article continues the date-related functions discussion, introducing a few more simple but extremely useful SQL functions: DAYOFWEEK, WEEK, QUARTER, DAYOFYEAR, and MIDNIGHT_SECONDS. Do you have time for some date fun?

rafael victoria preiraWritten by Rafael Victória-Pereira

Let me start with a quick flashback: an RPG Academy TechTip published in October 2015, explaining how to create an RPG function to calculate the day of the week of a given date stirred things up quite a bit. Some readers complained this kind of function was totally unnecessary, because SQL is better equipped to do this type of thing and so on. My reply was that I’d get to a point in the SQL 101 series in which I’d cover the “SQL version” of that particular function, named Clc_DayOfWeek.

Continue Reading →

SQL 101: String-Related Functions, Part 5—Cutting and Stitching Strings

0 Comments

Stringscaping continues! This article explores functions to extract parts of a string that are similar to MS Excel functions and ways to stitch the strings back together. This “stitching” will introduce another function: LENGTH.

 

rafael victoria preiraWritten by Rafael Victória-Pereira

 

The functions discussed in the previous article allow you to add, replace, and remove characters from a string. While this is interesting and somewhat useful, being able to “stitch” two strings together is usually more useful. This article covers a group of functions that helps with that task.

Continue Reading →