Document 7237379

Download Report

Transcript Document 7237379

Week 10
Lesson Overview
• Learn enough about Data File Utility (DFU) to
be able to create permanent DFU programs
and use them to enter data records into a
database file.
• Learn enough about Query/400 to be able to
create various Query/400 reports.
• Learn Enough about Screen Design Aid (SDA)
to create menus.
Mastering the AS/400, Third Edition, author
Jerry Fottral
1
Week 10
Data File Utility (Continued)
• DFU (Data File Utility) provides a convenient, easy
way to change records in and add records to a physical
(or thru a logical) database file without the need to
write an HLL data-entry program.
• DFU is useful for entering and changing test data.
• DFU is a valuable tool for programmers -- it’s another
member of the Application Development ToolSet
(ADTS) team and, with PDM and SEU, is available
on any AS/400 on which program development or
maintenance is done.
Mastering the AS/400, Third Edition, author
Jerry Fottral
2
Week 10
Data File Utility (Continued)
Access DFU by using the STRDFU (Start DFU)
command or choosing option 18, Change using DFU,
on a database *FILE type object from the Work with
Objects Using PDM screen.
If you enter STRDFU command on any command line,
the DFU menu appears; DFU either:
a) Creates and executes a temporary entry/update
program, or
b) Builds and stores a “permanent” update
program that can be called and used again.
Mastering the AS/400, Third Edition, author
Jerry Fottral
3
Week 10
Data File Utility (Continued)
If you execute the STRDFU command, you
can select option 5 from the DFU menu to
update data using a temporary program.
NOTE: Providing a temporary update
program is also the approach the system
takes when you select option 18 on a file
from Work with Objects Using PDM.
Mastering the AS/400, Third Edition, author
Jerry Fottral
4
Week 10
Data File Utility (Continued)
The advantage of a temporary DFU when
working with externally described files is:
You don’t need to specify a screen layout or
field headers or edit and select fields.
DFU generates a default update
program using the record-format fieldlevel attributes and file information
stored in the data-file object.
Mastering the AS/400, Third Edition, author
Jerry Fottral
5
Week 10
Data File Utility (Continued)
The disadvantages of temporary DFU
programs are:
1. Lack of flexibility
2. The machine time required to recreate
the program each time you need it.
Mastering the AS/400, Third Edition, author
Jerry Fottral
6
Week 10
Using a Temporary DFU Program
Selecting option 5 from the DFU menu brings up an
entry screen (DFU Update Data Using Temporary
Program) that requests the name and member of
the file to be updated.
DFU remembers the last time you used a temporary
program and provides that data-file name as a
default value when you start another temporary
DFU program from the menu.
Mastering the AS/400, Third Edition, author
Jerry Fottral
7
Week 10
Using a Temporary DFU Program (Continued)
You might need to type over the old name, replacing
it with the name of the file you want to use.
Press Enter and DFU creates an update program
using the field-level attributes from the file
description of the file being maintained.
Meanwhile, the message “DFU is creating temporary
program QDZTD00001 for you to run” is
displayed on the message line.
Mastering the AS/400, Third Edition, author
Jerry Fottral
8
Week 10
Starting DFU on an Empty File
When you start DFU, using an empty data file,
DFU’s Entry mode is active and displayed in the
update screen’s upper-right corner.
When you’re entering data, either the Field advance
(Tab) or Field exit key moves the cursor to the
next field.
Character data is stored exactly as entered into the
field (if you key leading blanks, the data is stored
that way).
Mastering the AS/400, Third Edition, author
Jerry Fottral
9
Week 10
Starting DFU on an Empty File (Continued)
Numeric data is treated as right-aligned within the
field.
A temporary DFU program doesn’t let you enter any
editing characters (i.e., a decimal point or comma
thousands separator) in a numeric field, and this
restriction applies to dates and times stored as
numbers.
Date and time data (data types L and T) must be
entered using the proper format and separator
characters.
Mastering the AS/400, Third Edition, author
Jerry Fottral
10
Week 10
Starting DFU on an Empty File (Continued)
NOTE: When the last field typed in is numeric and
you do not enter the maximum number of digits,
you must press Field exit or the Tab key to exit the
field before pressing Enter.
When you are ready to write the record to the file,
press Enter key or F10 to save the record (Enter is
easier to reach); the system stores the record and
displays an empty entry screen for the next record.
If after the fact you realize there was an error in the
data, get out of entry mode and into change mode.
Mastering the AS/400, Third Edition, author
Jerry Fottral
11
Week 10
DFU Change Mode
Function key F11 takes you to DFU’s change mode;
for our examples, when you first reach change
mode, the only input field on the screen will be the
one named *RECNBR.
All physical-file records are given a record number
that indicates their order of entry; if you know the
record number of the erroneous record, enter it in
this field and DFU will retrieve it, if it exists, or
use the Page up key to retrieve the last record
entered.
Mastering the AS/400, Third Edition, author
Jerry Fottral
12
Week 10
DFU Change Mode (Continued)
• From any record currently displayed in change
mode, pressing the Page up key takes you to the
next lower record number and pressing Page down
takes you to the next higher record number.
• Once the record has been corrected, continue to
enter new records by returning to entry mode -press function key F10 from change mode.
• To delete (vs. change) a bad record, display the
record in change mode and then press F23, and
then F23 again to confirm.
Mastering the AS/400, Third Edition, author
Jerry Fottral
13
Week 10
DFU Change Mode (Continued)
CAUTION: DFU enables other function keys
besides those shown at the bottom of the screen
but does not show F24=More Keys; however, you
can see the entire list of enabled function keys by
using context-sensitive Help. To take advantage
of this help, move the cursor to any part of the
function-key area and press F1.
Mastering the AS/400, Third Edition, author
Jerry Fottral
14
Week 10
Exiting DFU
• Function key F3 takes you to the End Data Entry
screen.
• The End Data Entry screen reports the number of
record adds, changes, and deletions and asks if
you are finished.
NOTE: If you reach this screen by mistake, return to
the DFU data-entry screen by typing N over the
default value of Y for the screen’s End data entry
prompt.
Mastering the AS/400, Third Edition, author
Jerry Fottral
15
Week 10
Why DFU?
The AS/400’s Data File Utility (DFU) (continued):
• Program code is generated as you respond to a series
of DFU entry screens
• Is a handy tool for programmers who need to build or
change test data files
• Can save time over HLL application development for
end users with fairly straightforward data-entry or fileupdate needs
Mastering the AS/400, Third Edition, author
Jerry Fottral
16
Week 10
Why DFU? (Continued)
If your application requires any of the following,
you’ll need to write an HLL program or use a
more powerful utility:
• Creating derived (virtual) fields for display by
performing calculations on other fields
• Field validation that requires testing the value of
another field in the same record (e.g.,
HIREDATE>BIRTHDATE
Mastering the AS/400, Third Edition, author
Jerry Fottral
17
Week 10
Accessing DFU
Enter the STRDFU (Start DFU) command on any
command line.
Option 5 on the initial menu (Update data using
temporary program) creates a temporary DFU.
Option 2 (Create a DFU program) lets you create a
permanent DFU.
Option 3 lets you change an existing DFU program.
Option 4 lets you delete a permanent DFU program.
Mastering the AS/400, Third Edition, author
Jerry Fottral
18
Week 10
Creating a DFU Program
Option 2 from the DFU menu takes you to the
“Create a DFU Program” screen.
Name the program you’ll create, the library in which
the program will reside, and the data file the
program will use.
NOTE: The Library value for the Program parameter
defaults to *CURLIB the first time you use
option 2; after that, DFU uses the value from the
previously created program.
Mastering the AS/400, Third Edition, author
Jerry Fottral
19
Week 10
Creating a DFU Program (Continued)
The data file value will be blank (first time) or
display previously used Data file name; if blank,
the Library value defaults to *LIBL.
With Program and Data file fields, use function key
F4 to prompt for a list of existing programs or for
a list of all physical and logical files in the
specified library.
Prompting requires a specific library reference
(*LIBL won’t work).
Mastering the AS/400, Third Edition, author
Jerry Fottral
20
Week 10
Creating a DFU Program (Continued)
NOTE: Attempting to select a Join file would
result in an error because DFU does not
permit the use of join logical files.
When you select a file from a prompt list, the
list values – Data files and *CURLIB for
Library -- are filled in on the Create a DFU
Program screen.
Mastering the AS/400, Third Edition, author
Jerry Fottral
21
Week 10
Defining General Information
When you press Enter from a completed Create a
DFU Program screen, the next screen depends on
the type of data file you named.
If the specified file is a nonindexed file, you get the
Define General Information/Nonindexed File
screen.
For an indexed file (a file with a keyed-sequence
access path), the display differs.
Mastering the AS/400, Third Edition, author
Jerry Fottral
22
Week 10
Defining General Information (Continued)
Available options common to nonindexed AND indexed
files (please reference the table for brief descriptions
of each option listed below):
– Job title
– Display format
– Audit report
– S/36 style
– Suppress errors
– Edit numerics
– Allow updates on roll
Mastering the AS/400, Third Edition, author
Jerry Fottral
23
Week 10
Defining General Information (Continued)
Options specific to nonindexed files are (refer to
table for brief descriptions of each):
•
•
•
•
Generate (record numbers)
Store in a field
Heading
Processing
If an indexed file were specified for use by our DFU
program, we would see a Define General
Information/Indexed File screen, which offers
options for the indexed file’s keys.
Mastering the AS/400, Third Edition, author
Jerry Fottral
24
Week 10
Defining General Information (Continued)
The two options are:
Generate: Enter Y if you want DFU to generate
numeric keys in multiples of 10 for records added
to the file; if the key field is a data field, take the
default N.
Changes allowed: Y permits the value of a data key
field to be changed when the DFU is in change
mode; when keys should not be changed, use N.
Mastering the AS/400, Third Edition, author
Jerry Fottral
25
Week 10
Defining General Information (Continued)
For a single-column format selected, if all fields fit into
one column, the screen will be formatted as single
column even if Multiple or Maximum had been the
chosen format.
You can enter a Job title to clearly define the purpose and
have chosen to print an audit report, selected edit
numerics, allowed updates on a roll, and changed the
record number heading -- the DFU program will
process the file sequentially, with new records added
to the end of the file.
Mastering the AS/400, Third Edition, author
Jerry Fottral
26
Week 10
Defining Audit Control and
Choosing Record Formats
After pressing Enter on the Define General
Information/Nonindexed File screen, we get Define
Audit Control screen because we chose to print an
audit report.
You can use this screen to change report width, spacing,
and even the types of transactions to be printed.
The Work with Record Formats screen is next.
For a single record format, you can tell DFU to select
fields using that format by typing option 2 next to the
format name.
Mastering the AS/400, Third Edition, author
Jerry Fottral
27
Week 10
Selecting and Sequencing Fields
From the Select and Sequence Fields screen, choose
which fields to include on the DFU Update display
by assigning them a sequence number (those not
given a number will not appear). The relative
magnitude of the sequence numbers determines
the ordering of fields on the DFU Update display
screen, with the lowest-numbered field occupying
the top (or leftmost position) of the field list.
Mastering the AS/400, Third Edition, author
Jerry Fottral
28
Week 10
Selecting and Sequencing Fields (Continued)
Press F21 to select all fields.
Decide whether to use extended field
definitions or special features, such as autoduplicate, for any fields.
Press F17 (Fast path) to go directly to DFU
exit screen if no special features are chosen.
Press Enter to use special features.
Mastering the AS/400, Third Edition, author
Jerry Fottral
29
Week 10
Specifying Extended Field Definitions
Press Enter and the Work with Fields screen appears;
this screen lists all the fields and lets you specify
or delete extended definitions.
Value N or Y under the Extended Definition column
tells you whether an active extended definition
currently exists for a field.
Under Heading you can change the field
identification that will appear on the DFU
Change/Display screen.
Mastering the AS/400, Third Edition, author
Jerry Fottral
30
Week 10
Specifying Extended Field Definitions
(Continued)
Specify Extended Field Definition screen has these
options for a numeric field:
• Auto-duplicate
• Accumulate
• Extended field heading
• Initial value (to specify starting value)
• Auto-increment
• Validity checks
Mastering the AS/400, Third Edition, author
Jerry Fottral
31
Week 10
Specifying Extended Field Definitions
(Continued)
Second page of Specify Extended Field
Definition screen:
First three options let you place the field at the
beginning of a new line, require Field exit, and
select a field that should be viewed only and
not changed.
The Non-display option lets you hide a sensitive
field.
Mastering the AS/400, Third Edition, author
Jerry Fottral
32
Week 10
Specifying Extended Field Definitions
(Continued)
Second page of Specify Extended Field Definition
screen (continued):
You can specify spacing or use default spacing, and you
can choose an edit code or edit word for numeric
fields.
When Edit numerics has been set to Y on the Define
General Information screen, these edit codes work in
entry mode; otherwise, editing is not used.
Mastering the AS/400, Third Edition, author
Jerry Fottral
33
Week 10
Specifying Extended Field Definitions
(Continued)
Codes permit different combinations of four editing
variables:
• Whether commas are used to separate hundred
thousands, thousands, etc.
• Whether decimal points are printed for non-integer
numbers
More...
Mastering the AS/400, Third Edition, author
Jerry Fottral
34
Week 10
Specifying Extended Field Definitions
(Continued)
• How a negative value is shown:
–
–
–
–
NS
RCR
-F
no sign
minus sign to the right
CR to the right
minus sign to the left (floats to first digit)
• Whether a zero value is displayed (0 for integers
or .00 for decimals) or is replaced with all spaces.
Mastering the AS/400, Third Edition, author
Jerry Fottral
35
Week 10
Specifying Extended Field Definitions
(Continued)
Predefined edit codes and values for variables:
Decimal
Negative
Code
Commas Point
Value
(blank)
No
No
NS
1
Yes
Yes
NS
2
Yes
Yes
NS
3
No
Yes
NS
4
No
Yes
NS
A
Yes
Yes
CR
B
Yes
Yes
CR
C
No
Yes
CR
D
No
Yes
CR
J
Yes
Yes
R–
K
Yes
Yes
R–
L
No
Yes
R–
M
No
Yes
R–
N
Yes
Yes
–F
O
Yes
Yes
–F
P
No
Yes
–F
Q
No
Yes
–F
Y
No
No
NS
Zero
Value
0 all positions
0
0
0
0
0
0
0
0
0/00/00
Mastering the AS/400, Third Edition, author
Jerry Fottral
36
Week 10
Specifying Extended Field Definitions
(Continued)
Predefined edit codes and values (continued):
The main difference among the groups of Codes 1-4,
A-D, J-M and N-Q lies in how they handle
negative values; otherwise, comma insertion and
print zero value patterns repeat from group to
group.
Y code is used to edit numeric integer fields whose
values are dates -- it inserts slashes between
month, day, and year values.
Mastering the AS/400, Third Edition, author
Jerry Fottral
37
Week 10
Specifying Extended Field Definitions
(Continued)
Specify Validity Checks screen offers several ways
to check the validity of numeric fields.
Mandatory entry: A value must be entered when the
DFU program is in entry or insert mode -- select
this option for any field that requires a value.
Mastering the AS/400, Third Edition, author
Jerry Fottral
38
Week 10
Specifying Extended Field Definitions
(Continued)
Mandatory fill requires all positions of a field to be
entered, and the next two options check for valid selfchecking numbers using either of two popular selfchecking number algorithms, Modulus 10 and
Modulus 11.
Relational operator and List of values provide for
comparing the contents of a field against a single
value, a range of values, or a list of up to 20 values.
(Any value entered in the field must test true for it to
be accepted on input; if an invalid value is entered,
DFU displays an error message and rejects the change
or addition until a valid value is entered).
Mastering the AS/400, Third Edition, author
Jerry Fottral
39
Week 10
Specifying Extended Field Definitions
(Continued)
After completing the extended definition for fields,
the changed Work with Fields screen appears.
You can always take option 2 again if necessary to
change a field’s extended definition.
NOTE: There are differences between a screen for a
numeric field and a screen for a character field. If
the data entered for a field will contain lowercase
characters, set the Allow lowercase option to Y.
Validity checks are permitted for non-numeric fields,
but with some differences from numeric fields.
Mastering the AS/400, Third Edition, author
Jerry Fottral
40
Week 10
Specifying Extended Field Definitions
(Continued)
Y for Name check means the field must
contain a valid AS/400-style name.
Extended name check option permits
lowercase a-z, but converts characters to
upper case in the record unless the user
encloses the entire name within double
quotation marks. Both options are mutually
exclusive, and neither can be used with
range or list-of-values checks.
Mastering the AS/400, Third Edition, author
Jerry Fottral
41
Week 10
Specifying Extended Field Definitions
(Continued)
After extended field definitions have been
taken, select other fields from the Work
with Fields screen for extended definitions.
Additional field definitions would be required
for other fields, too.
Mastering the AS/400, Third Edition, author
Jerry Fottral
42
Week 10
Editing DFU
After completing all Work with Fields
specifications, save the DFU by pressing
Enter. The Exit DFU Program Definition
screen appears. Check to be sure you get
what you wanted:
Save program…Y If you changed this value,
all your work would be lost.
Mastering the AS/400, Third Edition, author
Jerry Fottral
43
Week 10
Editing DFU (Continued)
Run program...Y You normally need to test your
program to make sure it is working as you planned, or
you may need it to update a data file right away.
Type of run…1 Run type 1 (Change) lets updates,
deletions, and additions be made to the data file;
type 2 (Display) allows display only, requiring only
data read authority to the file.
Mastering the AS/400, Third Edition, author
Jerry Fottral
44
Week 10
Editing DFU (Continued)
Modify program…N This DFU is brand new; if you had
just changed an existing DFU, you would specify Y.
Save DDS source…N If you planned to change the
DFU screen layouts directly through the DDS, you
would need to select Y here; otherwise, saving the
DDS is unnecessary.
Additional parameters use the information supplied upon
entry to name the new DFU program, including
library name and specified text.
Mastering the AS/400, Third Edition, author
Jerry Fottral
45
Week 10
Editing DFU (Continued)
When we take the defaults and press Enter, we see a
message at the bottom of the screen telling us that the
DFU program is being saved. Then the Change a Data
File screen appears because the DFU program is about
to be run.
A message at the bottom of this screen tells us that the
DFU program was saved successfully.
Press Enter to get the DFU work screen, where we see
that the job title appears in the upper-left corner and
field headings reflect change made earlier in our
example.
Mastering the AS/400, Third Edition, author
Jerry Fottral
46
Week 10
Editing DFU (Continued)
If we enter a relative record number, press Field exit, and
then Enter, the record will be displayed. It will show
blanks for WORKPHONE, the field we added (in
fact, it contains default value 0, placed there by the
CPYF command, but with the edit word we chose for
these fields, zero values are displayed as blanks).
Edit words and codes selected when the DFU was
created are used to format the data when it is
displayed or printed.
We do not need to type edit characters when we input or
change data.
Mastering the AS/400, Third Edition, author
Jerry Fottral
47
Week 10
Editing DFU (Continued)
To enter a new record using the DFU program, press F9
on the screen to get an entry screen in insert mode;
when this is saved successfully, DFU displays the
message “The record was added to the end of the file”
at the bottom of the screen.
Press F3 (to exit) to get the normal DFU End Data Entry
screen; press Enter again to see the Display Batch
Accumulators screen; Press Enter to get the Display
Total Accumulators screen.
Mastering the AS/400, Third Edition, author
Jerry Fottral
48
Week 10
Editing DFU (Continued)
Summary:
• DFU is quick and flexible for creating interactive
update or file-maintenance programs for physical or
logical files.
• DFU generates its own program logic and creates
display files using information supplied by the
externally described file object and information you
supply in extended field definitions.
• DFU is most useful for simple applications that don’t
require extensive data validation or special screen
formatting.
Mastering the AS/400, Third Edition, author
Jerry Fottral
49
Week 10
What Query/400 Does
Query/400 -- menu-driven, widely used, easy to learn -- is an IBMlicensed program product on the AS/400 that provides a database management feature called report generator, or query
utility.
Use Query/400 to:
• Obtain information on the AS/400 from any externally described
database file, be it from DDS, IDDU, or SQL.
• Generate printed reports, screen displays, or new database files
using data from one file or joining data from up to 32 different
files -- and select from one to all fields and organize them into a
printed report, display, or new database file
Mastering the AS/400, Third Edition, author
Jerry Fottral
50
Week 10
What Query/400 Does (Continued)
• Selection and arrangement of records -- You can use
simple relational expressions to select specific records
from files and then order those records in ascending or
descending sequence by using any field or
combination of fields as sort keys. For example, you
could sort all records in an employee file by employee
name within department.
Mastering the AS/400, Third Edition, author
Jerry Fottral
51
Week 10
What Query/400 Does (Continued)
• Selection and placement of fields -- You can choose
specific fields to display or print, and you can place
the fields in any desired order. You can edit the fields - for example, insert slashes (/) in a numeric date field
for readability -- or perform arithmetic or string
operations on the fields to create new result fields. In
addition, you can easily adjust column widths and
change column headings.
Mastering the AS/400, Third Edition, author
Jerry Fottral
52
Week 10
What Query/400 Does (Continued)
• Specification of report breaks -- You can print or display
groups of records sorted by the values of designated sortcontrol fields. This feature, called control-break logic, lets
you select control fields to be used on up to six levels of
report breaks (e.g., department within section within
division). You can also choose column functions for
desired fields. These functions let you print automatic
calculations, such as total and average, when the value of a
sort-control field changes. For example, after listing all
employees in the same department, you could print a count
of employees and the total salary for the department if the
employee file is sorted by department.
Mastering the AS/400, Third Edition, author
Jerry Fottral
53
Week 10
What Query/400 Does (Continued)
• Ability to examine a report layout and preview a
report -- At any time while specifying a query, you
can use function key F13 to display a layout of the
query output as it might appear on a printer spacing
chart. You can also test the query to see what the
report will look like with actual data by using function
key F5. You then can make any necessary changes to
your query without having to exit Query/400.
Mastering the AS/400, Third Edition, author
Jerry Fottral
54
Week 10
What Query/400 Does (Continued)
• Execution of query programs -- Although a complete,
saved query specification is not a program in the sense
of object type -- a query’s object type is *QRYDFN, not
*PGM -- you can run a query just as you would a
program by using option 16 on a *QRYDFN object from
the Work with Objects Using PDM screen or by entering
the RUNQRY (Run Query) command on any command
line. When a query is run, it uses the current data from
the selected file (or files) in the same way a program
written in a high-level language (e.g., Cobol, RPG)
would when the program is executed.
Mastering the AS/400, Third Edition, author
Jerry Fottral
55
Week 10
Getting into Query/400
• STRQRY (Start Query) command takes you to the Query
Utilities menu which provides a list of query functions.
You can also reach it by using the GO command (GO
QUERY).
• From the Query Utilities menu, Option 1 takes you to the
Work with Queries screen.
• From the Programming Development Manager (PDM)
environment, you can perform two options: Run an
existing query and Delete a query, by taking option 16 or 4
on the appropriate *QRYDFN list item.
Mastering the AS/400, Third Edition, author
Jerry Fottral
56
Week 10
Getting into Query/400 (Continued)
The Work with Queries screen can also be
reached (and bypass the Query Utilities
screen) by executing the WRKQRY (Work
with Queries) command or by selecting
PDM’s Work with option (12) for any
*QRYDFN object.
Mastering the AS/400, Third Edition, author
Jerry Fottral
57
Week 10
Working with Queries
From the Work with Queries screen, you can:
 Create a query
 Change, copy, delete, or display an existing query
 Print a query definition
 Run a query either as a batch job or interactively
Mastering the AS/400, Third Edition, author
Jerry Fottral
58
Week 10
Working with Queries (Continued)
• Create a new query: Take option 1, Create
• Name the query: Name when you take option 1 or
wait until the query definition is completed
NOTE: Other options on the Work with Queries
screen work only with existing queries.
To get name of an existing query: Place cursor on
Query input field and press F4 to view a list of
existing query definitions in the selected library.
Mastering the AS/400, Third Edition, author
Jerry Fottral
59
Week 10
Working with Queries (Continued)
The first time you use Query/400, the library displayed is
your current library; after that, WRKQRY returns you
to the library you were using on the previous occasion.
You can move the cursor down the list and type the
option you want next to the query to be used; if the
query you want is not in the list, change the Library
value specified at the top of the screen and press Enter
to see a new list.
Mastering the AS/400, Third Edition, author
Jerry Fottral
60
Week 10
Defining a Query
• When you type 1 in the option field of the Work with Queries
screen and press Enter, the main query specification screen,
Define the Query, appears.
• This screen presents available query features you can use to
create a customized query.
• Select one, and Query/400 will prompt you through a series of
related lower-level screens to define how you want the feature to
work for the report (most menu-driven, but some features
require you to reorder list items or enter expressions or
functions). Then, return to the Define the Query screen and
select the next feature or Exit and save.
Mastering the AS/400, Third Edition, author
Jerry Fottral
61
Week 10
Selecting Files
• When the Define the Query screen appears, the Specify file
selections option is selected automatically because, at the
least, you must tell Query/400 which file to use.
• Press Enter from the Define the Query screen to get the
Specify File Selections screen.
• From the Specify File Selection screen, you can prompt to
see a list of physical and logical database files in your
library (the initial default) or in another library to which
you’re authorized.
• Pressing F4 on the File name input field takes you to the
Select File screen.
Mastering the AS/400, Third Edition, author
Jerry Fottral
62
Week 10
Selecting Files (Continued)
When you press Enter on the Select File screen,
Query/400:
• fills in the File name field
• asks you to confirm the file name
• returns you to the Define the Query screen
Mastering the AS/400, Third Edition, author
Jerry Fottral
63
Week 10
Selecting Files (Continued)
The Define the Query screen displays a greater-than
symbol (>) to the right of the Option field
(replacing the 1 on the Specify file selections
line).
NOTE: You can always go back and change the
values you specified for any feature by taking
option 1 on it again.
Mastering the AS/400, Third Edition, author
Jerry Fottral
64
Week 10
Previewing a Query Layout
You can see how the query is formatted by pressing F13
from the Define the Query screen.
To see additional columns of the report, press F20 to
shift the view right.
NOTE: Field names are used as column headers, spaces
are inserted between columns, and numeric fields are
edited with commas to separate thousands.
Mastering the AS/400, Third Edition, author
Jerry Fottral
65
Week 10
Previewing a Query Layout (Continued)
• Should you wish to change the way the
numeric fields were edited, you must first
press Enter or F12 to return to the Define
the Query screen. There, select the Specify
report column formatting option.
Mastering the AS/400, Third Edition, author
Jerry Fottral
66
Week 10
Formatting Report Columns
The Specify Report Column Formatting
screen displays three fields at a time and
lets you change:
Column spacing
Column headings
Field length
Mastering the AS/400, Third Edition, author
Jerry Fottral
67
Week 10
Formatting Report Columns (Continued)
CAUTION: If you make a field’s length on the Specify
Report Column Formatting screen shorter than the
actual database field, you could lose data in the report.
Mastering the AS/400, Third Edition, author
Jerry Fottral
68
Week 10
Formatting Report Columns (Continued)
To edit a field, move the cursor to
anywhere in the horizontal zone for a
field and press F16.
Define Numeric Field Editing screen
comes up, and it identifies the field; it
displays its column headings, length, and
sample of how the field would appear
when printed.
Mastering the AS/400, Third Edition, author
Jerry Fottral
69
Week 10
Editing Options
Note that commas are used as separators. To
eliminate the commas, use the default Edit option
1, Numeric editing choices.
The Describe Numeric Field Editing screen comes
up, and here you can change the Thousands
separator value from a comma to None by typing a
5 over the 2 (the default).
NOTE: Other options have to do with the display of
the negative sign, currency symbol, and leading
zeros.
Mastering the AS/400, Third Edition, author
Jerry Fottral
70
Week 10
Editing Options (Continued)
When you change a value on an entry screen such as the
Describe Numeric Field Editing screen, press the
Enter key to save changes rather than F12 (F12 does
not save your changes).
NOTE: F3 saves changes, but it takes you to the query
exit screen -- so use F3 if this is what you need.
Pressing Enter on the Describe Numeric Field Editing
screen returns you to the Specify Report Column
Formatting screen.
Mastering the AS/400, Third Edition, author
Jerry Fottral
71
Week 10
Editing Options (Continued)
On the Specify Report Column Formatting screen,
note that an asterisk (*) appears under the Edit
column for the field which is to remind you that
the field has been edited.
Should you wish to change a field to separate the
parts of the number with blanks (spaces), press
F16 again with the cursor in the field’s horizontal
zone to return to the Define Numeric Field Editing
screen.
Mastering the AS/400, Third Edition, author
Jerry Fottral
72
Week 10
Editing Options (Continued)
To use blanks as separators, create an edit word by
using option 4 -- only one edit choice, code, or
word can be active for a field at any time. NOTE:
By creating an edit word for a field, you will
override the numeric edit choice (remove comma
thousands separator) that you made previously.
The Specify Edit Word screen appears.
Mastering the AS/400, Third Edition, author
Jerry Fottral
73
Week 10
Editing Options (Continued)
• The apostrophes (‘) delimit the edit word, and initially the
number of blanks (spaces) within the apostrophes is equal
to the number of digits in the field
• As the display indicates, each digit is represented by a
blank -- to insert an actual blank (spacebar) into the edited
field, use the ampersand character (&)
• If you wanted to use other edit characters (hyphens or
slashes), you would insert those characters into the edit
word where you need them to appear in the edited field
Mastering the AS/400, Third Edition, author
Jerry Fottral
74
Week 10
Editing Options (Continued)
Specify Edit Word with Edit Characters
Entered:
If the number of spaces within the
apostrophes differs from the specified
length, Query/400 considers it an error and
puts the quoted string in reverse image until
you fix it AND Query/400 displays an error
message.
Mastering the AS/400, Third Edition, author
Jerry Fottral
75
Week 10
Editing Options (Continued)
Pressing Enter returns you to the Specify Report
Column Formatting screen.
Try the Layout function again and see the effect your
edit word had.
The Display Report Layout screen sample indicates
the blank insertion was successful.
Using another edit word, you could format a field to
eliminate the comma thousands separator and
insert a hyphen.
Mastering the AS/400, Third Edition, author
Jerry Fottral
76
Week 10
Editing Options (Continued)
When you use an edit word, it is not necessary to
first change numeric editing choices because all
default editing options are turned off automatically
if you select an edit code or create an edit word.
Mastering the AS/400, Third Edition, author
Jerry Fottral
77
Week 10
Editing Numeric Date and Time Fields
Query/400 edits older database files’ date or time
data as numeric zoned or packed-decimal fields.
An easy way to insert slashes, hyphens, or colons (:)
in date and time fields is to use another option on
the Define Numeric Field Editing screen: option
2, Date or time editing choice, which takes you to
the Describe Date/Time Field Editing screen.
Mastering the AS/400, Third Edition, author
Jerry Fottral
78
Week 10
Editing Numeric Date and Time Fields
(Continued)
NOTE:
When a date field is defined as data type L,
insertion characters determined by the date
format (*ISO uses hyphens) are already part
of the field, so no further editing is needed.
Query/400 does not permit editing of L-type
fields.
Mastering the AS/400, Third Edition, author
Jerry Fottral
79
Week 10
Selecting Sort Fields
Press Enter from the Define the Query Screen
and get the Selected Sort Fields screen.
You can select up to 32 different sort-key fields
(though it’s uncommon to use more than three
or four).
To specify a sort key, assign a number to the
field in the Sort Prty (sort priority) column.
Lower numbers have higher priority.
Mastering the AS/400, Third Edition, author
Jerry Fottral
80
Week 10
Selecting Sort Fields (Continued)
To list names, for example, starting with Z instead of
A, enter a D for Descending in the A/D column.
Press Enter and Query/400 will ask you to confirm
your choices.
You could make adjustments from this Confirm
Request for Select Sort Fields screen.
Mastering the AS/400, Third Edition, author
Jerry Fottral
81
Week 10
Defining Report Breaks
Because we selected Define report breaks in
our sample, Query/400 takes us to that
screen.
Sort fields and control breaks are directly
related.
Mastering the AS/400, Third Edition, author
Jerry Fottral
82
Week 10
Defining Report Breaks (Continued)
Query/400 automatically assigns break level 0 to final totals -- you
could assign up to six more break levels. Remember: the lower
the number, the more inclusive the break level.
NOTE: Sort priority is provided for your information only and is
not an input-enabled field on the Define Report breaks screen.
Press enter to get the Format Report Break screen.
Mastering the AS/400, Third Edition, author
Jerry Fottral
83
Week 10
Defining Report Breaks (Continued)
At the Format Report Break -- Level 1 screen, leave the
first two input fields, and leave the default values of N
for Skip to a new page and Suppress summaries.
To include the break-control-field value on the subtotal
line, ask Query/400 to substitute the actual field value
by using the field name prefixed with an ampersand as
part of the break text.
Press Enter to return you to the Define the Query screen.
Mastering the AS/400, Third Edition, author
Jerry Fottral
84
Week 10
Selecting and Sequencing Fields
On the Select and Sequence Fields screen,
select fields to include in the query by
giving them a number.
The left-to-right order of the fields across the
report depends on the relative magnitude of
the number, with the leftmost being the
lowest.
Mastering the AS/400, Third Edition, author
Jerry Fottral
85
Week 10
Selecting and Sequencing Fields (Continued)
Ordering Fields for a Query Report:
Assign numbers in any increment as long as they are in the
relative order corresponding to their desired position.
A field not needed in the report is left without a number (but
such a field can be included later by giving it a number).
Press Enter and you will be asked to confirm the sequenced
list of fields; pressing Enter again does that and returns you
to the Define the Query screen.
But, to verify accuracy of the report, run the query to show
how the report will look at this point.
Mastering the AS/400, Third Edition, author
Jerry Fottral
86
Week 10
Selecting and Sequencing Fields (Continued)
To preview Query Report Format:
Check to see that all selected fields are
present and in the correct order. If a report
line is too wide for all fields to be displayed
at once, press F20 to shift the view to the
right side.
Mastering the AS/400, Third Edition, author
Jerry Fottral
87
Week 10
More Report Column Formatting
You can return to any feature as often as
necessary by typing 1 on its option field and
pressing Enter. The option is used to return
to the Specify Report Column Formatting
screen again.
Now you can display more meaningful
column headers.
Mastering the AS/400, Third Edition, author
Jerry Fottral
88
Week 10
More Report Column Formatting (Continued)
• To change column headings: type over or
blank out the default field name column
heading that is displayed.
• To change column spacing from defaults of
0 for the first field and 2 for each
subsequent field, simply type a different
value over the default.
Mastering the AS/400, Third Edition, author
Jerry Fottral
89
Week 10
More Report Column Formatting (Continued)
• If a column heading is wider than the
associated data field, Query/400 adjusts the
column width to avoid truncating any part
of the heading, so consider stacking
headings on the three lines provided on the
Specify Report Column Formatting screen
rather than using all 20 print positions
allowed per column
Mastering the AS/400, Third Edition, author
Jerry Fottral
90
Week 10
More Report Column Formatting (Continued)
• If a character report column is narrower than the
actual number of characters stored in a record, the
excess rightmost characters are truncated in the
query output -- but the query can still be run.
• When you change numeric specifications, it is
convenient to tab or field-advance to the desired
field, type in the new value, and then use the Field
exit key to erase the old value.
• To see your changes, press F13 or F5 -- and
always remember to press Enter to save changes.
Mastering the AS/400, Third Edition, author
Jerry Fottral
91
Week 10
Report Summary Functions
Select report summary functions from the
Define the Query screen .
From this screen, you can add summary
information to the control-break total lines
by selecting up to five different functions
per field.
Mastering the AS/400, Third Edition, author
Jerry Fottral
92
Week 10
Report Summary Functions (Continued)
Report Summary Functions defined by Options:
• 1 and 2 (Total and Average) -- with numeric fields
only
• 3 -- Minimum
• 4 -- Maximum
• 5 -- Count
NOTE: It does not matter which of the five option input
fields you use for a report field or in which order you enter
multiple options.
Mastering the AS/400, Third Edition, author
Jerry Fottral
93
Week 10
Defining Result Fields
Result fields (derived columns) are created by
performing certain operations on data
already contained in one or more fields of
each record.
Operation types:
• String operations (concatenate and
substring) can be performed on
alphanumeric (character) fields.
Mastering the AS/400, Third Edition, author
Jerry Fottral
94
Week 10
Defining Result Fields (Continued)
Operation types (continued):
• Concatenate ( ) puts two character fields
(or subfields) together to form a new field
with a new name
• Substring creates a new field from part of
an existing field,
Mastering the AS/400, Third Edition, author
Jerry Fottral
95
Week 10
Defining Result Fields (Continued)
For numeric fields, you can use an almost
infinite combination of numeric expressions
to create new columns; these expressions
consist of numeric field names and/or
constants combined with the arithmetic
operators for addition, subtraction,
multiplication, and division (+, -, *, /,
respectively).
Mastering the AS/400, Third Edition, author
Jerry Fottral
96
Week 10
Defining Result Fields (Continued)
Take the option on the Define the Query
screen to get the Define Result Fields
screen.
In this screen’s Field column, you name the
new field being defined, then key the
expression used to derive the new field’s
value.
Mastering the AS/400, Third Edition, author
Jerry Fottral
97
Week 10
Defining Result Fields (Continued)
You can provide a column heading if you do
not want the field name used as a heading.
Length (Len) and decimal-position (Dec)
entries are often used to shorten the size of a
calculated numeric result, including date
and time duration.
NOTE: Query/400 determines the length of
any string (alphanumeric) expression.
Mastering the AS/400, Third Edition, author
Jerry Fottral
98
Week 10
Defining Result Fields (Continued)
To understand how date arithmetic works, think of
the numeric value of any date field as the number
of days since the beginning of the calendar,
January 1 of 1 AD, or 0001-01-01 in *ISO format.
When the year function converts into years, no
rounding is done and no fraction of a year is
calculated.
NOTE: For available functions for creating
expressions and some examples, request extended
Help from the Define Results Fields screen.
Mastering the AS/400, Third Edition, author
Jerry Fottral
99
Week 10
Finishing the Report
When you create a result field and have
already selected report fields, return to the
Select and Sequence Fields screen to add
the new field to the report.
To calculate a result field return to the Select
Report Summary Functions screen and
select Average function for the new field.
Mastering the AS/400, Third Edition, author
Jerry Fottral
100
Week 10
Exiting Query
Save and exit. Notice that when a query
sends its output to a display device, it adds
line numbers as a leftmost column, and
these line numbers are not included in
printed output or database-file output.
From Define the Query screen, press F3 to get
to the Exit this Query screen.
Mastering the AS/400, Third Edition, author
Jerry Fottral
101
Week 10
Exiting Query (Continued)
Exit this Query screen (continued):
For a new query, the Save definition option is
set to Y and the Run option is set to 1.
When you save a query definition, give it a
name if it has not been given one already and add
some descriptive text.
Last, press Enter to save the definition and run
the query (this returns you to the Work with
Queries screen).
Mastering the AS/400, Third Edition, author
Jerry Fottral
102
Week 10
What SDA Does
For filling in options from screens or entering data into
input fields to change or add database records, end
users would work with a display screen created as a
display file. Display files are objects whose type is
*FILE and whose attribute is DSPF.
The main difference between a menu and a non-menu
display file is that a menu always has a numbered list
of actions to be taken, and behind each action is a
single CL command or program to implement the
action.
Mastering the AS/400, Third Edition, author
Jerry Fottral
103
Week 10
What SDA Does (Continued)
These actions and their associated commands
are created together, most conveniently
using Screen Design Aid (SDA).
Once a menu exists, you can make it work by
using the GO command -- you don’t need a
CL or high-level language (HLL) program.
Mastering the AS/400, Third Edition, author
Jerry Fottral
104
Week 10
What SDA Does (Continued)
A non-menu display file is only a screen
image and pathway for moving data and
indicators between the screen and the
program that controls it; a non-menu
display file requires a CL or HLL program
to make it appear on the display device and
to control and monitor the movement of
data between it and the program.
Mastering the AS/400, Third Edition, author
Jerry Fottral
105
Week 10
What SDA Does (Continued)
Both menus and display files are created by compiling
the Data Description Specifications (DDS) source
members that describe them, a process similar to
creating database files from physical- and logical-file
DDS source members.
The DDS syntax for DSPF type members is different and
often more involved than for database physical-file
and logical-file member types.
Mastering the AS/400, Third Edition, author
Jerry Fottral
106
Week 10
What SDA Does (Continued)
SDA facilitates the creation of menus and display files
by providing a combination of fill-in-the-prompt and
blank-screen work environments. By taking different
combinations of options from the prompts and
arranging constants and input/output fields on the
blank screen, you define what the menu or display-file
screen will look like and how it will be used.
With SDA, you can create sophisticated screen designs
and menus without dealing directly with DDS; SDA
generates the DDS source code as you design the
screen or menu.
Mastering the AS/400, Third Edition, author
Jerry Fottral
107
Week 10
What SDA Does (Continued)
Throughout this menu/screen-design process, SDA
constantly checks for, and discourages, entries that
would result in DDS syntax errors.
NOTE: Whether you are using SDA to design a menu or
a display-file screen, the successful completion of the
process results in DDS specifications that are stored as
a member of a source physical file -- by convention,
QDDSSRC.
Mastering the AS/400, Third Edition, author
Jerry Fottral
108
Week 10
What SDA Does (Continued)
Source members for menus and display-file screens are
similar to source members for physical and logical
database-file descriptions in the sense that all types are
coded in DDS and stored in a source physical file
(QDDSSRC).
Mastering the AS/400, Third Edition, author
Jerry Fottral
109
Week 10
Getting Started with SDA
You invoke SDA when you enter the STRSDA (Start
Screen Design Aid) command on any command
line.
If you need to change an existing menu or non-menu
display file using SDA, use option 17 from the
Work with Members Using PDM screen for a
shortcut.
Mastering the AS/400, Third Edition, author
Jerry Fottral
110
Week 10
Getting Started with SDA (Continued)
The initial SDA screen displays the choices for designing
screens, designing menus, and testing display files.
The screens referred to under option 1 on this menu are
non-menu display files.
SDA also lets you create online Help information for
screens or menus and, because you create the online
Help during the screen- or menu-design process,
creating online Help is not provided as a separate
menu option.
Mastering the AS/400, Third Edition, author
Jerry Fottral
111
Week 10
Getting Started with SDA (Continued)
SDA’s four distinct functions are:
Design screens
Design menus
Test display files
Add online Help to screens/menus
Mastering the AS/400, Third Edition, author
Jerry Fottral
112
Week 10
Menus
With SDA, you can create menus that look and act
like the system menus.
SDA provides a menu template you can modify.
Associate a single CL command with each menu
selection; the command is executed when the user
makes the selection -- it could be a CALL
command to execute a program written in CL or
an HLL, and that program could consist of
thousands of other commands.
Mastering the AS/400, Third Edition, author
Jerry Fottral
113
Week 10
Menus (Continued)
When you use SDA to design a menu, five
different entities are created automatically
Save the menu source members -- SDA
cannot create the objects without them.
If you ever need to change/expand the original
menu design, the source members must be
available for SDA to use.
Mastering the AS/400, Third Edition, author
Jerry Fottral
114
Week 10
Designing the Menu
After you take option 2, Design menus, from the
initial SDA screen, the Design Menus screen
appears, and then information from the most
recently created menu will be filled in or the
screen will be mostly blank if you have not
created a menu before. The Library value defaults
to *LIBL.
If changing an existing menu, SDA would locate the
source members using the menu name we provide
and then retrieve them.
Mastering the AS/400, Third Edition, author
Jerry Fottral
115
Week 10
Designing the Menu (Continued)
Type the menu name and press Enter to get the
Specify Menu Functions screen, and from this
screen choose to work with the menu image
(screen layout) and commands or to work with
online Help for the menu.
Keep the defaults Y for Work with menu image and
commands and N for Work with menu help and
press Enter. You’ll get SDA’s Menu template
screen.
Mastering the AS/400, Third Edition, author
Jerry Fottral
116
Week 10
Designing the Menu (Continued)
Work with Menu Image screen lets you:
• Add descriptions for menu selections
• Change the header
• Use function keys to access a screen to
enter menu commands
Mastering the AS/400, Third Edition, author
Jerry Fottral
117
Week 10
Designing the Menu (Continued)
Work with Menu Image screen (continued):
Important points:
Lines 1 through 20, the body of the menu, identify the
menu and also label and explain its selections.
The words and numbers used to do so are called
constants -- constants are one type of field that SDA
uses, and they are the main type used with menus.
Each constant may consist of a single word or number or
of several words together (e.g., a menu selection title).
Mastering the AS/400, Third Edition, author
Jerry Fottral
118
Week 10
Designing the Menu (Continued)
Work with Menu Image screen (continued):
Important points (continued):
You type constants on the screen enclosed in apostrophes
('), but when you press Enter to save the constants, the
apostrophes disappear.
On the starting menu template, the numbers for the
selections are provided, but you need to enter the title
of each selection as a constant. (From this point on,
any general reference to fields includes constants.)
Mastering the AS/400, Third Edition, author
Jerry Fottral
119
Week 10
Designing the Menu (Continued)
Work with Menu Image screen (continued):
Important points (continued):
Another special type of field that can be used in menus is
a system function that lets you display system values.
Of these special fields, the most commonly used are
*DATE and *TIME.
You can also use the fields *USER and *SYSNAME to
display user ID and system name, respectively.
Mastering the AS/400, Third Edition, author
Jerry Fottral
120
Week 10
Designing the Menu (Continued)
Work with Menu Image screen (continued):
Important points (continued):
Once you’ve entered fields, you can shift them right or
left on a line, move them to a different line, or delete
them.
An attribute byte immediately precedes each field; the
attribute byte is the single-character blank position to
the left of a field’s leftmost character. This byte is
always reserved for controlling the field to which it is
prefixed. You cannot see the attribute byte, but you
can use it to perform operations on the field.
Mastering the AS/400, Third Edition, author
Jerry Fottral
121
Week 10
Designing the Menu (Continued)
Work with Menu Image screen (continued):
Important points (continued):
You can use operations, or attribute commands, to:
•
Change the appearance of a field
•
Move a field on the work screen
•
Call up a list of different attributes for a field
•
Delete a field
Mastering the AS/400, Third Edition, author
Jerry Fottral
122
Week 10
Designing the Menu (Continued)
Work with Menu Image screen (continued):
Important points (continued):
Enter an attribute command starting on the attribute byte.
If the command is longer than one character (most are),
type over the constant or data field -- it will return as
soon as the command is run.
You can key attribute commands for several different
fields and then process them at the same time, when
you press the Enter key.
Mastering the AS/400, Third Edition, author
Jerry Fottral
123
Week 10
Specifying Attributes
Here are several commonly used attribute commands
that control positioning:
Attribute
Command
AC
-
Function
Centers the field on the line
Moves the field when you use the target =
Copies the field when you use the target
== (two equal signs)
Mastering the AS/400, Third Edition, author
Jerry Fottral
124
Week 10
Specifying Attributes (Continued)
When you reposition a field, be careful not to
overlap another field or SDA will refuse to
cooperate.
Attribute commands that determine appearance:
Attribute
Command Function
B
Makes the field blink
H
Displays the field in high intensity
R
Displays the field in reverse image
U
Underlines the field
Mastering the AS/400, Third Edition, author
Jerry Fottral
125
Week 10
Specifying Attributes (Continued)
Attribute commands that determine color:
Attribute
Command
CB
CG
CP
CR
CT
CW
CY
Function
Displays in blue
Displays in green
Displays in pink
Displays in red
Displays in turquoise
Displays in white
Displays in yellow
Mastering the AS/400, Third Edition, author
Jerry Fottral
126
Week 10
Specifying Attributes (Continued)
• To turn off any of the appearance or color attributes,
you type a minus or hyphen (-) in the attribute byte,
followed by the same command used to turn on the
attribute.
• Remember, the leftmost character of the attribute
command must start in the attribute byte of the
constant or field; if part of the constant or field is
erased by the rest of the command, it will be restored
after the command is entered.
Mastering the AS/400, Third Edition, author
Jerry Fottral
127
Week 10
Specifying Attributes (Continued)
• You can shift fields left or right by stringing together
the < (shift left) or > (shift right) symbols. To shift a
field left, you would type the first < on the column
where the leftmost character of the field is to be
repositioned and then type additional < characters up
to and including the attribute byte. For example, the
command
<<<<<STUMNU Menu
would move the title five positions to the left.
Mastering the AS/400, Third Edition, author
Jerry Fottral
128
Week 10
Specifying Attributes (Continued)
• To shift a field right, you would start in the first
position immediately following the constant or field.
For example, the command
STUMNU Menu>>>>>
would move the title five positions to the right.
• As for the existence of a field, the attribute command
D deletes the field. You can also delete a field by
starting on the attribute byte and using the spacebar to
erase the field.
Mastering the AS/400, Third Edition, author
Jerry Fottral
129
Week 10
Specifying Attributes (Continued)
Warning: Do not use the Insert and/or Delete key on the
keyboard to change the contents of a constant, either
while entering the constant or once it is entered.
You can delete (using attribute command D) the constant
and rekey it if it has already been entered.
You can type over a constant to make changes before it is
entered. If you forget and make a mistake, function
key F5 undoes most errors.
Mastering the AS/400, Third Edition, author
Jerry Fottral
130
Week 10
Setting Field Attributes
You can access an entire screen of display
options for a field by entering an asterisk (*) in
the attribute byte. (The exact content of the
screen depends on the type of field and
whether you are working with a menu or
display file.)
A menu title is automatically displayed in high
intensity, which translates to the color white on
color monitors.
Mastering the AS/400, Third Edition, author
Jerry Fottral
131
Week 10
Using Attribute Commands
In the SDA Menu screen template notice how
by default the date and time fields have
been formatted with editing characters
added.
When the completed menu is used by a GO
command, the current date and time system
values will be displayed using the format
indicated.
Mastering the AS/400, Third Edition, author
Jerry Fottral
132
Week 10
Defining Menu Commands
To enter commands that will be executed for each menu
selection, use Function key F10, listed at the bottom
of the menu template screen.
Press F10 to get the Define Menu Commands screen.
On this screen, use the prompter (F4) for commands
entered on the blank lines following the selection
numbers.
Mastering the AS/400, Third Edition, author
Jerry Fottral
133
Week 10
Defining Menu Commands
Initially the Define Menu Commands display
includes all options from 01 to 99 and entry
fields for each command to be typed in. You
can view the higher-numbered options by
paging down; to immediately position a certain
option at the top of the display, type its number
in the “Position to menu option” field.
Mastering the AS/400, Third Edition, author
Jerry Fottral
134
Week 10
Defining Menu Commands (Continued)
Use F11 to display only those options for which
we have entered a command.
Mastering the AS/400, Third Edition, author
Jerry Fottral
135
Week 10
Defining Menu Commands (Continued)
The view in Define Menu Commands “Defined only
options” Display in our example eliminates option
numbers that have no commands and makes it much
easier to see and change commands for each of the
options that will be allowed on the menu.
F11 acts as a toggle switch between one view and
another, as usual.
Press F3 to return to the Design Menus screen and then
F3 again to exit to get back to the Specify Menu
Functions display.
Press F3 to go to the Exit SDA Menus screen.
Mastering the AS/400, Third Edition, author
Jerry Fottral
136
Week 10
Exiting SDA Menus
The Exit SDA Menus screen first asks whether you want
to keep the results of your work session (Save new or
updated menu source).
If you were not finished with the menu and planned to
work on it more in a later session, or if you were done
and wanted SDA to create (compile) an executable
menu, you would choose Y here.
You would choose N only if you did not want to keep
any changes or new entries you had made.
Mastering the AS/400, Third Edition, author
Jerry Fottral
137
Week 10
Exiting SDA Menus (Continued)
Notice that two source members will be saved:
•
The DDS member
•
The Commands member
Mastering the AS/400, Third Edition, author
Jerry Fottral
138
Week 10
Exiting SDA Menus (Continued)
The values for Source file and Library name came
from the entries we made on the Design Menus
screen. For our example, we would take the rest of
the defaults because we do want to save the source (in
QDDSSRC) and we do want to create menu objects.
We could change the value of Object library and put
the compiled objects in any library we were
authorized to use.
Mastering the AS/400, Third Edition, author
Jerry Fottral
139
Week 10
Exiting SDA Menus (Continued)
After we press Enter from the Exit SDA Menus screen,
the message “SDA is compiling menu xxxxxx”
appears briefly at the bottom of the display and then
we are returned to the Design Menus screen.
When we return to the Work with Objects Using PDM
screen, we would find three new objects in our current
library list.
Mastering the AS/400, Third Edition, author
Jerry Fottral
140