Midrange News for the IBM i Community


Posted by: Bob Cozzi
Rogue Programmer
Cozzi Productions, Inc.
Chicagoland
New CL Commands
has no ratings.
Published: 21 Aug 2012
Revised: 23 Jan 2013 - 1580 days ago
Last viewed on: 21 May 2017 (2914 views) 

Using IBM i? Need to create Excel, CSV, HTML, JSON, PDF, SPOOL reports? Learn more about the fastest and least expensive tool for the job: SQL iQuery.

New CL Commands Published by: Bob Cozzi on 21 Aug 2012 view comments(4)

I'm doing a series of Articles for IT Jungle, some of it will focus around uses for COZTOOLS.

UPDATE: Okay we've officially shipped the 3 new CL commands today:

  1. CLSCAN - Scan a CL variable and get the return position back.
  2. CLCASE - Convert a CL variable's text to upper or lower case.
  3. CLEDIT  - Edit a numeric CL variable and return it as text.

The CL Scanner and Convert Case commands are finished and work fine. They'll probably become part of COZTOOLS free runtime in the next minor release.

I'm wondering what other CL programming-related commands would be beneficial to us. I know IBM added a lot to the CL language that was largely panned by the programmers.

But I enjoy two features, *INT data types and DEFINED (data structure) variables. And while I have had occasion to use the DOFOR and DOWHILE commands, I could've lived without them--but they are helpful, especially now that everyone is at least running v5.4.

So I have the SCAN and CASE commands, are there any other core CL functions that are still missing? Something I could implement and include with these other two?

 

Return to midrangenews.com home page.
Sort Ascend | Descend

COMMENTS

(Sign in to Post a Comment)
Posted by: neilrh
Premium member *
Jackson, MI
Comment on: New CL Commands
Posted: 4 years 9 months 21 hours 33 minutes ago

Well DOFOR and DOWHILE are just handy ways of controlling code flow and branching in something that makes the code structure obvious. Nothing that we couldn't have done using GOTO's and IF's before. Heck I still see RPG code that uses GOTO's and IF's rather than DOW, DOU, FOR, etc.

As for the actual reason for this thread, can't think of any commands off the top of my head, I just don't write much CL code in business applications these days. The only commands I do write are those that sit on the front of some program I call frequently, and just can't be bothered to figure out what the parameter values should be every month that I need to call it. They also allow me to define the parameter defaults. Things like calculate retail prices, with parameter markup, having default value 20. It's easier than typing CALL PGM(CALCRTLP) PARM(x'00020F').

Posted by: bobcozzi
Site Admin ****
Chicagoland
Comment on: New CL Commands
Posted: 4 years 9 months 18 hours 47 minutes ago

Yep. I"m in that same boat with you Neil. Just know that we need CLScan and CLCase but couldn't think of any others.

Posted by: neilrh
Premium member *
Jackson, MI
Comment on: New CL Commands
Posted: 4 years 9 months 3 hours 35 minutes ago

I guess fronting the API's that should be commands - the User Space stuff, and probably others. Though personally I've always been happier using the API calls, since they're easier to use from an RPG. But there should be a CRTUSRSPC command.

Posted by: bobcozzi
Site Admin ****
Chicagoland
Comment on: New CL Commands
Posted: 4 years 9 months 1 hours 51 minutes ago

Sure User Space stuff--that's easy. But like the CLSCAN and CLCASE command, I was thinking more in lines with what core programming features are missing from CL?

Certainly we can do a SCAN using QCLSCAN but its parse are goofy and requires knowing the parm list to use it, where as the CLSCAN command is simple. CLCASE is just as simple to use, although it has been rare when needing to convert to upper/lower case in CL, Bruce Hoffman needed it for a user profile that was being received into a CL so I built it, and it is pretty cool for what it is.

You look at the hudreds of RPG built-in functions and think... %SCANRPL is cool (but it isn't available until v7.1).   Perhaps a Numeric to Character conversion that actually works well, rather than converting the number 7 to 00007 when you convert it to character in CL.

CLDec2Char VAR(&TEXT) VALUE(&MYPKD)

But have it work similar to %Char() does.

-Bob