Data File Utility
Data File Utility
Data File Utility
Before using this information and the product it supports, be sure to read the general information under
“Notices” on page vii.
This edition applies to Version 3, Release 1, Modification Level 0, of IBM Application Development ToolSet/400
(Program 5763-PW1), and to all subsequent releases and modifications until otherwise indicated in new editions.
Make sure you are using the correct edition for the level of the product.
Order publications through your IBM representative or the IBM branch office serving your locality. Publications are not
stocked at the address given below.
A form for readers’ comments is provided at the back of this publication. If the form has been removed, address your
comments to:
You can also send your comments by facsimile (attention: RCF Coordinator), or you can send your comments elec-
tronically to IBM. See “Communicating Your Comments to IBM” for a description of the methods. This page imme-
diately precedes the Readers’ Comment Form at the back of this publication.
When you send information to IBM, you grant IBM a nonexclusive right to use or distribute the information in any way
it believes appropriate without incurring any obligation to you.
Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
Contents v
vi Data File Utility (DFU)
Notices
References in this publication to IBM products, programs, or services do not imply
that IBM intends to make these available in all countries in which IBM operates.
Any reference to an IBM licensed program in this publication is not intended to
state or imply that only IBM’s licensed program may be used. Any functionally
equivalent product, program or service that does not infringe any of IBM’s intellec-
tual property rights may be used instead of the IBM product, program, or service.
Evaluation and verification of operation in conjunction with other products, except
those expressly designated by IBM, is the user’s responsibility.
IBM may have patents or pending patent applications covering subject matter in
this document. The furnishing of this document does not give you any license to
these patents. You can send license inquiries, in writing, to the IBM Director of
Licensing, IBM Corporation, 208 Harbor Drive, Stamford, Connecticut, USA
06904-2501.
This publication contains examples of data and reports used in daily business oper-
ations. To illustrate them as completely as possible, the examples include the
names of individuals, companies, brands, and products. All of these names are
fictitious and any similarity to the names and addresses used by an actual business
enterprise is entirely coincidental.
You may need to refer to other IBM manuals for more specific information about a
topic. The Publications Reference, SC41-3003, provides information on all the pub-
lications in the AS/400 library.
Before using this book, you must know how to use your workstation and have a
general knowledge of the AS/400 system. For general information on the AS/400
system, refer to System Operation, SC41-3203, and System Startup and Problem
Handling, SC41-3206. For information on databases and database management,
refer to Database Programming, SC41-3701, and Data Management, SC41-3710.
DFU provides you with a quick way of updating a file using a temporary program.
You do not have to define a DFU program first. DFU also allows you to create
database maintenance programs faster than you could by using programming lan-
guages (for example, RPG).
DFU programs can perform several jobs. For example, a single DFU program can
allow you to enter new records into a file, update fields within existing records, or
perform file inquiry tasks.
DFU creates data entry programs from definitions based on the descriptions of
existing database files. You must create an Interactive Data Definition Utility
(IDDU), Data Description Specifications (DDS), or RPG II description, and then
create physical or logical files based on the description. The descriptions are then
used during the definition of your DFU program. After you have defined a program,
you can recall and run that program as often as required.
Creating a Program
To create a DFU program for data entry, select the record formats and fields you
want to use. The data entry displays you request are then created. For example, if
you use two record formats, DFU creates two different data entry displays. You
can switch between the two formats while you are running your program.
DFU also allows you to print a summary of the defined program that shows all your
selected fields and record formats.
Running a Program
While running a DFU program, you can:
Change, delete, or display a record in a file.
Add new records to a file by typing data into the displayed fields.
Change or view records in a file by typing an approximate key value and then
using the page keys to locate the desired record.
Select new record formats (or types, if the file is RPG-defined).
Retrieve the next or previous record for any record format or type.
Use a programming language if your data entry application requires any of the
following:
Computations on selected fields
Data checking based on information contained elsewhere in a database file,
such as cross referencing fields from other files
Validation of the relationship between multiple field entries
Complex formatting requirements
Describing a File
DFU programs can operate on RPG II, DDS, and IDDU-described data files. Use
DFU to define data entry displays based on the data descriptions of these files.
Usually, data attributes of a file (such as the names and lengths of records and
fields) are specified in application programs themselves. In RPG, this is done in
input or output specifications. This method of describing data is program-described
data. Data attributes can also be defined externally through DDS or IDDU. These
DDS-Described Files
Data description specifications (DDS) provide a method of describing data files
externally rather than within a program. External file descriptions are associated
with the data files themselves; you do not have to specify the location of the
description for DFU. For more information on DDS-described files, see the DDS
Reference, SC41-3712.
IDDU-Described Files
IDDU is an interactive data definition utility that is part of the Operating System/400*
(OS/400*) operating system. IDDU provides you with another method for describing
the files and data stored on your system. IDDU file descriptions are linked to your
file in a similar manner to DDS file descriptions. For more information on
IDDU-described files, see IDDU Use, SC41-3704.
If you define your program for a System/36 environment, you must use the
System/36 function keys shown in “System/36 Style Runtime Function Keys” on
page 58 when you run that program.
While you are running a program, not all the function keys available can be shown
on one display; only the function keys you use most often appear. To see defi-
nitions for all available function keys, place your cursor on either one of the function
key lines at the bottom of your display and press Help. Detailed definitions of all
the function keys appear in numerical order.
You define, change, and run DFU programs by accessing it through the STRDFU
command. If authorized, however, you can also run existing programs directly by
using the CHGDTA or DSPDTA commands, or run a temporary program by using
the UPDDTA command.
DFU Commands
DFU supports the following commands:
Command Description
STRDFU Starts the data file utility
CHGDTA Changes records in a data file
DSPDTA Displays records from a data file
UPDDTA Creates and runs a temporary program to update a data file
DLTDFUPGM Deletes a DFU program
CRTDFUDSPF Creates a DFU display file
If you do not specify any options, the AS/400 DFU menu appears.
Selection or command
===> ___________________________________________________________________________
_________________________________________________________________________________
F3=Exit F4=Prompt F9=Retrieve F12=Cancel
For each option, DFU begins a prompting sequence of displays that takes you
through all the necessary steps. Chapters 2 through 7 of this manual provide
detailed descriptions and an example of each of the options.
Distributed Data Management (DDM) accesses data files that reside on remote IBM
systems, allowing you to retrieve, add, update, or delete records in a file on another
system. In addition, a remote system can access your system’s database for
record retrieval. See Distributed Data Management, SC41-3307, for a more
detailed description of DDM.
You create DFU programs by specifying formats and fields through the create
option of the AS/400 DFU menu.
The data file used in this example is called QORDFILE, which is in a user-defined
library called MYLIB.
Note: Make sure the library and data file exist before trying the example. You can
create the library by using the Create Library (CRTLIB) command. Copy
the data files called QORDHDR, QORDDTL, and QORDFILE supplied with
AS/400 DFU, from the QGPL library to MYLIB using the Create Duplicate
Object (CRTDUPOBJ) command.
ORDER SHIP
DATE VIA
94/ð9/ð9 _______________
á ñ
Note: A display style similar to the one in “Example System/36 Data Entry
Display” on page 60 appears if you have requested a System/36 data entry
style on the Define General Information/Indexed File display.
In this example, you create a program that uses the following order maintenance
application. The application allows an operator to enter and change data within a
data file.
┌───────────────────────────────────────────────────────────────────────┐
│ MM HARDWARE COMPANY │
│ 123 Main Street │
│ Anywhere │
│ │
│ Sold To: │
│ ┌─── ───┐ │
│ │ │ │
│ │ Smith Inc. │ │
│ │ 363ð King St. │ │
│ │ Boston, Mass. │ │
│ │ │ │
│ │
│ │
├────────┬──────────┬──────────────┬─────────┬──────────┬───────────────┤
│ Order │ Date │ Order Status │ Invoice │ Customer │ Ship Via │
│ Number │ │ │ Number │ Number │ │
│ 12ð │ ð9/ð9/94 │ 1 │ 525 │ 6ð │ BOAT │
├────────┴──────────┴──────────────┴─────────┴──────────┴───────────────┤
├──────┬──────────┬────────┬────────────────┬─────────────┬─────────────┤
│ Line │ Order │ Part │ Part │ Unit Amount │ Total Amount│
│ │ Quantity │ Number │ Description │ │ │
├──────┼──────────┼────────┼────────────────┼─────────────┼─────────────┤
│ 1 │ 2 │ 45 │ SCREWDRIVER │ 5.25 │ 1ð.5ð│
│ │ │ │ │ │ │
│ 2 │ 1ð │ 53 │ 1 OZ HAMMER │ 12.1ð │ 121.ðð│
│ │ │ │ │ │ │
│ 3 │ 3 │ 1ð1 │ ELECTRIC SAW │ 52.ðð │ 156.ðð│
│ │ │ │ │ │ │
│ 4 │ 12 │ 325 │ .5" SCREWS(1ðð)│ 2.15 │ 25.8ð│
│ │ │ │ │ │ │
├──────┴──────────┴────────┴────────────────┴─────────────┴─────────────┤
│ TOTAL AMOUNT 313.3ð│
└───────────────────────────────────────────────────────────────────────┘
The following figure shows the DDS file description of the formats and fields that
appear in this example for an indexed data file.
... ... 2 ... ... 3 ... ... 4 ... ... 5 ... ... 6 ... ... 7 ... ... 8 ... ... 9 ... ... ð
R ORDHDR PFILE(ORDHDRPF)
TEXT('Order Header Record')
K ORDER
R ORDDTL PFILE(ORDDTLPF)
TEXT('Order Detail Record')
K ORDER
\ \ \ \ \ E N D O F S O U R C E \ \ \ \ \
MEMBER: QORDHDR
... ... 2 ... ... 3 ... ... 4 ... ... 5 ... ... 6 ... ... 7 ... ... 8 ... ... 9 ... ... ð
\ \ \ \ \ E N D O F S O U R C E \ \ \ \ \
... ... 2 ... ... 3 ... ... 4 ... ... 5 ... ... 6 ... ... 7 ... ... 8 ... ... 9 ... ... ð
\ \ \ \ \ E N D O F S O U R C E \ \ \ \ \
When you enter the STRDFU command, a menu is displayed from which you
select an option to create a DFU program. DFU then begins a prompting sequence
through which you define the program.
Note: You can review program or data file details at any time while you are cre-
ating your DFU program. Function keys are provided for this purpose.
When you are finished reviewing the details, press F3 (Exit) to return to the
definition display.
The rest of this chapter describes the displays that appear when you create a DFU
program and shows the entries to type into each display for the sample program.
Starting DFU
Do the following to start DFU program definition:
1. Type STRDFU and press Enter. The AS/400 DFU menu appears.
2. Type 2 (Create a DFU program) on the command line, and press Enter. The
Create a DFU Program display appears.
This example assumes you are the first user of DFU and shows the default values.
2. Move the cursor to the Data file prompt, and press F4 (Prompt) to select the
data file for your DFU Program. The Select File display appears.
Selecting a File
The Select File display lists the data files from the specified library. To select the
file you want to use for your program from the list:
1. Type 1 (Select) in the Opt column beside the QORDFILE field to select the file
for the sample ORDMNT program, and then press Enter. The Create a DFU
Program display is shown. The selected file QORDFILE is in the Data file
prompt.
2. Press Enter again. The Define General Information/Indexed File display
appears. If your data file is nonindexed, the Define General
Information/Nonindexed File display appears.
á ñ
To define the audit report using the default values for the sample ORDMNT
program, press Enter. The Work with Record Formats display appears.
Multiple
Opt Format Records Defined Description
Select fields and their sequence or press F21 to select all; press Enter.
Bottom
F3=Exit F5=Refresh F12=Cancel F14=Display definition
F2ð=Renumber F21=Select all
á ñ
2. Press Enter. The display reappears with your selected fields right-justified in
order of your selection, and a message appears on the last line of the display
asking you for confirmation.
If you do not select extended definition, the validation keywords from your DDS file
description are used.
Extended
Opt Field Definition Heading
_ CUST N CUSTOMER____________
_ ORDER N ORDER_______________
_ ORDSTS N ORDER_______________
_ ORDAMT N ORDER_______________
_ TOTLIN N TOTAL_______________
_ INVNUM N INVOICE_____________
_ ORDDAT N ORDER_______________
_ SHPVIA N SHIP________________
Bottom
F3=Exit F5=Refresh F12=Cancel
F14=Display definition F21=Select all
á ñ
Now that you have selected the fields you want to include in the program, you can
specify extended field definitions for them. To specify an extended field definition,
type 2 (Specify) in the Opt column next to the ORDER, ORDAMT, ORDDAT, and
SHPVIA fields to select them for extended definitions, and press Enter. The
Specify Extended Field Definition display is shown.
More...
F3=Exit F12=Cancel F14=Display definition
á ñ
1. Press Page Down (Roll Up) to go to the second part of the Specify Extended
Field Definition display. Your display appears as follows:
Bottom
F3=Exit F12=Cancel F14=Display definition
á ñ
Note: The edit code (L) is specified here because it is the default for DFU.
Edit code L means that a decimal point will be inserted in the correct
place if decimal positions are indicated in the field description, negative
numeric fields are indicated with a minus sign to the right of the last
digit in the field, and unnecessary leading zeros are blanked out.
2. Press Page Up (Roll Down) to return to the first display of the Specify
Extended Field Definition display.
3. Type (NUMERIC CODE) in the Extended field heading prompt on the line below
NUMBER.
Press Enter to go to the Specify Extended Field Definition display for numeric
fields.
This display appears next because you selected the numeric ORDAMT field for
an extended definition on the Work with Fields display.
3. Press Page Down (Roll Up) to go the second part of the Specify Extended
Field Definition display.
The edit code A appears in the Edit code prompt because it was specified in
the DDS file description. By using edit code A the values entered in the
ORDAMT field will be displayed with commas and decimal places where neces-
sary. Negative numeric values are shown with a CR symbol to the right of the
last digit. Any leading zeros are blanked out.
4. Press Page Up (Roll Down) to go back to the first screen of the Specify
Extended Field Definition display.
5. Type Y (Yes) over the default value in the Accumulate prompt to select the
accumulate function for the ORDAMT field.
The accumulate function maintains a running total of the values you type for a
specified field when you run your program. The accumulator total appears at
Type 'PLANE' in the List of values prompt to add it to the list of values. The
display appears as follows.
You must specify two or more values when using the LS relational operator. The
values you specify in the List of values prompt should each be separated by a
blank. You must enclose character strings in single apostrophes.
You have now finished defining the program information for the ORDHDR record
format. Because you specified two record formats, the next step is to repeat the
definition process for the second record format (ORDDTL).
More...
Press Enter to continue.
á ñ
To see the remaining information for the Display DFU Program Summary display,
Press Page Down (Roll Up). The display appears as follows:
Bottom
Press Enter to continue.
á ñ
Extended
Format/Field Attr Definition Length Type Description/Heading
ORDHDR Order Header Record
CUST N 5 CHAR CUSTOMER
ORDER KEY Y 5,ð PACK ORDER
ORDSTS N 1,ð PACK ORDER
ORDAMT Y 11,2 PACK ORDER
TOTLIN N 3,ð PACK TOTAL
INVNUM N 5,ð PACK INVOICE
ORDDAT Y 6,ð PACK ORDER
SHPVIA Y 15 CHAR SHIP
ORDDTL MLT Order Detail Record
ORDER KEY Y 5,ð PACK ORDER
More...
á ñ
Press Page Down (Roll Up) to see the rest of the information on the Display
Program Detail display. The display appears as follows:
Extended
Format/Field Attr Definition Length Type Description/Heading
QTYORD N 3,ð PACK ORDER
PARTNO N 6,ð PACK PART
PARTDESC N 15 CHAR PART
UNITAMT N 7,2 PACK UNIT
TOTAMT N 1ð,2 PACK TOTAL
Bottom
Press Enter to continue.
á ñ
More...
Press Enter to continue.
á ñ
1. Press Page Down (Roll Up) to see the remaining information on the Display
Data File Detail display.
You are finished reviewing the program definition and file details.
2. Press Enter to return to the Work with Fields display.
3. Press Enter to continue to the Exit DFU Program Definition display.
á ñ
Note: If you want to run the program automatically, press F17 (Fast path). When
you press F17 (Fast path), you do not see any other displays before
running the program. To choose a specific member, other than the first in
the file, press Enter. A display appears prompting you for program, file and
member information.
Press Enter to save your program and continue to the Change a Data File display.
ORDER SHIP
DATE VIA
94/ð9/ð9 BOAT___________
3. Press Enter to process the new record. DFU adds the record to the
QORDFILE data file and clears the display so you can continue adding records.
4. Press F6 (Select format) to go to the Select Record Format display.
5. Type 1 beside the ORDDTL format to select it, and press Enter. The Data
Entry Display appears for the ORDDTL record format. You can now enter mul-
tiple records on this display, because you specified Y (Yes) in the Multiple
Records prompt on the Work with Record Formats display.
6. To add four records to the record format, type the data that appears in the
following figure:
á ñ
7. Press Enter. DFU adds the records to the QORDFILE data file and clears the
display.
This example uses an IDDU described file called ORDIDDU for a program called
ORDPGM. The program is similar to the one you created for an indexed file.
Note: If you want to try the example shown in this section, you must first create
the IDDU file.
1. Select option 2 (Create a DFU program) from the AS/400 Data File Utility
(DFU) menu.
2. Press Enter. The Create a DFU Program display appears.
This display requests the name of the DFU program you want to define and its
data file.
3. Type ORDPGM in the Program prompt and the library name MYLIB for both
Library prompts.
4. Type ORDIDDU in the Data file prompt.
This file must be linked to an IDDU file definition for DFU to run using this type
of definition. Before you can link, you must create an IDDU file definition.
5. Press Enter. The Define General Information/Nonindexed File display appears.
á ñ
2. Press Enter to continue to the Define Audit Control display for the sample
ORDPGM program. This display appears when you leave the default value Y
(Yes) in the Audit report prompt.
Using the default values for the sample ORDPGM program, press Enter to continue
to the Select Field for Record Number display.
1. Type 1 (Select) next to the ORDER field to select it for storing the record
number in this example.
2. Press Enter to continue to the Work with Record Formats display.
Make sure that you have defined record ID codes for each selected record when
using multiple-record formats for IDDU. ID codes allow DFU to differentiate
between the record formats on a record-by-record basis.
If you want to run the program, press F17 (Fast path). When you press F17 (Fast
path), you do not see any other displays before running the program. To choose a
specific member, other than the first in the file, press Enter. A display appears
prompting you for program, file, and member information.
This chapter shows how to make a simple change to the ORDMNT program
created in Chapter 2, “Creating a DFU Program” on page 7. The QORDFILE used
by the sample program is an indexed DDS-described file.
The rest of this chapter discusses the displays you use to make a simple change to
the ORDMNT program. The example shows the entries to type into each display to
produce the changed sample program.
The entries in the Program, Library, and Data file prompts default to the values you
previously specified in the last program you created.
Selecting a Program
The Select Program display shows the list of programs available in the MYLIB
library. To select the ORDER MAINTENANCE RECORDS program for this
example, do the following:
1. Type 1 (Select) in the Opt column beside the ORDMNT program.
2. Press Enter to return to the Change a DFU Program display with the selected
program. The ORDMNT program name appears on the display.
3. Press Enter. The Define General Information/Indexed File display appears.
The information shown is based on the values you specified when you created
your program. For this example, leave the default values that appear.
4. Press Enter. The Define Audit Control display appears. The information
shown is based on the values you specified when you created your program.
For this example, leave the default values that appear.
5. Press Enter. The Work with Record Formats display appears.
You can work with one or more formats for processing. If you select more than
one record format, DFU presents a new Select and Sequence Fields display and
repeats the field definition sequence for each record format you select from this
display.
The Defined prompt shows that the ORDHDR format and the ORDDTL format have
previously been defined for this program. To select the ORDHDR format for proc-
essing by the sample ORDMNT program, do the following:
1. Type 2 (Specify) beside the ORDHDR format, and press Enter. The Select and
Sequence Fields display appears.
For this example, it is not necessary to change anything on the Select and
Sequence Fields display. DFU renumbers the field sequence numbers starting
at 10 and increasing in units of 10. It has not changed the sequence of the
fields. Renumbering in this fashion just makes it easier for you to insert new
fields without manually renumbering subsequent fields.
2. Leave the default entries and press Enter.
3. Press Enter again to confirm and to continue to the Work with Fields display.
To change the extended definitions for fields defined when the DFU program was
created, do the following:
1. Type 2 (Specify extended definition) in the Opt column next to the ORDER
field.
2. Press Enter to continue to the Specify Extended Field Definition display where
you can change the extended definition for the ORDER field.
3. Remove the (NUMERIC CODE) from the Extended field heading prompt.
4. Press Enter to return to the Work with Fields display.
5. Type 2 (Specify extended definition) in the Opt column next to the SHPVIA field
to change the extended definition.
6. Press Enter. The Specify Extended Field Definition display appears.
7. Type 2 (Change) in the Validity checks prompt to change the validity checks
that are specified for this field.
8. Press Enter. The Specify Validity Checks display appears.
9. Type 'CAR' in the List of values prompt after 'PLANE'. Be sure to type a
space between the two list values.
10. Press Enter to return to the Work with Fields display.
11. Press Enter again to continue to the Exit DFU Program Definition display.
ORDER
NUMBER
____ð_
2. Press Page Down (Roll Up) to view the records that you have added. Note
that the ORDER NUMBER field no longer appears with an extended field
heading as it did on the original data entry display. The change that was made
to the SHPVIA field is not a visible one on the data entry screen, but you can
now enter the extra value (CAR) in the SHPVIA field when you are entering
data.
3. Press F3 (Exit) to go to the End Data Display.
The audit control information does not appear on the End Data Display
because you cannot make changes to the data file.
4. Press Enter to end this DFU session and to return to the AS/400 Data File
Utility (DFU) menu.
The DFU program runs in one of four modes: Entry, Change, Insert, or Display.
The initial mode of data entry depends on your selection from the Run a DFU
Program menu. You can change the mode using an associated function key. The
initial mode for option 1 (Change a data file) is Change, provided records exist in
the file that can be changed. Otherwise, Entry is the initial mode. Entry mode
allows you to add records to a data file. From Display mode, you can only look at
data file records, you cannot change them.
Type 1 (Change a data file) on the command line and press Enter. The Change a
Data File display appears.
SHIP
VIA
TRUCK__________
á ñ
6. Press Enter to process the new record. DFU adds the record to the
QORDFILE data file and clears off the display so you can add information for
another new record.
7. Press F6 to show the Select Record Format display.
á ñ
For example, in the ORDMNT program, you specified the ORDAMT field as an
accumulator field when you defined the program. The Display Batch Accumulators
display shows the subtotal of the value of the ORDAMT field. Because you created
only one record in this example, the subtotal for the ORDAMT field is 300. As you
add records, this subtotal increases, and as you delete records this subtotal
decreases.
Field Subtotal
ORDER AMOUNT 3ðð.ðð
Program . . . . . . . . . . : ORDMNT
Library . . . . . . . . . : MYLIB
Data file . . . . . . . . . : QORDFILE
Library . . . . . . . . . : MYLIB
Member . . . . . . . . . . . : QADZORDF
Record format . . . . . . . : ORDHDR
Last format . . . . . . . . : ORDHDR
Bottom
F3=Exit F12=Cancel
á ñ
In this example, you are going to change the SHPVIA value in an existing record in
the QORDFILE file:
1. Press F11 (Change) to enter Change mode.
2. Type 11ð in the ORDER NUMBER key field, and press Enter. DFU retrieves
the record from the file and shows the contents of the record so that you can
change it. Your display appears as follows:
SHIP
VIA
TRUCK__________
The following display shows that you added three records, changed one record,
and deleted one record during the current session. The informational message
indicates that all records you added, changed, or deleted are printed. This
message appears because you selected to print an audit report on the Define
General Information/Indexed File display.
Added . . . . . : 3
Changed . . . . : 1
Deleted . . . . : 1
F3=Exit F12=Cancel
All records added, changed, or deleted will be printed.
á ñ
Field Subtotal
ORDER AMOUNT .ðð
You also can press F17 (Display and Print Accumulators) to request the accu-
mulator subtotals anytime during data entry.
Field Total
ORDER AMOUNT 3ðð.ðð
\ \ \ \ \ E N D O F D F U A U D I T R E P O R T \ \ \ \ \
The temporary data entry program uses the following defaults for each display,
unless they are changed in your user profile:
Define General Information display
– Job title: WORK WITH DATA IN A FILE
– Display format: Multiple column
– Audit report: Yes
– S/36 style: No
– Suppress errors: No
– Allow updates on roll: Yes
– Record numbers heading: *RECNBR (nonindexed files only)
– Processing: Sequential (nonindexed files only)
– Keys-Generate: No (indexed files only)
– Keys-Changes allowed: Yes (indexed files only)
– Generate record numbers: No (nonindexed files only)
– Store record number in a field: No (nonindexed files only)
Specify Audit Control display
– Print additions: Yes
– Print changes: Yes
– Print deletions: Yes
– Printer line width: 132
– Printer column spacing: 1
Work with Record Formats display: All available record formats
Select and Sequence Fields display
– Select and Sequence fields: Select all
– Field headings: The externally described headings if they exist, otherwise
the field names specified in the file specification
Specify Extended Field Definition display (alphanumeric fields)
– Auto duplicate: No
– Allow lowercase: Yes
– Heading location: *BEFORE
– Edit code and Edit word: As specified in the DDS file description
Specify Extended Field Definition display (numeric fields)
See the online help for more information about these values.
The temporary program uses all of the fields in the data file specification
instead of only those you would select if creating your own program. DFU also
creates data entry displays for all record formats specified in the external DDS
or IDDU file descriptions.
Only experienced users should attempt to tailor their DFU display files. Tampering
with the following restrictions is done at your own risk:
Do not rearrange the fields in the display buffer. For example, you may move
the fields around on the SDA work screen, but you cannot change the order of
the fields in the display buffer.
Do not overlap fields or constants.
Do not add or remove display records, or change the name of a display record.
Do not change the length of, add, or delete any fields.
Do not change input, output or both field data types.
Do not change the indicators specified.
Do not change the names of input or output fields or record formats.
Do not overlap fields in one record format with another record format; for
example, you must not move a SFL field to the area defined or used by a
SFLCTL record.
Note: The CL command CRTDFUDSPF does not perform any syntax checks on
the DDS source prior to creating the object.
This chapter shows how to tailor the DDS source using SDA. The examples show
how to create a new DFU display file called ORDMNT, using the create DFU
display file (CRTDFUDSPF) command. The characteristics of the DFU display file,
and the data entry displays used to access data files, are also described.
The following example shows you how to save the DDS source:
1. Type STRDFU and press Enter. The AS/400 Data File Utility (DFU) menu
appears.
Examples of what you can do to tailor your display using SDA are as follows:
Highlight fields
Make a field blink
Show a field in reverse image
Add constants
Rearrange the fields on the screen
Add UIM user help
Bottom
F3=Exit F12=Cancel F14=File-level keywords
F15=File-level comments F17=Subset F24=More keys
á ñ
The records listed on the Work with Display Records display contain the information
that DFU uses to set up each data entry display within the DDS source member.
The work screen contains the DDS that you saved from your DFU program. You
can use SDA to change the way the data entry display looks. The following steps
will take you through an example of tailoring your DFU display. For more informa-
tion on using SDA see ADTS/400: Screen Design Aid, SC09-1768.
= SHIP
VIA
BBBBBBBBBBBBBBB
2. Press Enter. The INVOICE field is now directly under the CUSTOMER
NUMBER field. The display appears as follows:
INVOICE SHIP
VIA
BBBBBBBBBBBBBBB
3. Use the minus key (−) and the equal key (=) to move other fields on the display
so it appears as follows:
INVOICE SHIP
NUMBER VIA
99999- BBBBBBBBBBBBBBB
Note: Although you can make the Design Image work screen appear as it
does in the preceding figure by moving fields with the minus (−) and
equal (=) keys, you can also use other SDA features to do more
complex tailoring.
4. Press F3 to exit the Design Image work screen. The Exit SDA Work Screen
display appears.
Specify additional
save or create options . . . . . . . _ Y=Yes
When SDA displays a completion message, you have finished your tailoring
and saved the DDS source in a display file.
3. Press Enter to return to the Design Screens display.
4. Press F3 to return to the Screen Design Aid menu.
5. Press F3 to exit SDA.
When a DFU program is created a display file is automatically created along with
the program. Now that you have saved and tailored the DDS source generated for
the DFU display file, the next step is to use the Create DFU Display File
(CRTDFUDSPF) command to create your new display file.
Bottom
F3=Exit F4=Prompt F5=Refresh F12=Cancel F13=How to use this display
F24=More keys
á ñ
2. Type the name of the display file in the Display file prompt and the library name
in the Library prompt.
3. Press Enter and the new DFU display file is created.
Now that you have created your new DFU display file, you can re-run your DFU
program. The data entry displays that appear are now the ones that you tailored in
SDA. To make additional changes to the data entry display after viewing them,
repeat the process as outlined in “Tailoring a DFU Data Entry Display” on page 48,
and tailor the displays again.
The following System/36 DFU functions are available only within the System/36
environment:
DFU LIST function. The List function is used to print the contents of a file.
See Data File Utility List for the System/36 Environment User’s Guide and Ref-
erence, SC09-1362, for details.
DFU UPDATE function. The Update function is used to change a data file.
DFU INQUIRY function. The Inquiry function is used to display a data file.
DFU ENTER function. The Enter function is used to create a new data file.
To use a program-described data file, you must enter the F and I specifications into
a source member. This is the only coding you have to do for DFU. Source
member information appears in the same format as you enter it through the text
editor. You can use any AS/400 text editor to enter the information into a source
member. For example, you can enter the information through the source entry
utility (SEU), a part of the Application Development ToolSet/400 licensed program.
The following figure shows an SEU display containing the F and I specifications
that you need to enter to work through the examples in this chapter.
á ñ
For information on how to use SEU, see ADTS/400: Source Entry Utility,
SC09-1774.
If the DFU program you create processes an existing file, there may already be F
and I specifications in the system for that file. In this case, you do not need to
create file specifications for the data file. DFU uses the existing F and I specifica-
tions from any existing RPG II source program.
Note: When using the ENTER, UPDATE, INQUIRY, LIST, ENTER#, UPDATE#,
INQUIRY#, or LIST# System/36 procedures in the System/36 environment,
all data files must reside in library QS36F, and all RPG II source members
must reside in file QS36SRC in the library you specify.
The System/36 runtime function keys are described in the following table.
Workstation Name of
Key Function Key Description
F1 Auto dup Switches the automatic duplicate function on
and off. When on, fields defined for automatic
duplication are filled with the last specified
value for the field. When off, blank fields are
displayed.
The displays for running and deleting programs are similar on both the AS/400
system and System/36. Review Chapter 4, “Running a DFU Program” on
page 35, and Chapter 7, “Deleting a DFU Program” on page 55, for details on
these procedures.
The DFU program is created from a definition made through the create or change
option of the AS/400 Data File Utility (DFU) menu. You can modify existing
program definitions to create a new program by saving the modified version under
a different name.
DATE: ______
CUST. ORD. NO.: _____
CUSTOMER NO.: _____
SHIP VIA.: _______________
SHIP TO: __
PRICE OF ORDER: _______
Notes:
1. You can also use the System/36 commands Enter, Update, and Inquiry to
define DFU programs from the System/36 environment. You can use the
System/36 commands ENTER#, UPDATE#, and INQUIRY# to run DFU pro-
grams from the System/36 environment. See the System/36 Environment Ref-
erence manual for descriptions of these commands. See the System/36
Environment Programming book, SC41-3730, for details on using the
System/36 environment.
2. You must use the System/36 LIST command to access the DFU LIST function.
You can also use the System/36 command LIST# to run DFU LIST programs
from the System/36 environment. See the Data File Utility List for the
System/36 Environment User’s Guide and Reference book for more informa-
tion.
3. All data files referenced through the operation control language (OCL) from the
System/36 environment must exist in library QS36F. DFU uses OCL to access
files in the System/36 environment.
4. To change the program, leave the Name of DFU program prompt blank, and
specify the name of the program you want to change in the Name of DFU
specification source member prompt.
You can review the program or the data file definitions and default entries any time
while you are creating or changing a DFU program. Command function keys are
provided for this purpose. DFU returns to the definition display after you finish
reviewing program or data file details.
The remainder of this chapter discusses the displays that appear when you define
a DFU program in the System/36 environment. The examples show the prompt
entries you enter into each display to produce the sample DFU program.
Use the BLDFILE procedure to create a file that matches the RPG II F and I spec-
ification shown in “RPG II-Described Files” on page 57 to do this example.
Your display appears as follows. It can, however, contain different values. This
example assumes that you put the F and I specifications in MYLIB.
á ñ
Move your cursor to the Source member prompt and press F4. A list of the avail-
able source members for this data file appears.
The Select RPG II Source Member display shows you a list of available source
members. To select the member you want to process from this list:
2. Press Enter to continue to the Define Audit Control Display. This display
appears when you use the default setting of Y (Yes) for the Audit report
prompt. Otherwise, if you type N (No) in the Audit report prompt, the Work with
Record Types display appears.
If you type Y (Yes) next to a reportable change on the Define Audit Control display,
DFU prints a copy of each changed record for the specified print category (addi-
tions, changes, or deletions). If you have accumulator fields, you also receive a
printout of accumulator totals on your audit report. If you do not specify to print any
of the audit control options but indicate that you want an audit report on the Define
General Information/Indexed Files display, you receive a printout of accumulator
totals only (if you have defined accumulators).
á ñ
Specify a character in the Delete code prompt, and press Enter to continue to the
Work with Record Types display. For RPG II files, this display appears instead of
the Work with Record Formats display (as would appear if your file is DDS or IDDU
described).
Bottom
Press Enter to continue.
á ñ
1. After you have reviewed the information, press Enter to return to the Work with
Record Types display.
2. Type 2 (Specify) in the Opt column next to record type 01, and press Enter to
work with record type 01. The Select and Sequence Fields display appears.
To select all of the displayed fields from the record type, press F21 (Select all). If
you change the sequence of the displayed fields, the screen reappears in
ascending sequential order when you press Enter. Press Enter again to confirm
your changes and to continue to the next definition display. If you do not change
any information, the Work with Fields display appears when you press Enter.
If you do not want to define new field headings or extended definitions for the fields
you select from this display, press F17 (Fast path) to bypass the Work with Fields
and Specify Extended Field Definition displays for the current record type. If there
are still record types to process, the Select and Sequence Fields display reappears
for the next selected record type. Otherwise, the Exit DFU Program Definition
display appears.
To use F17 (Fast path), select the fields you want for your data entry display and
press Enter to confirm your selections. Then press F17 (Fast path).
To select the field order for your data entry display, do the following:
1. Type the sequence numbers shown in the following figure for the sample
INVNTRY program, and press Enter.
Select fields and their sequence or press F21 to select all; press Enter.
Bottom
F3=Exit F5=Refresh F12=Cancel F14=Display definition
F2ð=Renumber F21=Select all
á ñ
2. Press Enter again to confirm. The Work with Fields display appears.
For this example, the only field selected for an extended definition is the alphanu-
meric ORDER field.
More...
á ñ
2. You are finished defining your DFU program. Press F14 (Display definition) to
see the Display DFU Program Summary display to review your DFU program
definition.
á ñ
Bottom
Press Enter to continue.
á ñ
Processing . . . . . . . . . . . . . : Sequential
RPG source file . . . . . . . . . . : QS36SRC
Library . . . . . . . . . . . . . : MYLIB
RPG source member . . . . . . . . . : SRCMBR
More...
Press Enter to continue.
á ñ
2. Press Page Down (Roll Up) to view the second part of the Display DFU
Program Summary display.
3. Press Enter to review the DFU Program Detail display.
Extended
Type/Field Attr Definition Length Type Description/Heading
ð1
ORDER KEY N 6 CHAR OUR ORDER NUMBER
ORDATE N 6 CHAR ORDATE
CUSORD N 5 CHAR CUSORD
CUST N 5 CHAR CUST
SHPVIA N 15 CHAR SHPVIA
PRICE N 7,ð PACK PRICE
SHPTO N 2 CHAR SHPTO
Bottom
Press Enter to continue.
á ñ
This display shows all of the fields in the file specification, not just your selected
fields. For this example, your display appears as follows:
More...
Press Enter to continue.
á ñ
When you have finished reviewing the program definition and file details, do the
following:
1. Press F3 (Exit) to return to the Specify Extended Field Definition display.
2. Press Enter twice. The Exit DFU Program Definition display appears.
The following example saves the INVNTRY program and then runs the program in
Display mode, which allows you to check the data entry displays you have just
defined. Display mode allows you to look at records in the INVRPG data file but
not change them.
Note: Option 9=Create appears in the Type of run prompt only if you used the
OCL ENTER procedure.
See “Exiting from DFU Program Definition” on page 21 for a description of the
information on this display.
2. Press Enter to save your program and continue to the Display a Data File
display. This display appears because you selected to run the program in
Display mode (option 2 (Display) in the Type of run prompt). This is also the
first display that appears when you run a DFU program by using the DSPDTA
command.
To run the DFU program in the same way as on the AS/400 system, use
System/36 function keys to perform DFU functions instead of AS/400 function keys.
To display specific records, type a key field value and press Enter. That record
appears. You can also use Page Up (Roll Down) and Page Down (Roll Up) to
page through records.
Security Considerations
Default security settings for the AS/400 allow any user access to:
DFU commands (STRDFU, CHGDTA, DSPDTA, UPDDTA, DLTDFUPGM,
CRTDFUDSPF)
DFU applications (programs and display files) that you create by running
STRDFU
Data files accessed by DFU applications
You must change the *USE authority of DFU commands if you need to restrict
access to DFU. Application and data file owners must set the *PUBLIC authority to
avoid unwanted access.
A single DFU data entry display can add records to only one physical file member.
If a DFU data entry display is defined on a logical file record format, the DFU data
entry display can add records if the logical file record format is linked to only one
physical file member. An example is shown below:
Except for data entry display C because it is linked to two physical file members, all
data entry displays can add records.
Note: DFU does not support predefined joined files.
The relationship between logical file record formats and physical file members is
defined by the DTAMBRS parameter of the CRTLF (Create Logical File) command
and the ADDLFM (Add Logical File Member) command. See the CL Reference for
a description of these commands.
DFU uses the following method for suppressing errors in all fields containing invalid
data:
In a packed or zoned field, an invalid sign is forced to a positive sign value as
follows:
Packed Field: 01 23 4E 01 23 4F
Zoned Field: F1 F2 E3 F1 F2 F3
In a packed field, any hex digit (other than the sign digit) field that is greater
than hex 9 is forced to hex 0 as follows:
Packed Field: EA 1B 2F 00 10 2F
In a zoned field, any hex digit in the numeric half-byte of each byte that is
greater than hex 9 is forced to hex 0. Any hex digit in the zone half-byte of
each byte less than hex F (except the sign half-byte) is forced to hex F. Exam-
ples of these circumstances follow:
Zoned Field:
(a) FA F1 F4 D2 F0 F1 F4 D2
(b) B1 B2 F3 D4 F1 F2 F3 D4
If error suppression is successful, DFU shows the corrected data on your data entry
display. The corrected fields are written back to the data file only if you subse-
quently change the corrected field on the data entry display. For example, imagine
that fields A and B are zoned fields that contain an invalid hex 40. DFU sup-
presses the error by changing the hex 40 to zero. The zero is what shows on your
data entry display. If you change the zero (error suppressed hex 40) in field A to
valid data but do not change the zero (error suppressed hex 40) in field B, then
only field A is written back to the data file. The original contents of field B (hex 40)
are undisturbed.
If error suppression was not selected, or if your record contains invalid data in a
nonnumeric field, the record is not displayed and you receive an error message.
Characters marked with an asterisk (*) are supplied by IBM in the Japanese basic
DBCS. Many frequently used Japanese Kanji characters are also included in this
basic DBCS. Additional Japanese Kanji characters and user-defined characters not
included in the Japanese basic DBCS comprise the Japanese extended double-
byte character set, and are called extension characters. Extension characters
require additional processing to be displayed and printed, basic characters do not.
Double-byte character sets differ from alphanumeric character sets in the following
ways:
The Japanese alphanumeric character set consists of only Roman (A-Z) and
Katakana alphabets, and numerals (0-9).
The Korean alphanumeric character set consists of the uppercase and lower-
case Roman (A-Z, a-z) and Korean Jamo alphabets, and numerals (0-9).
The traditional and simplified Chinese alphanumeric character sets consist of
the uppercase and lowercase Roman (A-Z, a-z) alphabet and numerals (0-9).
Note: Alphanumeric characters are also included in the DBCS. When using
DBCS versions of alphanumeric characters, however, the characters are
considered DBCS.
Software Requirements
You can create DFU programs containing DBCS fields on both single-byte and
double-byte workstations, but you can run them in change mode on a DBCS work-
station. DFU programs containing DBCS fields that are run on single-byte work-
stations are automatically put into DISPLAY mode.
To program in DFU with DBCS characters, start each DBCS character string with
an SO character and end it with an SI character.
With open fields, you can mix alphanumeric and DBCS characters. DBCS charac-
ters must be within the SO and SI characters.
Printing audit reports with DBCS fields on a single-byte printer produces an error
message. The DBCS data does not appear on the report.
Programming Considerations
Part of the ideographic Japanese character (IGC) feature is the ability to use
Katakana (single byte) characters. Alphanumeric characters and Katakana charac-
ters are one position each. DBCS characters are two positions each.
A string of DBCS characters begins with a shift-out character of one position, fol-
lowed by DBCS characters of two positions each, followed by a shift-in character of
one position. This configuration means each DBCS character string is an even
number of positions at least four positions long for a single DBCS character. The
following shows a string of three DBCS characters, where the first and fifth charac-
ters represent the shift-out and shift-in characters respectively. This example
requires eight character positions: one for the shift-out character, two for each
DBCS character, and one for the shift-in character.
In DFU, you can select DBCS fields on the Select and Sequence Fields display as
shown in the following figure.
Select fields and their sequence or press F21 to select all; press Enter.
Bottom
F3=Exit F5=Refresh F12=Cancel F14=Display definition
F2ð=Renumber F21=Select all
á ñ
More...
á ñ
The value in the Double-byte character attribute prompt may differ from the one on
your display, depending on the value that is specified in the DDS file description. A
description of the DBCS-specific information on the Specify Extended Field Defi-
nition display is as follows.
DFU supports data description specifications (DDS) extensions for DBCS support in
database files only.
DFU Migration
The AS/400 DFU migration aid works with R-modules (DFU subroutine members),
and O-modules (DFU screen load members). You must, therefore, compile your
DFU source into System/36 R-modules before running the migration aid.
On System/36, you can define a DFU program for inquiry purposes only. This
means that the DFU inquiry program cannot update records or insert records into a
file. On the AS/400 system, however, DFU does not distinguish between inquiry
and update programs. This causes DFU inquiry programs to become update-
capable when migrated to the AS/400 system. You can use this System/36 inquiry
program to update the file on the AS/400 system. To limit this System/36 inquiry
program to only inquiry, selectively limit the use of the CHGDTA command. The
Security – Reference manual contains information on selectively limiting the use of
specific commands.
Printing Reports
In the AS/400 environment, you must use Query to print reports instead of DFU
LIST. For further details, see Query/400 Use, SC41-3210. If you are in the
System/36 environment, you can use DFU LIST.
Deleting Records
System/36 marks records as deleted by placing a specified character in the record.
Unless delete codes are specified, the AS/400 system physically deletes the record.
Blank Records
When you use the BLDFILE command to create a file in System/36, the records of
the file are created with blanks. System/36 treats all blank records (X'40') as
empty. If you create a file on the AS/400 system with externally described data,
the numeric fields are filled with zeros, and the records do not appear empty to
DFU.
CHGDTA Command
In the System/38 environment, the CHGDTA command starts the System/38 DFU
product. In the AS/400 environment, the CHGDTA command starts the AS/400
DFU product.
AS/400 DFU does not support this function. To achieve a similar result in the
AS/400 environment, press F11 (Change) to go to the Change mode. Type the key
for the record you want to update and press Enter. The record you want to update
appears. You can now change this record.
ADTS/400: Source Entry Utility, SC09-1774 The related System/36 publications are:
Introducing Application Development ToolSet/400 Data File Utility List for the System/36 Environment
and the AS/400 Server Access Programs, User’s Guide and Reference, SC09-1362
SC09-1939
System/36-Compatible RPG II User’s Guide and
The orderable features of 5763-PW1 are: Reference, SC09-1818
Index 87
running DFU programs (continued)
P overview 1, 35
parameters procedure 1, 35
*CURLIB 33 processing new records 36
*LIBL 33 selecting type of run 35
password 4 runtime function keys 3
Print Record function key 59
processing
multiple records 23 S
new records 36 saving DDS source 48
program-described data 2 security control 73
programming languages versus DFU 2 Select and Sequence Fields display
programs description 13, 28
See data file utility (DFU) example entries 13, 28
publications, related 83 for DBCS capable DFU 78
prompts 13
RPG II-described files 66
R Select Data File Member display
record description 36
deleting 37 prompts 36
formats Select Field for Record Number display
changing during data entry 36 description 27
selecting 12, 28 example entries 28
number prompts 28
choosing field to store 27 Select File display 11
qualifying fields 27 Select Program display
selecting 32 description 32
Record advance function key 59 example entries 32
Record backspace function key 59 example entries to delete a program 55
related publications 83 for deleting a program 55
remote systems 5 Select Record Format display 37
requesting DFU Select record type function key 59
AS/400 Data File Utility (DFU) menu 4 Select S/36 Style Options display 64
Command Entry display 4 selecting fields
options 5 for data entry 13, 28
procedure 4 for extended definition 14, 33
reviewing program definition order 13, 28
data file detail 21 shift-in (SI) character 78
program detail 20 shift-out (SO) character 78
program summary 18 sign on 4
RPG II Source Entry Utility (SEU) 57
data files source member creation 57
F specifications 3, 57 Specify Extended Definition display
file descriptions 57 alphanumeric
I specifications 3, 57 description 14
System/36 environment 3 example entries 15
using a text editor 57 prompts 16
specifications 3 RPG II-described files 67
RPG versus DFU 2 numeric
Run Status display 38 description 16
running DFU programs example entries 16
available functions 35 fields 18
check status 38 Specify Validity checks display
ending sessions 39, 40 prompts for alphanumeric fields 17
example 35 prompts for numeric fields 16
features 1
T
tailoring a DFU display
Create Display File 52
customizing the data entry display 48
procedure 48
saving the DDS source 47
text editors
source entry utility (SEU) 57
using 58
total number of changes 41
U
unsupported data types 75
Update Data (command) 4
Update Data Using Temporary Program display 44
updating data using temporary programs
End Data 45
example 43
overview 43
procedure 44
UPDDTA command 4
V
validating multiple field entries 2
viewing data file records 33
W
Work with Fields display
description 14
example entries 14
prompts 14
RPG II-described files 67
Work with Record Formats display
description 12, 28, 32
example entries 13, 28, 32
prompts 13
Work with Record Types display
description 64
example entries 64, 65
Index 89