Difference between revisions of "Category:CLP"

From MidrangeWiki
Jump to: navigation, search
Line 62: Line 62:
  
 
{| class="wikitable" border="1"  
 
{| class="wikitable" border="1"  
! Function !! Use |-
+
! Function !! Use
| align="center"| %BINARY or %BIN || Convert signed decimal data to or from binary character format.|-
+
|-
| align="center"| %SUBSTRING or %SST || Extract or set a subset of another character string.|-
+
| align="center"| %BINARY or %BIN || Convert signed decimal data to or from binary character format.
| align="center"| %SWITCH || Evaluate one or more of the eight job switches and return a Boolean result.|}
+
|-
 +
| align="center"| %SUBSTRING or %SST || Extract or set a subset of another character string.
 +
|-
 +
| align="center"| %SWITCH || Evaluate one or more of the eight job switches and return a Boolean result.
 +
|}
  
 
== Pointer use ==
 
== Pointer use ==

Revision as of 16:38, 5 April 2016

CLP is an acronym for Control Language Program.

Much of what we find in CLP programs are IBM Commands. [1] Also see CLP Coding Rules and Category:Commands.

As with many other languages, there are multiple versions in popular usage, such as CLP/400 and ILE-CLP.

In some realities, this is comparable to software that is the "glue" connecting higher level language programs like RPG; data base files and their over-rides; screen and print "files" and their over-rides; and other objects with Menus ... typically when we take a menu option, we are launching a CLP program.

CLP Unique Commands

Some 400 commands can ONLY be executed from within a CLP program, not from Command Line. In other programming languages, these might be called OP CODES.

Special characters

Some characters have special meaning in CL:

Symbol Meaning
|| *CAT
|> *BCAT
|< *TCAT
= *EQ
> *GT
< *LT
>= *GE
<= *LE
¬= *NE
¬> *NG
¬< *NL
& *AND
| *OR
¬ *NOT

Ref: CL Programming, Expressions in CL commands

ILE/CL Built-in Functions

Like RPG, ILE/CL also supports many built-in functions. These would typically be used in CHGVAR and/or IF statements to manipulate variable data before its subsequent use. Initially, ILE/CL offered the following built-in functions.

Function Use
 %BINARY or %BIN Convert signed decimal data to or from binary character format.
 %SUBSTRING or %SST Extract or set a subset of another character string.
 %SWITCH Evaluate one or more of the eight job switches and return a Boolean result.

Pointer use

As of V5R4, CL allows the use of pointers. There were some problems with uninitialised pointers, and PTFs were issued. As of 15 Feb 2008, 5722-SS1:

  • SI28620
  • SI28196
  • SI27953

These are immediate PTFs, but you will need to re-compile any CL programs using pointers in order to get the issues fixed.

One can't compare a pointer to *NULL, but a clever idea is to create an unused pointer (which will be set to *NULL if the above PTFs are applied) and compare to that. Here is a snippet from Tom L. for a CL program that performs getenv from a thread on RPG400-L.

dcl &pNull *ptr  /* Auto-initialized to *null */
if ( &pEnvVar *eq &pNull )  do

Note: As of V6R1 of the operating system, complete *NULL support was added to ILE CL encompassing the DCL, IF, and CHGVAR statements.

Categories

Subcategories

This category has only the following subcategory.

C