MC Press Online

Wednesday, Jan 18th

Last updateTue, 17 Jan 2017 5pm

Programming / CL

Practical CL: System Reply Lists

There are times when you can't code around a system message, but at least with this technique you don't have to sit around and wait for it.

joe plutaWritten by Joe Pluta

Can't or won't?

           

OK, chances are that if you try hard enough you can manage to code around nearly any system message. But there are times when the amount of work required simply isn't practical. I'll give you a real-world example that I've run across on many occasions over the years and show you a relatively easy way to get around the problem, as well as an additional trick that can help in some stricter environments.

Read more ...

Practical CL: MONMSG and Beyond

MONMSG is a powerful tool, but sometimes even MONMSG needs a little extra help, and here's an example.

joe plutaWritten by Joe Pluta

One of the great features of the System/38 was the Control Program Facility, or CPF. And one of the coolest things about CPF was the fact that any command you could enter from the command line could also be compiled in a program. This is different from interactively reading a script file, which is nice in its own way but isn't exactly the same thing. Scripts need more attention, especially in error handling; typically, an error causes some kind of alert to pop up on an operator's console, and then they have to decide how to deal with it. Compiled CL, on the other hand, not only understood errors but provided a very powerful tool to handle them, the MONMSG command.

Read more ...

Sending Messages on IBM i, Part 2

Part 1 investigated message queues and types of messages. Now we'll look at the CL commands that send messages.

Written by Jim Buck, Bryan Meyers, and Dan Riehl

Editor's note: This article is an excerpt from Chapter 16, "Advanced Message Handling," of Control Language Programming for IBM i. See Part 1 here.

 

Four major CL commands are used to send messages:

  • SNDMSG (Send Message)
  • SNDBRKMSG (Send Break Message)
  • SNDPGMMSG (Send Program Message)
  • SNDUSRMSG (Send User Message)

Read more ...

Sending Messages on IBM i, Part 1

Messages serve many purposes: to provide information, to ask a question and request a reply, and to solicit some action on the recipient's part.

Written by Jim Buck, Bryan Meyers, and Dan Riehl

Editor's note: This article is an excerpt from Chapter 16, "Advanced Message Handling," of Control Language Programming for IBM i.

 

Understanding how messages work is an important part of writing good CL programs. In fact, without at least a basic understanding of messages, your CL programs will be error-prone and, in many cases, unreliable.

 

IBM i is driven by messages. Messages are used for a multitude of different purposes, including initiating jobs, executing commands, communicating between programs, signaling error conditions, letting users communicate with each other, and letting jobs communicate with users.

Read more ...

ILE Is for CL Too

Over the past 20 years, ILE for RPG has gone from being something new and startling to being almost legacy. Lots of us are now using RPG ILE concepts on a regular basis. But what about CL? Can it be ILE too?

david shireyWritten by David Shirey  

Everyone knows about ILE for RPG.

 

Or at least everyone knows how to spell it, and a lot of people have adopted ILE practices as part of their regular routine. But I don't think the same can be said for CL. While most of us are now doing our programs in QRPGLESRC versus QRPGSRC, how many of those same people are still using QCLSRC for their Command Language source? My guess is quite a few.

Read more ...

The CL Corner: More on View Flexibility

Let's review of some of the SQL functions available.

bruce viningWritten by Bruce Vining

In the February 2015 CL Corner, A More Flexible Interface to the RUNSQL CL Command, we saw how to create a command of our own, CRTSQLVIEW, to create views by utilizing some of the built-in functions provided by the SQL language. The CRTSQLVIEW command removed the need for us to write a custom program per view (which was covered in the January 2015 article Enhancing WRKQRY Reports the Easy Way. These previous articles used the SQL built-in functions of VarChar and DayName to return the mixed-case name of the day for a date field. This month, using CRTSQLVIEW, we'll be looking at additional built-ins that are available to you.

Read more ...

The CL Corner: A More Flexible Interface to the RUNSQL CL Command

In this article, we'll building the SQL request dynamically.

bruce viningWritten by Bruce Vining

In the January 2015 CL Corner, Enhancing WRKQRY Reports the Easy Way, we saw how to create an SQL view for use by WRKQRY using the Run SQL (RUNSQL) CL command. I received quite a few notes asking, among other things, for an example of how to build the RUNSQL SQL parameter using variables rather than the static approach taken in the previous article. So today we'll look at what's required to build the SQL parameter using variables/parameters. For demonstration purposes, we'll continue to use the PROJECTS file that was introduced in the previous article.

Read more ...

The CL Corner: Enhancing WRKQRY Reports the Easy Way

Let's look more uses of the RUNSQL CL command.

bruce viningWritten by Bruce Vining

I recently received a note asking if there was a way to add the day of week to query reports generated by the IBM Query for i (5770-QU1) product. That is, take a current report containing dates as shown below:

Read more ...