Skip to content

CLLE Language tools

Command Language is the scripting language for the IBM i operating system. This extension assists in CLP or CLLE program development, providing:

  • Content assist for CL commands and parameters
  • Outline view
  • Go to or peek definition and references
  • Rename variables
  • Hover support for CL commands and parameters
  • Syntax checking

It also provides support for running a CL statement with Ctrl+r.

Installation

The CL Language tools extension can be installed from the Marketplace and is also part of the IBM i Development Pack .

Or it can be installed from the Extension view inside Visual Code.

Install CLLE

Content Assist

Suppose you want to create a data area with the CRTDTAARA command. Enter CRTDTAARA follwed by a space, then press Ctrl+Space to invoke Content Assist to produce a pick list like this:

Example step 2

Press Enter or Tab to accept the highlighted All parameters from the pick list and a skeleton command is created.

Example step 3

UseCtrl+space to get a pick list of special values or available variables (just one in this example):

Example step 5

Content Assist Snippets

Prompting of most CL commands requires a connection to a server. However, there are a number of commands that are provided as snippets, which don’t require a connection. DCL, for example, is provided as a snippet.

To declare a variable, enter just d and get a list of commands that begin with d:

Command assist

Since the DCL command is highlighted, hit enter and get a pick list of available parameters:

Command assist all keywords

The VAR parameter value is selected, so enter the variable name, then tab to the TYPE parameter value:

Command assist parameter

If all the valid valued for TYPE are know, just enter a valid value, for example *CHAR. Or delete the highlighted value and key Ctrl+Space to get a pick list of the valid values:

Command assist parameter

If all the valid valued for TYPE are know, just enter a valid value, for example *CHAR. Or delete the highlighted value and key Ctrl+Space to get a pick list of the valid values:

Command assist parameter

Outline View

In the Outline view, you can get an overview of all declared variables, files, and subroutines. You can click on the name of any item to jump to the definition.

Outline view

Peek Definition and References

In the editor, you can right-click on a variable or subroutine and use Go to Definition or Go to References to quickly jump to the definition or all references of the variable or subroutine.

Go to References

You can also use Find All References which will pop open the References view to show all references.

Find All References

Lastly, you can use any of the options under the right-click Peak submenu to get an inline preview of definitions or references without having to leave the current line are working on.

Peak Definition

Rename

You can right-click a variable and select Rename Symbol (or use the F2 shortcut) to rename the variable. This will pop open a mini text box for you to enter the new variable name. Once you have entered the new name, hit Enter to proceed with renaming all instances of that variable or hit Ctrl+Enter to get a refactoring preview which you can use to selectively rename specific instances.

Rename

Hover Support

When writing your CL programs, you can hover over a command to view a description of the commad from its documentation.

Command Hover

This works on individual parameters and is espically useful when determining what are the allowed values for a parameter. Content assist for paramters will also include this same documentation.

Paramter Hover

To view the full documentation for a command, scroll to the bottom of the hover window and select the View Full Documentation link. This will pop open a panel right in VS Code with the full documentation for the command which includes details on the command, parameter usage, examples, and error messages.

Full Documentation

Syntax Checker

As you write your CL programs, the syntax checker will highlight any syntax errors in your code. You can error or navigate to the Problems view to see the full details along with errors across all files.

Syntax Checker

CL Code Runner

A CL command may be executed by highlighting the command and pressing Ctrl+R.

Code Runner Example

The two lines of the CRTMSGF command are highlighted:

Run CL example 1

Press Ctrl+R and success is reported:

Run CL example 1

Click Open output if you want more detail or if the command fails:

Run CL example 1

Not all CL commands may be executed.