CL Programming, Introduction, User Interface

Create Library and Source Physical Files

Written by AS400i · 1 min read >

Although most system functions can be invoked directly by using CL commands, it is generally easier for novice users to take menu paths to describe the task to perform and then let the system choose for appropriate command. For example, let’s use the menu path to create a library. If you entered a 4 (for Files, libraries, and folders) on the command line of the main menu and pressed Enter, you would see the DATA menu shown in below.

Files Libraries and Folders
Files Libraries and Folders

(Although the description of this menu is “Files, Libraries, and Folders”, to the operating system its proper object name is “DATA”)

Notice the similarity between the Main menu and the DATA menu. From the DATA menu, you can take choice 2 (Libraries) by typing a 2 on the command line and then pressing the Enter key. Doing so takes you to the LIBRARY menu.

Creating a Library

The description of option 2, “create library”, on the LIBRARY menu suggests that, after three menus, you have just about pinned down what it is you want to do. When you select option 2 from the LIBRARY menu, the system displays the create library screen shown in below. The system uses this type of screen , generically referred to as an entry screen, to request information from a user.


You can get above prompt screen directly by typing the CRTLIB (“Create Library”) on a command line and pressing . Type in the name of the library and enter a brief description for the library. Leave the library type as *PROD.

Press <Enter>. You should see a message at the bottom of the screen saying “Library … created”. If you see the message “Library … already exists”, it means that some other user already has a library by the same name. Note: All libraries are on the same “level” with only QSYS above them. If you get this message, try another name for the library. Other commands that operate on libraries are:

  • DSPLIB (Display Library)
  • DLTLIB (Delete Library)
  • WRKLIB (Work with Library).
Creating a Source Physical File

Now, let’s create a source physical file in the library that we have just created. To create a source physical file,

  1. Type CRTSRCPF and press to prompt on it.
  2. Supply the names for the source file and the library that will hold it.

Below, we show the display for creating a source file called “QCLSRC” in the library “YASIRU”. Press < Enter> and you should see the message “File … created in library …” at the bottom of your screen.


The source code files can have any name but conventionally the names start with Q and end with SRC, for source. Typically:

QCLSRC is the file for the CL program source statements
QDDSSRC is for the DDS program source statements
QRPGSRC is for the old RPG language
QRPGLESRC is for the new RPG/ILE language
QMNUSRC or QMENUSRC is for menus
QCMDSRC is for commands

You could keep most of the source statements is a single file. That is, one member could have CL source statements and another member could have DDS and another could have RPG source statements. Conventionally though, source code is not mixed up like that.

Physical File in AS400

Physical files in AS400

in Introduction
  ·   6 min read

IBM Rational Developer for i

in Introduction, User Interface
  ·   2 min read

23 Most Common AS400 Commands

in AS400 Commands, Introduction
  ·   4 min read

2 Replies to “Create Library and Source Physical Files”

why dont you add your experience here