How can we help you?

We have hundreds of highly-qualified, experienced experts working in 70+ technologies.

IBM i e-Book

A Developer’s Guide to Mastering IBM i Concepts

Control Language (CL)

Operations and Functions

Built In Functions

Introduction:

Built-in function is a function that is already available in a programming language, application, or another tool that can be accessed by end users. The term “built-in” refers to the fact that these functions are part of the core functionality of the language. A variety of different office suites, business applications, and programming languages offer built-in functions to simplify the user experience. The following is a list of built-in functions that can be utilized in CL:

  • %ADDRESS
    Syntax ->

    %ADDRESS(variable name) / %ADDR(variable name)
  • %BINARY
    Syntax ->

    %BINARY(character-variable-name starting-position length)
  • %CHECK
    Syntax ->

    %CHECK(comparator-string base-string [starting-position])
  • %CHECKR
    Syntax ->

    %CHECKR(comparator-string base-string [starting-position])
  • %OFFSET
    Syntax ->

    %OFFSET(variable name)/ %OFS(variable name)
  • %SCAN
    Syntax ->

    %SCAN(search-argument source-string [starting-position])
  • %SUBSTRING
    Syntax ->

    %SUBSTRING(character-variable-name starting-position length)/
    %SST(character-variable-name starting-position length)
  • %SWITCH
    Syntax ->

    %SWITCH(8-character-mask)
  • %TRIM
    Syntax ->

    %TRIM(character-variable-name [characters-to-trim])
  • %TRIML
    Syntax ->

    %TRIML(character-variable-name [characters-to-trim])
  • %TRIMR
    Syntax ->

    %TRIMR(character-variable-name [characters-to-trim])
  • %CHAR
    Syntax ->

    %CHAR(convert-argument)
  • %DEC
    Syntax ->

    %DEC(convert-argument [total-digits decimal-places])
  • %INT
    Syntax ->

    %INT(convert-argument)
  • %LEN
    Syntax ->

    %LEN(variable-argument)
  • %LOWER
    Syntax ->

    %LOWER(input-string [CCSID])
  • %UPPER
    Syntax ->

     %UPPER(input-string [CCSID])
  • %PARMS
    Syntax ->

    %PARMS()
  • %SIZE
    Syntax ->

    %SIZE(variable-argument)
  • %UINT
    Syntax ->

    %UINT(convert-argument) / %UNS(convert-argument)

Operators In CL

Introduction:

It is a symbol that usually represents an action or process. These symbols were adapted from mathematics and logic. An operator can manipulate a certain value or operand. For example, in 2 + 3, the 2 and 3 are the operands and + symbol is operator. Below is the list of common operators that can be utilized in CL:

Predefined value Predefined symbol Meaning Type
+ Addition Arithmetic operator
Subtraction Arithmetic operator
* Multiplication Arithmetic operator
/ Division Arithmetic operator
*CAT || Concatenation Character string operator
*BCAT |> Blank insertion with concatenation Character string operator
*TCAT |< Blank truncation with concatenation Character string operator
*AND & AND Logical operator
*OR | OR Logical operator
*NOT ¬ NOT Logical operator
*EQ = Equal Relational operator
*GT > Greater than Relational operator
*LT < Less than Relational operator
*GE >= Greater than or equal Relational operator
*LE <= Less than or equal Relational operator
*NE ¬= Not equal Relational operator
*NG ¬> Not greater than Relational operator
*NL ¬< Not less than Relational operator

How can we help you?

We have hundreds of highly-qualified, experienced experts working in 70+ technologies.

X

Awards and Certifications

company-logo
company-logo
company-logo
company-logo
company-logo
company-logo
company-logo
company-logo
company-logo
company-logo