- August 26, 2008 - Local Global Variables - We've all heard of global and local variables. But when it's time to update the mainline Calcs of an existing application using clear, meaningful field names, having lengthy programs with lots of work fields can make it difficult. In this week's Tuesday Tip, Bob Cozzi demonstrates how to create your own set of global variables, regardless of their names, without worrying about name conflicts.
- August 19, 2008 - Skipping Input Fields During Debug - Debugging code is critical. But it can get pretty annoying when the debugger hits a CHAIN or READ opcode and moves up to the Input specs, requiring you to step through each input field before returning to the Calc specs. In this week's Tuesday Tip, Bob Cozzi shows how to avoid such a time-consuming process.
- August 12, 2008 - Boolean Operations in RPG IV - RPG indicators have virtually disappeared from new code. Still, you can assign the results of an express to an indicator field without using an IF statement. Bob Cozzi shows how in this week's Tuesday Tip.
- August 5, 2008 - Extend RPG with SQL - Programmers know we can perform database operations with SQL in RPG. We also can extend the RPG language using SQL's vast library of functions. Bob Cozzi demonstrates how in this week's Tuesday Tip.
- July 29, 2008 - Data Structures as Command Parameters - For years, RPG programmers have passed data structures as parameters. There's also an easy way to pass data structures from CL or Command Entry to RPG programs. Bob Cozzi demonstrates how in this week's Tuesday Tip.
- July 22, 2008 - Qualified Object Names--The CL CALL command can make it a challenge to pass a qualified name, such as a file name, as a parameter to RPG programs. There's an easier way. Command definition source lets you easily define and pass qualified objects, including file names, to your programs. Bob Cozzi demonstrates how in this week's Tuesday Tip.
- July 15, 2008 - Converting Non-Standard Date Formats - Users often have dates that are not in a standard format stored in database files or coming in from EDI or XML apps. A non-standard date format can cause a problem for RPG IV's built-in %DATE function. In this week's Tuesday Tip, Bob Cozzi shows how two date-oriented APIs help easily convert date values stored in virtually any format in non-date fields into standard date data types.
- July 8, 2008 - More Indicator-Free Code - Using RPG indicators is taboo, to say the least. In this week's Tuesday Tip, Bob Cozzi shows how to eliminate the use of RPG indicators when the RPG code is processing display files. Cozzi introduced this simple, yet elegant technique more than 20 years ago in his original Modern RPG Language book and has revised and updated the technique to include the contemporary INDDS and INFDS data structures.
- June 24, 2008 - Retrieve The Day Name - With this week's Tuesday Tip, it becomes much easier to retrieve the day of the week for any date, including "today." Bob Cozzi's GetDayName() subprocedure provides everything you need to determine the day of the week but without antiquated compiled-time arrays. All it takes is just two lines of code, and you'll know its "Tuesday!"
- June 17, 2008 - Parameter Arrays - Have you ever needed to pass a list of item numbers or dates or past-due customers to your RPG programs? In this week's Tuesday Tip, Bob Cozzi shows you how simple it is to define and process a parameter array or "Simple List" using a single command definition keyword and a subtle change to the way you define the parameter to RPG IV.
- June 10, 2008 - ILE Program Model - The Integrated Language Environment has powerful and important components for System i developers. If you aren't taking advantage of multiple modules, multiple service programs, or reusable subprocedures, you should start today. This week's Tuesday Tip from Bob Cozzi illustrates the ILE Program Model by comparing it to the traditional RPG III model and points out some important features that you don't want to miss.
- June 3, 2008 - Wrap Program Calls - Have you ever called a program, only to get that dreaded "Decimal Data Error" message for your numeric parameters? Not a problem. In this week's Tuesday Tip, Bob Cozzi illustrates how to write a few lines of code that eliminate this issue (well, mostly). Cozzi shows how to create a command wrapper for your program calls using just three lines of code.
- May 27, 2008 - A New CL Command: RTVSBSSTS - Even though IBM has enhanced CL in the last few releases of i5/OS, it seems that lately the company hasn't added many new CL commands. Bob Cozzi recently needed one in particular -- Retrieve Subsystem Status (RTVSBSSTS) -- to check whether the web server subsystem was running, and, if not, restart it. Unfortunately, IBM doesn't provide a RTVSBSSTS command. However, that didn't stop Cozzi. He wrote it himself with only a few lines of CL and a command definition, and you can check it out in this week's edition of Tuesday Tips.
- May 20, 2008 - Download RDi Trial Version - IBM announced this month at RPG World the availability of a free trial version of Rational Developer for System i (RDi). In this installment of Tuesday Tips, Bob Cozzi walks you through the process of downloading the RDi trial version from the IBM website onto your own PC.
- May 13, 2008 - Populate the Creation Source File Information in ILE, RPG IV - Remember the good old days when a *PGM object contained the names of the source file, library, and member used to create it? With ILE and RPG IV, the compilers no longer populate this information but instead store it in the *MODULE object within the *PGM. This breaks a lot of in-house tools that used DSPOBJD to determine whether source and objects were or are in sync. In this week’s Tuesday Tip, Bob Cozzi demonstrates how to populate the creation source file information in the *PGM object without screwing up the information already in the *MODULE within the program. You can download the source code.
- May 6, 2008 - Calculate Years, Months, Days Between Two Dates - If you have ever needed to calculate the amount of time that has elapsed between two dates in years, months, and days rather than in just years, months, or days, this week's Tuesday Tip is for you. Bob Cozzi walks you through a simple RPG IV date calculation sitting right under your nose.
- April 29, 2008 - Check for IFS Files - We all know how to check whether a file exists on i5/OS, but what about on the IFS? We all know how to retrieve the size of a file on i5/OS, but what about on the IFS? This week's Tuesday Tip from Bob Cozzi illustrates how to easily determine from within RPG IV whether a file exists on the IFS and how to retrieve its size.
- April 22, 2008 - More Debugger Tips - Due to viewer demand, we're revisiting the RPG IV Debugger. In this week's Tuesday Tip, Bob Cozzi reveals the Debugger's hidden capability that displays the content of all local variables (fields declared inside a subprocedure) with one command.
- April 15, 2008 - Avoid Subprocedure Name Collision - More and more people are using subprocedures, leading to name collision for some. In this week's Tuesday Tip, Bob Cozzi illustrates how to avoid such a crash.
- April 8, 2008 - Display RPG Field Values in RPG IV Debug - Often when you are debugging a program that has been ported to RPG IV, an old RPG III field gets in the way of the full-screen, source-level debugger. For example, if the field name is EVAL, QUAL, STEP, or any other debugger command name, you can't display the contents while in debug. Or can you? In this week's Tuesday Tip, Bob Cozzi illustrates how to display the contents of these variables regardless of their naming conflicts. In addition, he provides a review of basic debugger commands.
- April 1, 2008 - Fix Poorly Formatted Data - EDI, XML, SOA: Wherever it is your data is coming from, it is inevitably going to have some poorly formatted values. So how does one eliminate things like embedded blanks or rogue characters that separate an item number, social security number, or phone number? The answer is just two lines of RPG IV code, and Bob Cozzi covers it in this week's Tuesday Tip.
- March 25, 2008 - Subfield Arrays - Have you ever needed to sort a subfile by one of its columns or load up a set of records and sort by one of the fields in the file? Bob Cozzi has. In this week's Tuesday Tip he illustrates how to sort data using something he calls Subfield Arrays. This technique uses a loophole in data structures that lets you sort an array by its data structure subfield name. It's very easy, works great, and best of all, it's a supported part of the RPG IV language design.
- March 18, 2008 - Joblogs - Do you think of joblogs as the original blogs? Bob Cozzi does. In fact, he uses them extensively to both log and debug code long after it has been placed into production. In this week's Tuesday Tip he illustrates an alternative and highly effective way to write text to a joblog by including substitution values and eliminating the need to call those archaic i5/OS message APIs. Just type in <b>joblog('Hello world')</b>, and you're finished!
- March 11, 2008 - Embedded SQL - Ever since RPG III first got Embedded SQL, RPG programmers have either loved it or ignored it. A few, such as Bob Cozzi, used it as a sort of "break-glass-in-case-of-emergency" tool. This was largely due to the arcane syntax IBM implemented for Embedded SQL. Today, as of i5/OS V5R4, all bets are off. Embedded SQL has become a mainstream tool that you can use as easily as any free-format RPG operation. In this week's tip, check out what changes IBM has made and how you can start using them today to easily embed SQL in your RPG IV programs.
- March 4, 2008 - Running CL Command from within RPG - Easily -- In this week's tip, Bob Cozzi thinks back some 25 years ago to 1983 when he developed a technique for running CL commands within RPG IV. A 25-year-old idea may trigger nostalgia, but it probably doesn’t seem very compelling. However, Cozzi demonstrates how to modernize the process of running CL commands by using a Prototyped version of QCMDEXC and then going one step further and eliminating all the work fields and length computations by using a contemporary CL command processor right from within good old RPG IV. Thus, an old trick becomes a nifty new one.
- February 26, 2008 - Creating ZIP Files on System i – If you've ever had to create a CSV, Excel, PDF, or other set of data on the IFS and then e-mail it to an end-user, you'll appreciate the fact that System i comes with a tool that creates compressed ZIP files from IFS or Database files. In this week's tip, Bob Cozzi illustrates just how easy it is to use this hidden treasure and shows you how to create ZIP files from IFS files or Source File Members.
- February 19, 2008 - Creating CSV Files for MS Excel - How many times have you been asked to put data into Excel format? Bob Cozzi's Tuesday Tip illustrates three different tools you can use to create CSV files -- the basic form of Excel-compatible data. One comes with i5/OS, one uses Help/Systems' SEQUEL SQL tool, and one uses RPG xTools.
- February 12, 2008 - Convert between Hex and Character - With so much Web, XML, CGI, and SOA stuff going on, the need to convert between hexadecimal and regular characters is increasing. Bob Cozzi's Tuesday Tip shows you exactly what hexadecimal is and how to convert between character data and hexadecimal -- simply, easily, and quickly - using good old RPG IV with a bit of prototyped MI statements added in for fun.
- February 5, 2008 - Packed, Zoned, and Integer Oh My! - There are so many different numeric data types to use today that choosing the right type is often left to habit instead of performance reasons. Bob Cozzi's Tuesday Tip is a numeric data-type primer that every RPG IV programmer needs to know before writing another line of code. For example, did you know that the "B" data type is replaced by the "I" data type? And that Packed(7,0) fields are faster than Zoned(7,0)? You will after watching this week's episode.
- January 29, 2008 – RPG IV at i5/OS V6 – Bob Cozzi has preempted his regular broadcast to bring you this special report: RPG IV at i5/OS Version 6. IBM introduced today a set of enhancements to the RPG IV language and the System i development environment. These new features include local files in subprocedures, full multi-threaded support, and much, much larger variable lengths. In addition, IBM is launching RDi, a new edit/compile/debug platform for RPG and System i. This new package provides everything that the SEU/PDM/SDA combination does from green screen, but provides it in a Graphical IDE.
- January 22, 2008 – Calculate the Day of the Week Revisited – A number of viewers wanted more, so Bob Cozzi is giving you more. This week's Tuesday Tip continues where the "Get Day of Week" tip left off--it provides an RPG IV subprocedure wrapper for the CEEDYWK API that allows you to call "GetDayWeek(myDateField)" without worrying about the idiosyncrasies of the API. Its just like having a native RPG IV built-in function that calculates the day of week.
- January 15, 2008 – Using Member Names in SQL – It always bothered Bob Cozzi to have to perform an OVRDBF command prior to running his RPG IV program that use embedded SQL just to get to a specific member name. Well no more. This week's tip illustrates how to directly access specific member names using nothing but SQL syntax. It's about time!
- January 8, 2008 – Calculate the Day of the Week – Putting to bed, once and for all, this long sought after technique, Bob Cozzi illustrates how to use an internal API cleanly in RPG to help you determine the day of the week from any valid date and without any limitations as to the supported range of dates. Great for those 100 year old patients or determining historical milestones; not to mention day-to-day business needs.
- December 18, 2007 - Convert to Numeric (from Character) - Converting to numeric from character is one of the most frequently asked questions I received from RPG IV programmers. From EDI to Web programming to heterogeneous database conversions, the need to convert numeric data stored in character fields to packed decimal or integer is becoming pervasive. This week Bob Cozzi illustrates how to correctly convert data stored in character fields into packed decimal and integer with only one simple instruction.
- December 11, 2007 - Convert To Character (from Numeric) - Converting character format to from numeric hasn't been easy in RPG IV's expression syntax. Until recently, calling C runtime functions or using elaborate subroutines was the only way to perform such a conversion in /FREE. This week Bob Cozzi illustrates how easy it is to convert from numeric to character using simple built-in functions. Actually, two techniques are presented, one that does a "grunt" conversion producing clean results, and the other that emulates the old MOVE opcode when moving to a zoned decimal field.
- December 4, 2007 - Retrieve Job Date Using %DATE - The %DATE built-in function is very powerful but did you know it can be used for more than just converting non-date fields into real Date data-types? This week's Tuesday Tip illustrates how to use it to retrieve the current job date and system date.
- November 27, 2007 - Scan and Ignore Case - Scanning in RPG has never been a strong point. But scanning using the case-sensitive %SCAN or the SCAN opcode can be frustrating. This week's Tuesday Tip illustrates how to easily add a "Scan and Ignore Case" option to the %SCAN built-in function.
- November 13, 2007 - Convert Between upper/lower Case - For decades RPG coders have come up with creative ways to convert between upper and lower case letters. This week's Tuesday Tip illustrates one of the easiest ways, and it only requires one line of code!
- November 6, 2007 - Qualified Database File Fields - Using two database files in the same program can cause field name collision. This week's Tuesday Tip illustrates how to avoid these problems by creating what's called a Qualified Database File.