Top Banner
Lesson 1 - Communicating With the System The System Multi-user - many different users Multitasking - can run many different job Job - Basic unit of work on the AS/400 subsystem - defined by subsystem description the bring together of system resources to get a job done Types of Job Interactive job - done on-line Batch job - done in groups Job Queue - where jobs wait to be executed OS/400 OS/400 - the operating system for the AS/400; consists of programs and utilities that control the computer OS/400 Support - Predefined settings for work management functions that allow both interactive and batch jobs to run without customization Object - anything that take up space on the AS/400 Object type - determines how the AS/400 will used the object Control Language Control Language - how the user control or interfaces with the machine OS/400 CL is a flexible and powerful language that allow access to OS/400 functions Command Parameters - the component parts of a CL command Command line - where the CL is typed Menu interface - allow access to the AS/$00 without the need for CL commands System Values
40
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: As 400 Basic

Lesson 1 - Communicating With the System

The System Multi-user - many different users Multitasking - can run many different job Job - Basic unit of work on the AS/400 subsystem - defined by subsystem description the bring together of

system resources to get a job done

Types of Job Interactive job - done on-line Batch job - done in groups Job Queue - where jobs wait to be executed

OS/400 OS/400 - the operating system for the AS/400; consists of programs and

utilities that control the computer OS/400 Support - Predefined settings for work management functions that

allow both interactive and batch jobs to run without customization Object - anything that take up space on the AS/400 Object type - determines how the AS/400 will used the object

Control Language Control Language - how the user control or interfaces with the machine OS/400 CL is a flexible and powerful language that allow access to

OS/400 functions Command Parameters - the component parts of a CL command Command line - where the CL is typed Menu interface - allow access to the AS/$00 without the need for CL

commands

System Values System Values - control and system attributes that allow you to change

system functions Date & Time - as the name implies Editing values - controls how dates, decimal values, and numbers are

formatted. System Control - allow you to set controlling values such as operator

name, user assistance level, and IPL time. Allocation Values - number of active jobs and memory settings and

allocation. Message and logging values - determine how the system handles and

records certain types of messages.

Page 2: As 400 Basic

Storage systems values - determine size and activity level of base staorage pool.

Security values - control aspects of security. All these settings can be adjusted by the user

Licensed Programs software components, other than OS/400, that expand the capability of the

system. Application development tools (SEU, SDA, DFU, PDM, etc.) Office Vision Communications support Programming languages (RPG, COBOL, DB2)

User Profile User - anyone who uses the AS/400 User Profile - identifies the user to the system, describes the user's

authority, and operational characteristics of their jobs Class - casual user, programmer, security officer Special authorities - job control, capability to save software, create or

change profiles Initial program - the first program to run on the AS/400 when the user

signs on Group profile - assignment of the user to a group of users

Sign-On Display device - terminal, CRT, VDT, etc. - allows the user to

communicate with the system Job description - describes how the user's job will be executed on the

system

User Interface How the user control the machine Library - a directory of related jobs

Menu Screens - 1st screen type Screen header - menu ID, menu description, system name Menu options - a number list of options Command line - where command are types Function Keys What can be done from here

o Menu choices o Ask for help o Enter CL commands o Use function keys

Entry/Command Screens - 2nd screen type

Page 3: As 400 Basic

AKA command prompt screen Basically, you supply information to this screen type

Using Help (F1)- This is the Information screen, which is the 3rd type Field or Context-Sensitive help - provides help about a specific area of the

screen. The help keys itself to the item that the cursor is located next to. Extended help (F2) - more extensive help InfoSeeker - access to the AS/400 soft copy library InfoSeeker Tour Information Assistant Option Search Index (F11) - allows the user to search the help database to get

specific information

List or "Work With" Screen - 4th type of screen Usually results from a work with screen Option depends upon the list screen shown

Lesson 2 - Using CL - Taunton's Class

CL Commands CL is the primary interface Unlike other systems, The AS/400 does not make you select one mode or

the other (CL commands or menus), in other words you can use both modes at the same time.

Before you can use CL, you must understand the syntax of the language

CL Syntax Syntax is an arragement of words to form phases, clauses, and

sentences. AS/400 command syntax consists of a command name (usually a verb

consisting of one, two, or three parts) and one or more parameters (files names, libraries, or other AS/400 objects to be affected by the command).

commandname parameter1 parameter2

Page 4: As 400 Basic

Command names o Consist of verb and noun or verb, noun, modifier. These normally

consists of three characters each, but not always. (CALL and GO are exceptions.)

verbnoun or verbnounmodifier

o Examples CRTLIB (create library) CRTRPGPGM (create RPG program) DSPMSG (display message)

As stated earlier, not all commands consists of three letters. o D - stands for Description o E - stands for Entry o F - stands for File o L - stands for List o Q - stands for Queue

Some nouns always need a modifier o example - you can copy a file (CPYF) o example - you cannot work with a Queue, you work with a message

queue (WRKMSGQ) o example - You can display a file discription (DSPFD), but not just a

discription bu itself. Some nouns/modifiers are name of utilities or compliers

o C - a programming language o CBL - COBOL o CL - control language o DFU - data file utility o RGP - report generator program o SDA - screen design utility o SEU - source entry utility o STR (start) & CRT (create) are commonly used with these.

Keyword Notation o An important part of the CL syntax is the parameter keyword which

names a command parameter.

commandname keyword(value1) keyword(value2) etc.

o Example - CRTLIB LIB(PAYROLL) TYPE(*TEST) TEXT('Payroll DEvelopment')

o Keywords do not have to be in any particular order o F9 can be used to recall a previous command

Positional Notation

Page 5: As 400 Basic

o This can be use instead of Keyword notation, but position of parameters must be followed exactly! Use IBM manual.

Menus of Commands Menus are arranged in a hierarchical fashion Menus are grouped acccording to function or category

The GO Command GO can take you to any menu if you know the name of the menu

Library List A library list is the definition of the path of libraries a job will search when

trying to find programs, file, or other AS/400 objects named in a command. System Library List

o Contains up 15 libraries needed for the system to operate Product Library

o Inserted by the OS when needed for some task (QRPG when callingh a RPG program)

Current Library o the default library (your library)

User Library List o Organizes the object into categories such as programs, screens,

data files, and applications Object Within Libraries

o When objects are created, they must be associated with a library o By default, object go into the current library unless specified

otherwise o If no current library is specified, the IBM default is assumed o Unless specified otherwise, the lirbrary list is used to search for

objects o A search is performed in the following order:System Lib, Product

Lib, Current Lib, and User Lib. o Library list contents are determined by the user. o Library can be tailored to the use

Page 6: As 400 Basic

Lesson 3 - Objects - Taunton's Class

The AS/400 Object-based Architecture All AS/400 are encapsulated by an "outer layer" that protects them and

determines what actions can be taken on them. The AS/400 exist as two machines

o The Logical Machine - The way the user sees it, idependent of hardware. This is essentially the OS and the applications. All commands to the AS/400 are translated across the machine interface (MI) into licensed internal code that will cause the machine to perform the actions specified.

o The Physical Machine - The actual hardware of the computer. o The two can be considered insultated from each other by the

licensed internal code and the high-level machine interface. All storage is single level (treated the same). Memory management is a

function of the internal code and not the applications.

Types of AS/400 Objects An objects type determines its purpose and how it is used. Shown below are some

common AS/400 types:

Object type Object Description Attribute (Subtype)

*AUTL Authorization List -

*CMD Command -

*DEVD Device Description -

*File File

PF Physical File LF Logical File DSPF Display File PRTF Printer File

*JOBD Job Description -

*LIB Library -

*OUTQ Output Queue -

*PGM Program (Executable)

- CBL RPG CLP

*QRYDFN Query Definition -

*USRPRF User Profile -

Objects are placed into a libray when created. The type and authorization of the object is associated with the object in the library. This once again determines use and purpose of the object

Page 7: As 400 Basic

Requesting an Object When an object is requested, the libray list is searched from top to bottom

until the object is located. It is therefore not necessary to specify a library when requesting an object.

Multiple programs/objects with the same name can exist on the AS/400. The object or program located first during the search is the one that will be used.

Qualified Names A qualified name is the name of the object along with the libray reference

for that object (i.g. libref/objectname This is used when multiple files exist with the same name. Remember that

the AS/400 searches the library list and uses the first occurance of an object with a particular name. If another object other than the first object encountered is to be used, the qualified name method must be used OR the libray list must be resequenced.

The library in which an object resides does not have to be in your library list. It must however exist on the machine.

Library List Commands The DSPLIBL Command

o Displays the library list o Shows sequence in which libraries are searched

The CHGCURLIB Command o Allows the user to change the current library o Allows the user to set up the library sequence

The ADDLIBLE Command o Allows the user to add new libraries to their list o Use the DSPLIBL to varify that new entries have been made

The CHGLIBL Command o Lets you add, remove, or change the order of your library list o In other words, it lets you edit the list

The EDTLIBL Command o Lets you work on multiple lists o Do simple editing of lists by specifing sequence numbers

Locating and Object Once again, when an object is requested, the libray list is searched from

top to bottom until the object is located. Existance of the object and authorization to use the object is checked.

Storing Objects An object is stored according to type and usage Object can be placed in just about any library These objects always go into the QSYS library (*USRPRF, *LIB, *DEVD)

Page 8: As 400 Basic

Objects that Help Manage Work Flow, ot the Concept of Spooling The Spooler is a specialized part of the AS/400 with its own subsystem A Spool file is a print file that has been created and placed into a queue

until it is released to the printer. Without spooling, the computer's resources would constantly be tied up

performing print jobs and printing files that are not neccesarily needed Printer Spooling

o When any type of print output is produced (print screen, program output, etc.) it is sent to a printer file (QSYSPRT).

o The printer file is a special type of file that detemines what attribute the output will have (formating, page size, special features, etc.).

o Spooled file are printed in that they are formatted, but are not yet in hard copy.

o The Print Queue is the holding area for output

Lesson 4 - Handling Spooled Files - Taunton's Class

Printer Files A printer file is an object that specifies format and other print attributes of a

printed output by an application p[program, utility, or system operation. Printer files can be changed using the CHGPRTF or created using the

CRTPRTF (see fig. 4.1 in text to observe the attribute that can be changed in a print file)

QSYSPRT is the system print file. The application determines what data is sent and how fields will be

formatted on each line. The process of creating printed output is shown below:

Page 9: As 400 Basic

The print spooler is a part of the OS dedicated to control and management of printed output.

Printer Writer After a spooled file has arrived at an output queue, it must be transferred

to a physical device. This is done through the use of a printer writer. The printer writer is the software connection between the an output

queue and a physical printer and is created when a print device is described to the system.

This also results in the creation of an output queue. The printer writer & the output queue have the same name as the printer

device. By default, a printer writer reads spooled files from the output queue of the

same name. The CHGWTR command can be used to attached the printer writer to a different output queue.

Changing Writers The CHGWTR command can be used to attached the printer writer to a

different output queue (e.g. a output queue that the user creates). An example of using another output queue might be when different paper

stock is needed for specific spooled output. The forms could be swapped, the writer changed, and the spooled output released.

Changing Spooled File The AS/400 supports serveral commands that let you change change or

invoke spooler operations. o WRKUOTQ - Work with Output Queue o WRKSPLF - Work with Spoole File

Working with Output Queues You must specify which output queue to work with when you use the

WRKOUTQ commands The format for the commands is:

WRKOUTQ PRTXX where XXX is the print queue identifier

Alternate views of the WRKOUTQ can be obtained by using the F11 key. The ability to perform certain operations on a spool file depend upon the

users spool control special authority. Shown below is a list of operations that can be performed on spooled files:

Page 10: As 400 Basic

Send Used to route a file across a network

Change Used to modify attributes of a file

Hold Used to prevent a file from being printed

Delete Used to remove a file

Display Used to view the file on the terminal

Release Allows a file to be printed

Messages Used to view messages

Attributes Used to check details of a spooled file

Printing Status Used to find out the progress of a print job

Working with Spooled Files The WRKSPLF commands is similar to the WRKOUTQ. The difference is that the WRKSPLF show all spooled file, regardless of

which output queue they are in.

Changing Spooled File Attributes Read over this section in the text. It is a complete example of how to

change a print writer.

Assistance Levels There are two assistance levels for the for certain type of AS/400 displays.

1. Basic Assistance Level 2. Intermediate Assistance Level

The level of assistance determines the amount and format of the information displayed.

Lesson 5 - Describing a Database File - Taunton's Class

File Varieties All files on the AS/400 are classified as type *FILE 12 varieties of files on the AS/400 Files are identified by subtype These are the commonly found file attributes:

o PRTF - printer files, discussed in lessons 3 & 4 o DSPF - display files, determine how data is displayed on the screen o PF - physical files, used to hold and organize data or to organizes

source programs and source data descriptions o LF - logical file, created over physical files, they contain access

paths to the data

Page 11: As 400 Basic

Program-Described Files Files that require the programs that used time to provide additional

information about them (i.e. the working storage section of COBOL program)

Externally Described Files Physical files that contain data as well as how the data is to be accessed

are call externally described files. These file carry field level description of the data (like a blueprint) Advantages of this method:

o Record formats are standardized o Utilities can be used more easily o Programming becomes less tedious

Externally Described Files contain information at the file level, the record format level, and the field level.

You can use DSPFFD to examine these characteristics of a file. File information gives file name, library name, file location, the file type,

number of record formats, and notifies the user that the file is externally described.

Record format information lists the record format name.

Creating an Externally Described Database File Requires three steps:

o A description of each elements of data to be stored o Creation - compiling the file description o Insertion of data - entering the data

Methods of Describing Database Files at the Field Level. There are three methods for describing files:

o IDDU - Interactive Data Definition Utility, a menu driven approach o SQL - Structured Query Language, a powerful database language. o DDS - Data Description Specification, (the preferred method) a

language used to code file descriptions for several types of files. Two important tools used with the DDS:

o SEU - Source Entry Editor, a text editor used to create text files. o PDM - Program Development Manager, provides convenient way to

create source members and access SEU.

Introduction to PDM PDM allows the user to navigate through the AS/400 architecture PDM allows the user to access objects through the use of menus,

commands, or options. PDM can be started using the CL command STRPDM (start program

development manager).

The STRPDM Command

Page 12: As 400 Basic

From here you work with: o libraries o objects o members o user defined options

Work with Libraries Using PDM (Option 1) Does as the name implies (F11 or F24 can be used to gain access to

more functions). Actions can be taken on the libraries by using the appropriate functions You can view the CL command that this screen will invoke by placing the

cursor on the option field and pressing the F4 (prompt) key.

Work with Objects Using PDM (Option 2) Does as the name implies (F11 or F24 can be used to gain access to

more functions). Actions can be taken on the objects by using the appropriate functions

Work with Members Using PDM (Option 3) Does as the name implies (F11 or F24 can be used to gain access to

more functions). Actions can be taken on the members by using the appropriate functions

Creating a member Via SEU From the Work with Member Screen, members can be created using the

F6 key (see fig. 5.13 in book). You must provide this screen with Source file name, Library name, Source

member name, Source type. Text description is not mandatory but help an awful lot.

When all info has been typed in and the Enter key pressed, the SEU starts.

The SEU allows you to uses different prompts for different computer languages.

SEU Help Use the F1 or F2 key to get help using the SEU, or there is a book

available in the bookstore

SEU Line Commands From the SEU Edit work screen, you can get into insert mode by typing a

line command in the sequence column of the "Beginning of data" line. The Sequence column maintains sequnce number and allows the user to

type in SEU commands.

DDS Record Format Entry DDS require record format entry (R and a Name for the record format)

Page 13: As 400 Basic

Field-Level Entries Four parameters are required to describe the fields you enter in the DDS

entry: o Name o Length o Data type o Decimal position (if the data is numersi)

Exiting the SEU F3 take you to the Exit screen You will be prompted as to what actions you want to take with the file you

have created.

Lesson 6 - Creating and Using an Externally Described Datbase File - Taunton's Class

More About SEU It is a general purpose screen editor used create files, objects, or HLL

programs (like Cobol or RPG). It can also be used to modify existing members.

Starting SEU SEU can be started from "Work with Members" in the PDM SEU can be started using the CL command STRSEU The *PRV on the "Source file" and "Source member" tells the SEU to use

the same source file and member tyhat you used the last time you used the SEU

The *SAME on the "Source type" tells the SEU to use the source type already specified if you are working with an existing member.

The Option parameter specifies and action to take on the object (i.e. 2=Edit, 5=Display(Browse), or 6=Print).

The advantage to using PDM is that is remembers info from your last session.

Accessing SEU Via PDM You can work with members is the SEU several different ways:

o Take option 3 from the PDM menu. o Use the "Work With" option from the Work with Objects Using PDM

screen. o Use the CL command WRKMBRPDM

SEU Line Commands Line commands can be used in the sequence number column C - used to copy one or more lines

Page 14: As 400 Basic

M - used to move one or more lines I - used to insert one or more lines D - used to delete one or more lines Target Designator

o The SEU line commands C or M require that you specify where in the code lines are to be moved or copied. This is done though the use of the target designators "A" or "B".

o Line commands can also allow you to specify the number of lines to manipulate (i.e. M3 means move 3 lines, C5 means copy 5 lines, etc.).

o Large blocks of lines can be manipulated using double letters (i.e. MM, CC, or DD) at the first and last lines of a block of code.

Compiling the File Description What has been done up to this point is the description of the source file

member (the DDS). The member now has to complied. Create (CRT) Commands

o The most direct way to create an object on the AS/400 is to use the CRTPF command. Of course, other parameters would have to be supplied.

The PDM Compile Option o Option 14 allows you to compile a member o You can use CRT then use F4 to prompt the machine for more

parameters automatically.

Displaying an Object's Description Option 8 allows you to display an object's description as well as other

details from the "Work with Objects Using PDM" menu.

Displaying a File's Description The details shown when using option 5 (Display) vary depending upon

object type. For example, when displaying a file, you get a must more detailed screen.

DFU The DFU utility allows you to quickly and conveniently enter (populate)

data into a complied source member. DFU can be started using STRDFU or by selecting option 18 (Change

Using DFU) from the Work with Objects Using PDM screen. DFU either creates a temporary entry/update program or stores the data in

a complied member. Using a Temporary DFU

o Option 5 allows you enter data into a member. You must supply name a member information.

Starting DFU on an Empty File

Page 15: As 400 Basic

o The next screen you would see would be the entry screen consisting of the field names discribed in the DDS.

o When entering data, be sure to use the Field Exit key to advance through the fields.

o F11 allows you to change exiting records. o Page Up can also be used to advance through the records. o When you are ready to write the data to the file, you can press F10

Exiting DFU - Done by pressing the F3 key.

Lesson 7 - Introduction to Query/400 - Taunton's Class

What Query/400 Does It lets you obtain info from any externally described file. It lets you generate reports, screen displays, or new database files. It is menu driven. Features of Query/400 include:

o The selection and arrangment of records. o The selection and placment of fields. o The specification of reports breaks. o The ability to examine the layout and preview a report. o The execution of query programs.

Getting into Query Use the command CL command SRTQRY (start query). The first screen that you will see will be the "Query Utilities" screen (see

fig. 7.1).

Working with Queries The "Work with Queries" (see fig. 7.2 & 7.3) screen can be accessed

directly by using the CL command "WRKQRY" (work with query". Option 1 allows you to creat a new query. Option 2 allows you to change a query. Option 3 allows you to copy a query. F4 (prompt) gives a list of existing queries from your library.

Defining the Query Use Option 1 to create the query. The "Define the Query" screen appears (see fig. 7.4) with a list of all

availbale query features. After selecting one of these features, Query/400 will prompt you through a

series of lower level screens to define exactly how you wish the query to appear.

When finished, you will exit to the "Define the Query" Screen.

Page 16: As 400 Basic

Selecting Files When the "Define the Query" screen appears, you must provide the name

of the database file to use. When Enter" is pressed from this screen, you will see the "Specify File

Selections" (see fig. 7.5) screen. You can prompt for files info from this screen. The next screen is the "Select File" (see fig. 7.6) screen. When finished, you will return once again to the "Define the Query" screen

(see fig. 7.7).

Previwing a Query Layout You have now created a basic query report (see fig. 7.8). F13 from the DQ screen lets you view the first 72 characters of the screen. F20 can be used to shift the report to the right. If you want to change the layout of the report, use F12 to return to the DQ

screen (see fig. 7.9).

Formatting Report Columns The "Specify Report Columns" (see fig. 7.10) screen displays three field at

a time allowing you to change spacing, headings, and field lengths (see also fig. 7.11 & 7.13).

Editing Options To edit the way numbers appear on the report, use Edit option 1 (see fig.

7.12, 7.13, & 7.14). Be sure to press Enter when changes have been made to ensure that

changes take effect. F12 cancels changes. F3 exits. Edit words can also be specified if appropriate editing functions are not

sufficient (see fig. 7.15, 7.16, 7.18, 7.19).

Selecting Sort Fields This "Select Sort Fields" screen is shown fig. 7.21. this screen can be

accessed through the DQ screen (fig. 7.20). Sort priority can be specified by using priority numbers. Sort order (A=Ascending or D=Descending) can also be selected. Query will ask you to confirm your choices (fig. 7.22).

Defining Report Breaks Page breaks as well as contol breaks can be defined (fig. 7.23, 7.24, &

7.25).

Selecting and Sequencing Fields The DQ screen now appears as shown in fig. 7.26 (note the ">" symbols

where options have been selected and defined).

Page 17: As 400 Basic

Fields can be selected and sequenced (fig. 7.27 & 7.28). You can Preview the Report again when completed (fig. 7.29).

More Report Column Formatting A feature can be returned to as many times as in necessary by using

option 1 (see fig. 7.30, 7.31, & 7.32).

Report Summary Functions You can add summary info to your report (such as control break data) by

selecting that option from the DQ menu (see fig. 7.33 & 7.34).

Exiting Query When you are finished designing the query, you can exit (F3) the DQ

screen, You will be prompted for information on saving the query.

A Conceptual Foundation for Joining Files Data from separate data files can be combined together through the use

of a "Join" operation. The join operation can be performed when two database files have a

common field. The figure below represents a properly normalized database. Without

normalization, the ZIP, CITY, and STATE fields would appear in evey record of the EMPPF file.

The database files are joined using key fields from the two files. A primary key is a key that uniquely identifies a record. A One-to-Many relationship (1:n) means that one record in one file

relatesd to many record in another file (a.k.a. Parent-Child relationship). To join files in Query/400, you must specify the primary file (the one that

contains the critical data) first.

Creating a Join Query You must specify the primary file before performing a join operation (fig.

7.38). Files can be added to the join operation by using the F9 key (see fig. 7.39

& 7.40).

Page 18: As 400 Basic

1=Matched Records This causes a "Natural Join" to occur. With this option, any record in the

primary file with a matching record in the secondary file will appear in the query results. Records without a match will not appear in the results.

In many cases, this type of join would not be desirable.

2=Matched Records with Primary File This cause an "Outer Join" to occur. All records in the primary file will

appear in the query results. If a matching record exists in the secondary file, it will along with the record from the primary file.

3=Unmatched Record with the Primary File This cause a "Difference" opeartion to occur. Only file that do not have a

match will appearin the query results.

Specifying the Join Relationship This is done through the use of the "Specify How to Join File" screen (fig.

7.42 & 7.43).

Lesson 8 - Using Logical Files - Taunton's Class

Physical Files and Access Paths - As you recall, physical files contain the record format (DDS) and field information. This serves as a "blueprint" for the record. How the record data is retrieved or read is done though an Access Path.

Access Paths - Unless specified otherwise, data is stored and retrieved using arrival sequence. On the AS/400 there are two ways in which data can be accessed:.

Sequentially - one after another, in the same way in which they were entered. All records may have to be read in order to get to a specific record.

Directly (random access) - retrieval of any record without having to read all other records.

Keyed-Sequence Access Paths - The ability to access data using a specific field or fields called the key field.

Specifying Key Fields - keys can be specified in the DDS. Several key types can be defined:

Composite key - two or more fields used together. Used when a unique key is unavailable.

Primary key - one field used to uniquely identify a record. Duplicate keys - a field that is not unique to the record. The AS/400 will

not allow primary keys to be used as duplicate keys. Unique or FIFO must be coded into the DDS before the record format entry (fig. 8.1).

Page 19: As 400 Basic

Logical Files - They allow different ways to present the data stored in a physical file. These different ways to acquire the data are called "views". Logical Files allow you to:

Randomly access data by using different keys Select only certain records of a file (selection) Include only necessary fields (projection). Combine data elements from different files (join).

Describing a Simple Logical File - Must be done using an existing PF. Example: R EMPPFR PFILE(EMPPF)

Alternate Access Path - Logical file provide a way to access data in a different way in which it was stored in the physical file (fig. 8.3, 8.4, & 8.5).

Selection and Omission - Limiting which fields will be displayed. Done by coding an "S" in the name type field. Three keyword can be used with this entry:

o VALUES - select/omits field with a specific value. o RANGE (lowval highval) - selects/omits field within a given range. o COMP (op comparand) - select/omits values tested with a

comparison operator (EQ, NE, LT, NL, GT, NG, LE, GE). Omit: The inverse of Select - Leaving fields out. Done by coding an "O"

in the name type field. Uses the same operators as Selection. Projection - Has to do with limiting fields in a view (fig. 8.7, 8.8, & 8.9.

Creating a Logical File - Create DDS according to examples seen in the text thus far and Exit (F3). Compile using option 14. This will take you to the "Create Logical File" (CRTLF) screen (fig. 8.12).

Specifying Access Path Maintenance - Done using the *IMMED parameter in the "Access path maintenance" entry on the second screen of the CRTPF screen. This is preferred since most files with unique sequence must be processed immediately. Files that often change often (volatile) and do not have unique keys can have their response time affect by having too many access paths. In these situations, the *DLY or *REBLD maintenance options is preferable so throughput will be be as affected.

Using DFU on Logical Files - DFU treats logical file as if they were physical files (fig. 8.14 & 8.15).

Creating Join Logical Files - See example in Book

Using Query with a Join Logical File - See example in book

Multiple-Format Logical Files - allow update of two of more physical files (fig. 8.31, 8.32, & 8.33)

Page 20: As 400 Basic

Lesson 9 - Additional Database Facilities - Taunton's Class

Creating a File (Review) Computer programs are written in a source language like Cobol. RPG, C,

etc. Many computers support description languages (like DDS). Physical files are written using DDS (file blueprint). The PF is complied creating a PF-DTA type. These PF's are located in a Source PF. Data can be entered into the file with the type PF-DTA using a DFU.

Changing the Source DDS The DDS can be changed by adding new fields as needed and

recompiling (fig. 94).

Preserving the Existing Data Important - Be aware that recompiling a DDS under the same name will

result in the loss of data in the original PF-DTA file! (fig. 9.6). First, save the modifed DDS under a new name. Now compile the new DDS. We can now copy the data from the old file inot the new.

Renaming the File This is the efficient way of building the new data file. The procedure listed

above can be used.

The Copy File Command The CPYF command (not the copy file option) provides a way to copy

existing data into a new data file (see fig. 9.14). Use the *ADD to avoid unnecessary clearing of the existing member. Other features of the CPYF screen:

o Print copied records in character or Hex format o Specify a range of record to be copied or printed o Specify record format o Specify beginning and ending records for keyed file sequences o Select records using a relational test (EQ, GT, LT, etc.) o Tell the copy function to move data field by field.

Record Format Field Mapping (see fig. 9.15) For the Data to be mapped properly, we must specify *MAP for the

"Record format field mapping " parameter. Other parameter values for this field:

o *NOCHK - for record formats whose filed names are different but whose field boundaries align and whose data class is not in conflict.

o *DROP - to not use certain fields (see example in text).

Page 21: As 400 Basic

Verfying the Copy Operation We can verify what the new file will look like by using the DSPPFM

Recompiling Programs and Queries That Use a Physical File Logical files and queries that use the new file may have to be recompiled.

Database File-Level Security Logical files can be used to restrict access to groups of records through

the use of Select, Omit, & Projection Access to PF's can be restricted according to user authority. All objects have two authorized users: the owner of the object and

everyone else not covered by another explicit authorization. Everyone else is given the special name *PUBLIC.

Authority to an object can be changed using the EDTOBJAUT screen (fig. 9.18, fig. 9.19, & 9.20).

Possible authorities o *ALL o *CHANGE o *USE o *EXCLUDE

Authorization List This is an alternative approach to editing individual object authorities. This is accomplished using the CRTAUTL commands This screen allows you to specify user and their object authorities (fig.

9.23). Object authority can also be edited (fig. 9.24).

Group Profiles Yet another way to grant access to object is through group profiles. Users are assigned to groups and the group can then be assigned an

authority (fig. 9.25).

Lesson 10 - Creating DFUs - Taunton's Class

Why DFU? The DFU (Data File Utility) is fast way to build an interactive file

maintenance program over any physical or non-join logical database. DFU is easy to use. Does not require programming skills: The code for the DFU is generated

as a response to a series of DFU entry screens. The DFU is not suitable for calculated fields, validation, advanced

database functions, and subfile and screen formatting.

Page 22: As 400 Basic

Accessing DFU Use STRDFU on command line.

Creating a DFU Program Option 2 from DFU screen(fig. 10.1) take you to the "Create a DFU

Program" screen. F4 on this screen(fig. 10.2) can be used to prompt for information from the

user(fig. 10.3). 1 selects a file.

Defining General Information Screen you see after CDFU (Create DFU screen) depends upon field

format. Non-indexed files can only be accessed via arrival sequence. The display for Indexed files will be slightly different. Options availble for both file types:

o Job Title - the name of the job. o Display format - arrangment of fields o Audit report - turn on or off audit log which lists changes,

delections, & additions to files o S/36 - eliminates function keys. o Supress errors - supresses decimals errors. o Edit numerics - used edit codes. o Allow updates - "N" allows use of Enter key, "Y" allows use of

Page up/Page down keys also. Options available for non-indexed files only:

o Generate - "Y" assigns relative record number, "N" means user must provide number.

o Stored in field - "Y" means field must be named for storing relative record number.

o Heading - Tells how the relative record number will be identified, *RECNBR default.

o Processing - defines access method (1=Direct, 2=Sequential). Options avaible for indexed files only:

o Generate - "Y" for DFU to generate keys in multiples of 10, "N" if data field is used.

o Changes allowed - "Y" allows data to be changed.

Defining Audit Control After completing Define General Information screen, Define Audit Control

(fig. 10.8) displays. This screen would not appear if "N" had been chosen for Audit report on

previous screens.

Selecting and Sequencing Field This is the next screen after audit screen.

Page 23: As 400 Basic

Using sequence number selects field tp appear in report. F21 selects all fields.

Specifying Extended Field Definitions Extended Field definitions can be selected from the "Work with Fields"

Screen by using "Y". Available Options from this screen:

o Dupe - duplicates a previous field's contents. o Accumulate - provides running totals. o Auto-increment - set numeric fields to a number that will increment

automatically. o Validity checks - data value tests o Data editing - see fig. 10.14, 10.16, 10.17, 10.18, & 10.19.

Exiting DFU "Y" on "Save Program" saves DFU. "Y" on Run Program" tests the DFU. Type of run (1=updates, deletions, & additions, 2=display only) Modify program, select "Y" if old DFU has been modified. Save DDS source, normally "N", "Y" if you planned to modify DFU screen

layouts directly through the DDS.

Sample Run fig. 10.21 - 10.28.

Lesson 11 - Using SDA - Taunton's Class

What SDA does On the AS/400, most users work interactively using screens and menus,

or they enter data. Menu screens utilize number lists that invoke CL commands. Non-menus screens(display screens with type DSPF) are basically

complex and hard to construct. They must be built with CL or HLL. Both menus and displays are created by compiling the DDS that describe

them. SDA (Screen Design Aid) provides a convenient way to create screens

using fill-in-the-prompt and blank-screen displays. SDA discourages entries that could result in errors in the DDS.

Getting Started with SDA Use the STRSDA command. The AS/400 Screen Design Aid screen allows you to:

o Designing screens o Design menus

Page 24: As 400 Basic

o Test display files o Add online help

Menus SDA lets you design menus by using a menu template. CL commands are associated with menu selections. CL commands can

include CALLs to programs. Five entities are created when a menu is designed.

o The screen image stored as DDS source code. o A complied source member with type *FILE . This is the object

written to the display when GO is invokes. o A source physical file containing the CL commands. o A message file also containing these commands as message. o An object with type *MENU

Designing the Menu o After taking option 2 from the SDA menu, you are prompted for

Source file name, library name, & menu name (fig. 11.3) . o After providing this information, the "Specify Menu Functions"

screen appears (fig. 11.4). o The next screen is the menu template (fig. 11.5) o Constants are used on lines 1-20 to label and explain menu

options. Use apostrophes to enclose constant entries. o *DATE, *TIME, *USER, & *SYSNAME can also be added. o Once fields have been entered, attribute bytes (attribute

commands) can be used to change the appearance of the entries.

Specifying Attributes o AC centers the field, or moves the field when "=" is used, or copies

the field when "==" is used. Note: - be careful not to overlap fields! o H = high intensity o R = reverse video o B = blink o U = underline o For Color:

CB - blue CT - turquoise CG - green CW - white CP - pink CY - yellow CR - red

o Fields can be shifted left or right by using "<<<<<" or ">>>>>". o Do not use Insert or Delete to change contents. Delete the constant

and rekey. F5 will undo.

Page 25: As 400 Basic

Setting Field Attributes o You can access a screen of attributes by entering "*".

Using Attribute Commands o In fig. 11.7, note the use of attribute commands to delete items 4-

10. Also note the system data and time entries. o Fig. 11.8 shows screen after enter has been pressed. o Fig. 11.10 shows the current menu configuration.

Defining Menu Commands o Use F10 to "Work with commands". o Fig. 11.11 shows the "Define Menu Commands" screen. o Use CL on the appropriate menu options (see fig. 11.12, 11.13,

11.14, & 11.15).

Exiting SDA Menus o When you are finished, you can exit the SDA Menus (see fig.

11.16).

Display Files Although Menus are easy to construct, Display files are more flexible. Creating a Non-Menu Display Screen

o Take option 1 form SDA menu. o Use appropriate member and library names. o The next screen will be the "Work with Display Records" screen

(fig. 11.18). o You must enter 1 to add a record and supply a record name. o A record in a display file defines some part or all of the screen

image that is controlled by the driving program. o Display files may have one or more record formats and as with a

physical or logical file, each record must have an "R" name entry. Using the Design Image Work Screen

o After selecting "add new record" (fig. 11.19), you will see a mostly blank screen (fig. 11.20) which serves as a blank slate on which to design your display.

o This screen can contain constants, system functions, or data fields. Useful Function Keys

o F1 - Help for SDA o F3 - Exit key o F4 - Prompt o F9 - Select additional records o F10 - Select database fields o F12 - Exit and autosave o F14 - Ruler function o F17 - Print work screen o F18 - Tab to attribute byte

Page 26: As 400 Basic

o F19 - Back-tab to attribute byte o F20 - Toggle reverse image o F21 - Toggle additional records selected by F9.

Manipulating Constants and Fields o Constants on the display screen are manipulated the same way as

menus. Adding Input/Output Data Fields

o Data fields are named so that they can referenced in a program. o Field types must be declared (character or data).

- Character Numeric

Input I 3

Output O 6

Both B 9

o

o Field lengths are determined by number of symbols or repetition factor.

o Note the use of "+" on attribute byte. o To examine finished screens or make changes, use F4 to pull up

the "Work with Fields Screen" (fig. 11.28). Using indicators

o Indicators function as switches, possible values are 1 & 0. o Keys are often associated with indicators. o Indicators are identified by two-digit numbers from 01-99. o Field names can be changes to be more meaningful (fig. 11.32 &

33). o Indicators can be associated with attributes (fig. 11.34), or colors

(fig. 11.36). A Brief Review

o SDA fields can contain constants, data, or system functions. o These fields can be manipulated using appropriate characters. o Field attributes can be changed.

Saving the Display File o F3 exits the screen. o You will be prompted for save options (fig. 11.43).

Testing the Display File o The display file can be tested from the opening SDA menu.

Viewing Members Created o You can go the your library and examine the new files that have

been created.

Lesson 12 - Getting Started with CL Programming - Taunton's Class

Page 27: As 400 Basic

CL Review CL provides a single, consistent, and flexible interface to the manyAS/400

systems. CL features:

o controls all systems functions o uses a single, consistent syntax o can be entered from the command line, placed in a CL program, or

included as part of a batch job.

CL Programs' Use - The majority of CL programs fall into the following categories:

User Interface - CL programs can provide non-technical users with an interactive interface that is simple and easy to use. Users do not have to know the CL language itself.

Operations - CL program can be written and used to perform system "housekeeping" routines that are not built into the system.

Job Attributes - CL program can be used to tailor the users environment after signon.

Advantages of CL Programs CL programs exist as object (type *PGM) and can be executed as such. Some CL commands are only available from within a CL program. CL program can be tested and debugged just as other HLL programs. CL program have the ability to pass parameters to the program they call.

Entering CL Source CL programs are entered as source members of source physical

QCLSRC. Be sure when creating this file (F6 from WRKMBRPDM QCLSRC)that you enter the correct file type (source physical file).

When using the SEU to enter CL commands, each command has its own screen.

Use "I" to insert CL commands. Use F4 to prompt info. Use "Enter" when finished entering CL commands

CL Program Structure - A CL program has the following format or structure and must be entered exactly as specified in this format: (see fig. 12.3)

Program ID - A comment section enclosed within /* comments */. PGM Statement - must be the first actual statement in the program and is

optional. DCLF Statement - Declares a single file to be accessed if it is present. DCL Statements - Used to declare variables. ENDPGM Command - marks the end of a CL program.

Designing the Start-Up Program The screen from lesson 11 is used.

Page 28: As 400 Basic

Assumptions regarding the work environment for the users (students): o Each user has their own library o Each user has their own output queue o there a class library to which the users have access

Listed below are the step needed to create the Start-Up program: o Initialize

Declare the display file Declare a character variable for print message text

o Request Selection Send (write) the display file to the display device Receive (read) the selection (CHOICE) entered by the user

o Process Selection Evaluate CHOICE and if valid

change the library list change the job (output) queue start Work with Objects Using PDM

if invalid turn on an option indicator send (write) the display file to show the error

o Terminate End the program and transfer to the initial menu, or End the program (and the job) by signing off

Entering the Program - This is an introductory CL program. The student is urged in the text to consult other text on this subject in order to gain more expertise in this area if needed.

Declaring a File - (see fig. 12.5) The first parameter, Label, allows a program defined name to be attached to any CL command in the program. The record parameter allows you to specify record format, *ALL is the default. When a program containing a declared file name s complied, all input and output fields, as well as indicators are made available to the program.

Decaring Variables - Variable are declared by the DCL command. The variable types are shown in figure 12.7 in the text.

Changing the Value of a Variable - Variables can be changed from their original values by use of the CHGVAR command. Figure 12.8 shows the syntax for this command.

Selection and Iteration - please see the examples in the book on pages 424, 425, & 426. These control structures are much the same as other HLL's.

File I/O in CL Programs - CL programs can access two types of file; Display files & database files. Once again, when a CL program is complied, all variables in any files included are made available to the program. Besides the DCLF statement, three other statements are available in a CL program to process files:

o SNDF - send a file (as well as a files indicators) to a display device

Page 29: As 400 Basic

o RCVF - reads a file (as well as a files indicators) to from a display device

o SNDRCVF - sends a file and then waits for a response. Sending Messages (and receiving)(see fig. 12.13 through 12.18 for

examples) o SNDMSG - sends a message from within a CL program or

interactively o SNDBRKMSG - sends a message to a workstation queue o SNDPGMMSG - sends a message only from within a CL program

Using Concatenation - this is the joining of two characters or constants. In this case, putting the text of several different message together.

o *CAT - joins two entire variables. o *TCAT - joins while truncating (cutting off) spaces o *BCAT - joins while leaving a space between variables

Finishing the Start-Up Program Please read the line-by-line explanations given in the book on pages 435-

438.

Creating a CL Program The source code for a CL program will be generally maintained as a

member of the source physical file QCLSRC.