The vast majority of AS/400 commands were written by IBM developers to perform system level tasks like compiling programs, backing up data, changing system configurations, displaying system object details, or deleting them. Commands are not limited to systems level concerns and can be drafted for user applications as well.
The AS/400 developer's solution to this problem was the command object (*CMD). While the parameters on the command can be specified in any order, each parameter is defined to be passed in a specific order to the program. The programmer can also define, among other things, the parameter's data type, unique parameter name, descriptive text (for prompting), default value (used only if the parameter isn't specified during execution), if the values are restricted to a certain set or range, if the data entered should be changed to another value before calling the program, etc.
At its most basic a command names a single program to call when the user types or prompts the command and presses the Enter key. The command takes all of the parameters typed by the user, and those not typed by the user, and builds a parameter list that it passes to the program when it's called.
::= command-name [ ] [ ] ::= [ ] ::= parameter-name"(" ")" [ ] ::= [ ]
::= CL-name |
The items above that end in -name follow AS/400 object naming conventions which, generally speaking, means the name starts with a letter and can be up to ten characters in length. (CL commands are also case-insensitive.)
A good example of a typical CL command is the Change Program (CHGPGM) command below:
CHGPGM MYPGM OPTIMIZE(*FULL) RMVOBS(*BLKORD *PRCORD) TEXT('My program.')
The above command is passing four parameters to the program that does Change Program processing and they are:
In reality the AS/400 will pass many more parameters than the four specified above. This is because the rest of the CHGPGM command's parameters were not specified, so default values will be passed instead. For every parameter on this, aside from the PGM parameter, that default is *SAME, meaning don't change it.
The system will then present a screen with the set of parameters that the program accepts/requires (required parameters are usually highlighted).
Required parameters are listed first, and parameters with system-supplied default values are listed last of all. To see all parameters, press F10. If any one choice requires further selections, those are cued as you select that value for that parameter, by appearing onscreen.
Prompting is further enhanced to allow the programmer to find what values are valid for each parameter. To do this during prompting the user would move the cursor to the parameter field in question and press F4 again. The system would then display a screen describing the type of input required and an available list of allowable values.
To enter a longer name, or extend the list to allow you to enter extra values, type a plus sign instead of a value. (As when listing names of objects to be saved or restored.)
There are other menus besides the Command Grouping Menus. The starting point for the menuing system can be accessed by pressing F4 on an empty command line.
In the background the system is using the SLTCMD command to perform this function. If one wants to select all commands in a library then prompt this command and enter the special value *ALL.
PGM (&IN &TYP)DCL &IN *CHAR 6DCL &OUT *CHAR 8DCL &TYP *CHAR 1IF (&TYP = J) +DOCVTDAT DATE(&IN) TOVAR(&OUT) FROMFMT(*MDY) +TOFMT(*JUL) TOSEP(*NONE)ENDDOELSE IF (&TYP = M) +DOCVTDAT DATE(&IN) TOVAR(&OUT) FROMFMT(*JUL) +TOFMT(*MDY) TOSEP(*NONE)ENDDOSNDPGMMSG MSG('IN=' || &IN || ' OUT=' || &OUT) +MSGTYPE(*COMP)
"Supply of Special Clothing" in Lots as Follows: Lot 1 - "Special Clothing for Work in Shallow Waters"; Lot 2 - "Special Clothing for Work Boats during Floods" on the Project "Strengthening The
Aug 10, 2013; Contract award: "Supply of special clothing" in lots as follows: Lot 1 - "Special clothing for work in shallow waters"; Lot 2 -...
Supply of Building Materials across Dussd-Moi Positions as Follows: Position 1 Supply of Construction Materials Sector Crs - Dussd; Position 2 Supply of Construction Materials Sector AP - Duss
Apr 13, 2013; Contract notice: Supply of building materials across dussd-moi positions as follows: position 1 supply of construction materials...
Perform Highly Specialized Medical Research and In-Patient Of" Kotz Plovdiv "Ltd. in Lots as Follows: 1. Lot ? 1: Performance of Computed Tomography; 2. Lot ? 2: Perform Mri; 3. Lot ? 3: Perform
Jan 02, 2013; Contract notice: "perform highly specialized medical research and in-patient of" kotz plovdiv "ltd. in lots as follows: 1. lot ?...
"Supply of Food for Kindergartens and Milk Kitchen in the Municipality of Razlog" on Items as Follows: 1. "Dairy Products" 2. "Meat and Meat Products" 3. "Different Food" 4. "Fish and Other Aquatic An
Mar 05, 2013; Prior Information Notice: "supply of food for kindergartens and milk kitchen in the municipality of razlog" on items as follows:...