Control Language
Control Language
Control Language, or CL as it is widely known, is the interface to the operating system on the AS/400. Each statement in this language is called a command. CL commands can be executed online or in batch or can be compiled into programs which are then called.
The advantage of this system is you only need to learn one language to communicate with the AS/400.
Interactive Command Entry
CL commands can be entered at the workstation via the command entry display. In practice you never need to worry about the syntax because of the extensive prompting provided by OS/400. If you know the name of a command, simply enter it and press F4. The system prompts for all the necessary parameters and shows the defaults that will be used. If you don't know the command name, simply press F4 on an empty command line and you will enter a series of menus to guide you to the command you want.
Command Syntax
All commands on the AS/400 follow the same basic rules, a three character verb followed by up to seven further characters which define the noun or subject part of the command. The verb part of the command defines the action to be taken for example, DSP (display), WRK (work with) and RMV (remove). The noun or subject part of the command is very often the name of an object or part of an object, for example, OBJ (object), LIB (library) or PGM (program).
Each command can be up to 10 characters in length and is generally built up by removing the vowels and using the three main consonants as an abbreviation.
An example of a command to display the security authority of an object would be:
DSPOBJAUT - DiSPlay OBJect AUThority
1 ctl01
There are approximately 750 commands available on the AS/400 but because of this consistent manner of naming you will soon be able to guess the command you require.
The 9 most common verbs are abbreviations which can easily be understood:
•CRT Create
•DLT Delete
•ADD Add
•RMV Remove
•DSP Display
•CHG Change
•WRK Work with
•STR Start
•END End
Most of these verbs can be applied to all the types of object on the AS/400. For example:
•CRTLIB Create a library
•DSPPGM Display a program
•WRKOUTQ Work with an output queue
•DLTUSRPRF Delete a user profile
Sometimes a part of an object is referred to:
•ADDPFM Add physical file member
Sometimes a word is used a great deal in CL, so it is abbreviated to just its first letter: 'P' for Physical, 'F' for File. For example:
•DLTF Delete file
•RMVM Remove a member from a database file
The subject part may not refer to an object but to a utility. For example:
•STRSDA Start Screen Design Aid
•ENDDBG End Debug
Command Parameters
When you use a command, for example to delete an object, you need to tell the system which object you are referring to. The object name would be catered for within the command by a parameter. Nearly all the commands on the AS/400 have parameters. Some have as many as 50. The command to create a library - CRTLIB - has the library name as one of its parameters. For example:
CRTLIB MYLIB
Optional and Required Parameters
Some of the commands cannot be used without a parameter being supplied and others provide defaults to be used if the user does not supply one. Some commands insist that certain parameters are provided and other parameters are optional. The CRTLIB command is of this category where the name of the library is required but the other parameters can be left to default.
Positional Parameters
The parameters can be entered following the command, separated by one or more spaces, in the order in which they are defined for the command. For example:
CRTLIB MYLIB *PROD
For a command with only a couple of parameters this is satisfactory but for one with a large number the chance of making a mistake is high.
Keywords
To distinguish one parameter from another, keywords are used. The parameter is placed in parentheses immediately following the keyword. With a keyword specified there is no need to present the parameters in a particular order. The keywords are consistent: any command using a library name as a parameter would use LIB. For example:
CRTLIB LIB(MYLIB) TYPE(PROD)
Once you have started using keywords for parameters you must continue. For example:
CRTLIB LIB(MYLIB) *PROD
is invalid.
Positionally and with Keywords
It is possible to combine the use of parameters expressed with and without keywords but those without keywords must come first. Once a keyword has been used, all the following parameters must have keywords.
Positional limit
Each command has a limit to the number of parameters which can be expressed without keywords. This varies from zero to all available parameters.
Parameter Types
Each parameter has a type and the system checks that the value supplied is of the correct type before obeying the command. CRTLIB LIB(3) for instance has no meaning - a valid name is required for the library and numeric data is not a valid name.
Special Values
Some of the parameters can have special values - ones which do not match the parameter type but which represent a particular value. For example, a size parameter, type numeric, could have a special value of *NOMAX meaning no maximum size. The system would substitute a physical limit here like the biggest possible numeric value.
Prompts
It is not practicable to remember every parameter of every command or even every command. The system provides a lot of help both in entering commands and supplying prompts for parameter values.
Defaults
All but required parameters and those whose value depends upon the value placed in a prior parameter have defaults to assume if you enter nothing. These defaults are, almost without exception, sensible and what you would probably choose anyway.
F4
When entering a command you may simply enter the command name and press F4. This invokes a prompt display which will invite you to fill out the details of the parameters. If the command has no parameters, for example, CHGPWD (CHanGe PassWorD), a message will be displayed inviting you to execute the command by pressing Enter.
Pressing F4 whilst the cursor is in a parameter field will result in you being shown a list of acceptable values for that parameter. Alternatively you could enter a ?.
Pressing F4 on an empty command line will result in a menu being presented to help you find the command you want. From this menu you can search for commands by name, verb, subject or topic. Depending on the option you select you will be presented with a list of commands or another menu.
Layered Prompting
The value entered for one parameter may mean that further parameters are required for the command to be valid. You will not be prompted for these dependent parameters until you press Enter. This could mean you end up pressing Enter a number of times before the command is executed. You can turn off layered prompting by pressing F9. This will display all the command parameters.
Additional Parameters
Not all parameters for a command are displayed when you press F4, only the required or most common parameters. To display all the possible parameters for a command press F10 to invoke the additional parameters facility.
Menus
A menu is an object or group of objects which is accessed via the GO command. A screen is presented to the user with a list of options available and an input field to enter a required option.
MAIN AS/400 Main Menu
System: PACIFIC3
Select one of the following:
1. User tasks
2. Office tasks
3. General system tasks
4. Files, libraries, and folders
5. Programming
6. Communications
7. Define or change the system
8. Problem handling
9. Display a menu
90. Sign off
Selection or command
===> <MU>
F3=Exit F4=Prompt F9=Retrieve F12=Cancel F13=User support
F23=Set initial menu
(C) COPYRIGHT IBM CORP. 1980, 1989.
2 main
A command entry line is available where valid commands may be typed in as well as options selected. A function key (F9) will retrieve the last command entered. If an option is entered and the Help key pressed, specialised help is presented.
It is relatively simple to create site specific menus if necessary. This can be achieved via the Screen Design Aid (SDA) utility.
GO command
If there is a particular menu that you wish to display and you know the name of it then you can use the command
GO menuname
to go directly to it. The menu name can be found at the top left corner of the screen.
The main menu is called MAIN. One useful menu (which displays when F4 is pressed and nothing is on the command line) is MAJOR. This contains a list of the major command groups.
If you cannot remember the menu name there are several menus with names in the format 'CMDxxx'. The 'xxx' part of the name is the same as the verb part of a command. For example:
GO CMDSTR
This will display all commands beginning 'STR...' (STaRt).
GO CMDCFG
This example will display all commands related to ConFiGuration.
Help
Pressing the Help key with the cursor in the field on the display provided for a parameter value will result in the system presenting help screens explaining what each possible value does. This context sensitive help is often at a similar level to the explanation for the parameter value in the manual.
Pressing Help on a command entry line will display a help screen about the command entry display. From here you can search for help on a particular topic by pressing F11 and invoking the search index facility. What appears to be a command entry line will be displayed at the bottom of the screen for you to enter the subject or command on which you require help. The system will display a list of topics that met your search criteria for you to view or print.
There are several other facilities for helping to resolve your problems and to find out more about the system.
Question and Answer Database
The system is supplied with a database of the most commonly asked questions, with their related answers. You can search this database using various search criteria related to your own question and if it has been asked before, and is on the database with an answer you can refer to this. If however it is a new question then this question can be automatically referred to your Help Desk, your Agent, or to IBM, electronically. This facility can be used either for technical questions or you can develop this for your own applications.
Online Education
One component of the operating system OS/400 supplied by IBM is the Tutorial System Support (TSS). This is a broad selection of AS/400 topics presented in tutorial fashion and available on-line to all users. In addition, it is possible for you to develop your own education modules relating to your own applications and business functions.
IBM Manuals
The vast array of manuals that come with the AS/400 are of a good standard and well formatted. The manuals provide you with additional information to that provided by Help and guidance on topics such as: how to set up up your system and the procedure to follow to recover from a disaster.
Reference manuals
SC41-0030-0Control Language Reference.
SC41-8082-0Online Education Administering Guide.
SC41-8086-0Q & A Database Coordinators Guide.
© Pacific AssociatesPage 4 1
DO NOT COPY