Control Language (CL) commands are used in IBM i (AS/400) to manage system operations, files, programs, and user interactions. These commands help automate tasks, manage jobs, control system resources, and handle user interactions.
1. Library & Object Management Commands :
Command |
Function |
CRTLIB LIB(LIBNAME) |
Create a new library. |
WRKLIB LIB(LIBNAME) |
Work with libraries (view/manage). |
DSPLIB LIB(LIBNAME) |
Display contents of a library. |
DLTLIB LIB(LIBNAME) |
Delete a library. |
CRTDTAARA DTAARA(DTANAME) TYPE(*CHAR) LEN(10) |
Create a data area. |
WRKOBJ OBJ(*ALL/*ALL) |
Work with objects. |
DSPOBJD OBJ(LIBNAME/*ALL) OBJTYPE(*ALL) |
Display object descriptions. |
2. File & Data Management Commands :
Command |
Function |
CRTPF FILE(LIBNAME/FILENAME) RCDLEN(100) |
Create a physical file. |
CRTLF FILE(LIBNAME/FILENAME) SRCFILE(LIB/SRCFILE) |
Create a logical file. |
DSPPFM FILE(LIBNAME/FILENAME) |
Display records in a physical file. |
WRKF FILE(LIBNAME/FILENAME) |
Work with database files. |
CPYF FROMFILE(FILE1) TOFILE(FILE2) MBROPT(*REPLACE) |
Copy file contents. |
RGZPFM FILE(LIBNAME/FILENAME) |
Reorganize a file to remove deleted records. |
3. Job & Work Management Commands
Command |
Function |
WRKACTJOB |
Work with active jobs. |
WRKJOB JOB(JOBNAME) |
Work with a specific job. |
ENDJOB JOB(JOBNAME) |
End a job. |
SBMJOB CMD(CALL PGM(PGMNAME)) JOB(JOBNAME) |
Submit a job to batch processing. |
CHGJOB JOB(JOBNAME) RUNPTY(30) |
Change job priority. |
WRKUSRJOB USER(USERNAME) |
View jobs for a specific user. |
4. Program Execution Commands :
Command |
Function |
CALL PGM(PGMNAME) |
Call and execute a program. |
SBMJOB CMD(CALL PGM(PGMNAME)) |
Submit a program to batch execution. |
STRDBG PGM(PGMNAME) |
Start debugging a program. |
ENDDBG |
End debugging. |
RUNQRY QRY(QRYNAME) |
Run a query. |
5. User Profile & Security Commands :
Command |
Function |
CRTUSRPRF USRPRF(USERNAME) PASSWORD(PASS123) |
Create a new user profile. |
CHGUSRPRF USRPRF(USERNAME) PASSWORD(NEWPASS) |
Change a user password. |
WRKUSRPRF USRPRF(USERNAME) |
Work with user profiles. |
DSPUSRPRF USRPRF(USERNAME) |
Display user profile details. |
GRTOBJAUT OBJ(LIB/PGMNAME) OBJTYPE(*PGM) USER(USERNAME) AUT(*ALL) |
Grant authority to a user for an object. |
6. System Control & Configuration Commands :
Command |
Function |
DSPJOBLOG |
Display job logs. |
DSPMSG |
Display system messages. |
SNDMSG MSG('Hello') TOUSR(USERNAME) |
Send a message to a user. |
CHGSYSVAL SYSVAL(QDATE) VALUE('2024-02-05') |
Change a system value. |
WRKSYSVAL |
Work with system values. |
7. Backup & Recovery Commands :
Command |
Function |
SAVLIB LIB(LIBNAME) DEV(TAP01) |
Save a library to tape. |
RSTLIB LIB(LIBNAME) DEV(TAP01) |
Restore a library from tape. |
SAVOBJ OBJ(OBJNAME) LIB(LIBNAME) DEV(*SAVF) |
Save a specific object. |
RSTOBJ OBJ(OBJNAME) LIB(LIBNAME) DEV(*SAVF) |
Restore a specific object. |
8. Printer & Output Management :
Command |
Function |
WRKOUTQ |
Work with output queues. |
WRKSPLF |
Work with spooled files. |
DLTSPLF FILE(FILENAME) |
Delete a spooled file. |