Tuesday, 28 August 2012

Organization of OS/400 Objects

Creating a Library

 

 Create Library (CRTLIB)


 Type choices, press Enter.

 Library  . . . . . . . . . . . .   YOURLIB__     Name
 Library type . . . . . . . . . .   *PROD____     *PROD, *TEST
 Text 'description' . . . . . . .   Sample_Library__________________


 F3=Exit   F4=Prompt   F5=Refresh   F10=Additional parameters  F12=Cancel
 F13=How to use this display        F24=More keys
 
A library has already been created for during user profile creation. The name of this library is normally the same as that of your user profile. In this section, we will create another library and use this library as an example throughout the manual. 

Note that you can use your default library, i.e. the library that has the same name as that as your user profile, to store all your application objects.

To create a library, type the CRTLIB ("Create Library") on a command line and press <F4>to prompt on it. Type in the name of the library and enter a brief description for the library. Leave the library type as *PROD (a production library is one that is used for normal processing).

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

Create Source Physical File (CRTSRCPF)

 Type choices, press Enter.

 File . . . . . . . . . . . . . .   SRCFILE___    Name
   Library  . . . . . . . . . . .     YOURLIB___  Name, *CURLIB
 Record length  . . . . . . . . .   92_______     Number
 Member, if desired . . . . . . .   *NONE_____    Name, *NONE, *FILE
 Text 'description' . . . . . . .   Sample_Source_File___________________


 F3=Exit   F4=Prompt   F5=Refresh   F10=Additional parameters  F12=Cancel
 F13=How to use this display        F24=More keys
 
 
Now, let's create a source physical file in the library that we have just created. 

To create a source physical file, type CRTSRCPF and press <F4> to prompt on it. 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 "SRCFILE" in the library "YOURLIB". Press < Enter> and you should see the message "File ... created in library ..." at the bottom of your screen.


 

Library Lists

                              Display Library List

                                                         System:  MKTAS400

 Type options, press Enter.

   5=Display objects in library

 Opt  Library     Type      Text
 __   QSYS        SYS       System Library
 __   QHLPSYS     SYS
 __   QUSRSYS     SYS       *IN USE
 __   JOHNDOE     CUR       JOHN DOE's default library
 __   QTEMP       USR
 __   QGDDM       USR
 __   QGPL        USR       GENERAL PURPOSE LIBRARY
 __   QMSU        USR       MSU generated commands and programs
 __   QPAS        USR
 __   MBNLQ       USR       Common Library for MBNLQ ..
 __   ONLINE      USR       COLLECTION - created by SQL



 F3=Exit   F12=Cancel   F17=Top   F18=Bottom

 EXPLANATION:

You may have noticed in the previous screen that the "Library" field defaults to the value *CURLIB, meaning the current library. The current library is tied closely to the concept of a library list. Before we discuss what the current library is, we first explain what a library list is. 

A library list is similar in concept to the "PATH" in Unix and MS-DOS. It specifies which libraries are to be searched and the order in which they are searched when the system looks for an object. A library list is identified by the value *LIBL. 

A default library list is automatically created by OS/400 for each job started by a user. Your default library, that is the library that has the same name as that as your user profile, is automatically included in your library list. 

You can display your library list by typing DSPLIBL and press <Enter> on a command line. The following is the library list for the user "JOHNDOE".
system portion
 
which consists of the libraries that are required to run system functions
 
current library
 
which by default, is the library that has the same name as your user profile (in this case, the library "JOHNDOE"). The current library is the first user library that is searched before the rest of the user libraries in the list.
 
user portion
 
which consists of libraries that holds user objects. Some user libraries, such as QTEMP, QGPL, and QGDDM come with the system while others are locally supplied. In addition, the user can create their own libraries and add them to their library list.

Using the Program Development Manager (PDM)

PDM may either be started using the command STRPDM (for Start PDM,) which will produce a menu of options for the level on which the user wishes to work (libraries, objects, or members,) or using one of three commands which indicate the level at which the user would like to work:
  • WRKLIBPDM -- Work with libraries using PDM
  • WRKOBJPDM -- Work with objects using PDM
  • WRKMBRPDM -- Work with file members using PDM

Work with Objects:

One of the most commonly used commands to start PDM is WRKOBJPDM. This allows the user to work with objects inside a library. Type WRKOBJPDM and press <F4> to prompt on it.

                     Work with Objects Using PDM (WRKOBJPDM)

 Type choices, press Enter.

 Library  . . . . . . . . . . . .   *PRV______ *PRV, name, *CURLIB
 Object . . . . . . . . . . . . .   *ALL______ *PRV, name, *generic...
 Object type  . . . . . . . . . .   *ALL______ *PRV, *ALL, *ALRTBL, *AUTL..
 Object attribute . . . . . . . .   *ALL______ *PRV, attribute, *generic...

 F3=Exit  F4=Prompt  F5=Refresh  F12=Cancel  F13=How to use this display
 F24=More keys

The *PRV value on the "Library" field indicates that the default is to work on the library the user last worked with. These may be replaced with the name of a specific library. 
The "Object" and "Object type" options allow the user to limit which objects will be displayed. Type WRKOBJPDM and prompt with <F4>.

                     Work with Objects Using PDM (WRKOBJPDM)

 Type choices, press Enter.

 Library  . . . . . . . . . . . .   YOURLIB___ *PRV, name, *CURLIB
 Object . . . . . . . . . . . . .   *ALL______ *PRV, name, *generic*...
 Object type  . . . . . . . . . .   *ALL______ *PRV, *ALL, *ALRTBL, *AUTL..
 Object attribute . . . . . . . .   *ALL______ *PRV, attribute, *generic...


 F3=Exit  F4=Prompt  F5=Refresh  F12=Cancel  F13=How to use this display
 F24=More keys


The screen resulting from command WRKOBJPDM, with the library specified as YOURLIB, and *ALL on the other options, is shown below.

                          Work with Objects Using PDM


 Library . . . . .   YOURLIB___       Position to . . . . . .   __________
                                      Position to type  . . . . __________

   Type options, press Enter.
   2=Change       3=Copy        4=Delete      5=Display     7=Rename
   8=Display description        9=Save        10=Restore    11=Move ...

 Opt  Object      Type        Attribute   Text
  __  SRCFILE     *FILE       PF-SRC      Sample Source File

                                                                    Bottom

 Parameters or command
 ===> ________________________________________________________________

 F3=Exit          F4=Prompt            F5=Refresh          F6=Create
 F9=Retrieve      F10=Command entry    F23=More options    F24=More keys

Presently, there should be just one object in the library, the source physical file "SRCFILE" that you have just created.

PDM Options:

 

Options are displayed across the top of the screen (for a list of all the options available in PDM, see Table 1 at the end of this section.) Each option is an action which may be performed on an object by placing its number on the "Opt" line next to the object and pressing the < Enter> key. This method of specifying actions on a form listing the objects available is consistent throughout PDM.
There are two important special features which this method of specifying actions offers: 

First, the options support  the prompting facility, and second, multiple objects may be operated on in succession. To use the prompting facility, simply press <F4> while an option number is on one of the "Opt" lines. PDM will present the prompt screen for the command associated with that option number. 

Multiple objects may be operated on sequentially by placing numbers on more than one Opt line. For example, assume we have two source files in "YOURLIB". 

You can type "5" (Display) against one and type "7" (Rename) against the other. Pressing <Enter> causes PDM to process each option in turn.

 

More on PDM levels

Moving down levels in PDM is accomplished using the "12" (Work With...) option. At the WRKOBJPDM screen, the action of this option depends on the file type. Placing a 12 on the line next to an item on this display will:
  • If the item is of type *FILE, go to the WRKMBRPDM display for that file (there are different types of WRKMBRPDM displays for source and data files.)
  • If the item is of type *OUTQ, go to the "Work With Output Queue" display, allowing the user to work with spooled files.
  • If the item is of type *PGM, present a display allowing the user to call the program, change its attributes, etc. (programs may also be called from the WRKOBJPDM screen by using the 16 option.)
When this method of changing levels is used, pressing <Enter> or <F12> (cancel) with no options on the screen returns to the previous level.

Work with Members:

The WRKMBRPDM display is the bottom level of PDM. When working with a source physical file at this level, option 2 runs the STRSEU command to begin editing a member and 14 calls the compiler for a program of that type (if specific compiler options are needed, for instance the *DEBUG option to include debugging information in the program, remember that the prompting facility may be invoked on any PDM option.) When working with a physical data file, the "2=change" option is no longer valid. However, the "18" option may be invoked to modify the file using DFU (Data File Utility).
Type "12" against "SRCFILE" to work with it. The following "Work with Members using PDM" screen appears:

                           Work with Members Using PDM

 File  . . . . . .   SRCFILE___
      Library . . . .     YOURLIB___         Position to  . . . . __________

 Type options, press Enter.

  2=Edit        3=Copy      4=Delete      5=Display    6=Print
  7=Rename      8=Display description      9=Save 13=Change text ...

 Opt  Member      Type        Text
   (No members in file)


 Parameters or command

 ===> ________________________________________________________________

 F3=Exit          F4=Prompt             F5=Refresh          F6=Create
 F9=Retrieve      F10=Command entry     F23=More options    F24=More keys

Presently, there are no members in "SRCFILE". Let's create a member. To do that, press <F6> (Create). This will automatically invoke the SEU editor. Enter the name of the new source member and for its source type, enter "TXT" (i.e. the source member will contain only plain text). Press <Enter> .

                       Start Source Entry Utility (STRSEU)

 Type choices, press Enter.

 Source file  . . . . . . . . . . > SRCFILE___  Name, *PRV
   Library  . . . . . . . . . . . >  YOURLIB___ Name, *LIBL, *CURLIB, *PRV
 Source member  . . . . . . . . .   SRCMBR____  Name, *PRV, *SELECT
 Source type  . . . . . . . . . .   TXT_______  Name, *SAME, BAS, BASP, C...
 Text 'description' . . . . . . .   Sample_Source_Member____________________
        
                                                                    Bottom

 F3=Exit  F4=Prompt   F5=Refresh   F12=Cancel   F13=How to use this display
 F24=More keys

You will now be inside the SEU editor. For now, press <F3> to quit and type "Y" in the "Change/Create member" field to save the source member. Later on, in the section on SEU we will use this source member. On return to the WRKMBRPDM screen, you will notice that "SRCMBR" is now in "SRCFILE".
The "Work with Members using PDM" screen can be accessed directly using the WRKMBRPDM command. Type this command and press <F4> to prompt on it. To work with the member that we have just created, enter the names of the library and file as shown below. If you have many members in your file, you can use the "Member" and/or "Member Type" fields to narrow down the number of members to work with.

                     Work with Members Using PDM (WRKMBRPDM)

 Type choices, press Enter.
 File . . . . . . . . . . . . . .   SRCFILE___   *PRV, name
   Library  . . . . . . . . . . .     YOURLIB___ *PRV, name, *LIBL, *CURLIB
 Member . . . . . . . . . . . . .   *ALL______   *PRV, name, *generic...
 Member type  . . . . . . . . . .   *ALL______   *PRV, type, *generic...


F3=Exit   F4=Prompt   F5=Refresh   F12=Cancel  F13=How to use this display
F24=More keys

 


 



 

 

No comments:

Post a Comment