Blog Archives

Create Library and Source Physical Files

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.

Libraries

Libraries

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 screen shown in below. The system uses this type of screen , generically referred to as an entry screen, to request information from a user.

CRTLIB

CRTLIB

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.

CRTSRCPF

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
QCBLSRC or QLBLSRC is for COBOL
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.

Advertisements