0% found this document useful (0 votes)
53 views

Iddu Use: AS/400 Advanced Series

Uploaded by

Kumar E
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
53 views

Iddu Use: AS/400 Advanced Series

Uploaded by

Kumar E
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 163

AS/400 Advanced Series IBM

IDDU Use
Version 4

SC41-5704-00
AS/400 Advanced Series IBM
IDDU Use
Version 4

SC41-5704-00
Take Note!

Before using this information and the product it supports, be sure to read the general information under “Notices” on page ix.

First Edition (August 1997)

This edition applies to the licensed program IBM Operating System/400 (Program 5769-SS1), Version 4 Release 1 Modification 0,
and to all subsequent releases and modifications until otherwise indicated in new editions.

Make sure that you are using the proper edition for the level of the product.

Order publications through your IBM representative or the IBM branch serving your locality. If you live in the United States, Puerto
Rico, or Guam, you can order publications through the IBM Software Manufacturing Solutions at 800+879-2755. Publications are not
stocked at the address given below.

IBM welcomes your comments. A form for readers’ comments may be provided at the back of this publication. You can also mail
your comments to the following address:

IBM Corporation
Attention Department 542
IDCLERK
3605 Highway 52 N
Rochester, MN 55901-7829 USA

or you can fax your comments to:

United States and Canada: 800+937-3430


Other countries: (+1)+507+253-5192

If you have access to Internet, you can send your comments electronically to [email protected]; IBMMAIL, to
IBMMAIL(USIB56RZ).

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.

 Copyright International Business Machines Corporation 1997. All rights reserved.


Note to U.S. Government Users — Documentation related to restricted rights — Use, duplication or disclosure is subject to
restrictions set forth in GSA ADP Schedule Contract with IBM Corp.
Contents
Notices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix
Trademarks and Service Marks . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix

About IDDU Use (SC41-5704) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi


Who Should Use This Book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi
Prerequisite and Related Information . . . . . . . . . . . . . . . . . . . . . . . . . xi
Information Available on the World Wide Web . . . . . . . . . . . . . . . . . . . . xi

Part 1. Introduction to Data Definition

Chapter 1. File Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-1


Fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2
Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2
Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2
File Storage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2
File Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3
Using Data in Documents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-4
Querying Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-4
Maintaining Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-5
Describing Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-6

Chapter 2. Data Definition Concepts . . . . . . . . . . . . . . . . . . . . . . . 2-1


Database Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-1
Data Dictionaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2
Data Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2
Field Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-3
Record Format Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-3
File Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-3
How Do All These Definitions Fit Together? . . . . . . . . . . . . . . . . . . . 2-4
Interactive Data Definition Utility (IDDU) . . . . . . . . . . . . . . . . . . . . . . . 2-4
IDDU Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-5
IDDU Capabilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-7
Using Data in Queries and Documents . . . . . . . . . . . . . . . . . . . . . . . 2-7

Chapter 3. Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-1


Getting to IDDU . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-1
Interactive Data Definition Utility (IDDU) Menu . . . . . . . . . . . . . . . . . . . 3-1
Work with ... Displays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-2
IDDU Displays to Create or Change Objects . . . . . . . . . . . . . . . . . . . . 3-4
Creating Data Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-6
Working with Data Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-7
Practicing with IDDU . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-7

Part 2. Defining Data

Chapter 4. Working with Data Dictionaries . . . . . . . . . . . . . . . . . . . 4-1


Creating a Data Dictionary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-1
Securing a Data Dictionary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-2
Describing a Data Dictionary . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-3

 Copyright IBM Corp. 1997 iii


Maintaining a Data Dictionary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-3

Chapter 5. Defining Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-1


Planning a File Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-1
Creating a File Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-5
Creating a Record Format for a File Definition . . . . . . . . . . . . . . . . . 5-7
Selecting a Record Format for a File Definition . . . . . . . . . . . . . . . . . 5-8
Maintaining File Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-9

Chapter 6. Defining Record Formats . . . . . . . . . . . . . . . . . . . . . . . 6-1


Planning a Record Format Definition . . . . . . . . . . . . . . . . . . . . . . . . 6-1
Creating a Record Format Definition . . . . . . . . . . . . . . . . . . . . . . . . . 6-4
Selecting a Field Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-6
Maintaining Record Format Definitions . . . . . . . . . . . . . . . . . . . . . . . 6-7

Chapter 7. Defining Fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-1


Planning a Field Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-1
Basic Characteristics of All Field Definitions . . . . . . . . . . . . . . . . . . . 7-5
Additional Characteristics for All Field Types . . . . . . . . . . . . . . . . . . 7-6
Additional Characteristics for Numeric Fields . . . . . . . . . . . . . . . . . . 7-8
Additional Characteristics for Character and DBCS Fields . . . . . . . . . . 7-9
Additional Characteristics for Date/Time/Timestamp Fields . . . . . . . . . 7-10
Creating a Field Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-12
Maintaining Field Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-14

Chapter 8. Working with Database Files . . . . . . . . . . . . . . . . . . . . 8-1


Creating a Database File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-1
Securing a Database File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-2
Entering Data into a Database File . . . . . . . . . . . . . . . . . . . . . . . . . 8-3

Part 3. Maintaining Data, Definitions, and Dictionaries

Chapter 9. Field Editing Techniques . . . . . . . . . . . . . . . . . . . . . . . 9-1


Edit Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-1
Edit Code Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-2
Edit Word . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-3
Alias (Alternative Name) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-4
Keyboard Shift and Data Type . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-4
Character Keyboard Shift . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-4
Numeric Keyboard Shift . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-6
DBCS Data Type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-7
Date/Time Data Type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-8

Chapter 10. Record Format Definition Considerations . . . . . . . . . . . 10-1


Using Record Identification Codes . . . . . . . . . . . . . . . . . . . . . . . . . 10-1

Chapter 11. File Definition Considerations . . . . . . . . . . . . . . . . . . 11-1


Selecting Key Field Sequence . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-1
Changing File Key Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-2
Changing Key Field Sequence Attributes . . . . . . . . . . . . . . . . . . . . . 11-3

Chapter 12. Maintaining Definitions . . . . . . . . . . . . . . . . . . . . . . 12-1


Changing a Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-1

iv IDDU Use V4R1


Changing a File Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-2
Changing a Record Format Definition . . . . . . . . . . . . . . . . . . . . . 12-2
Changing a Field Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-3
Exiting the Definition Process . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-4
Copying Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-4
Deleting Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-6
Printing Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-6
Renaming Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-10
Displaying Where Definitions Are Used . . . . . . . . . . . . . . . . . . . . . 12-10
Recovering a Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-11

Chapter 13. Maintaining Data Dictionaries . . . . . . . . . . . . . . . . . . 13-1


Changing a Data Dictionary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-1
Deleting a Data Dictionary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-2
Printing the Contents of a Data Dictionary . . . . . . . . . . . . . . . . . . . . 13-2
Other Dictionary Maintenance . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-3
Data Dictionary Recovery: Saving and Restoring . . . . . . . . . . . . . . 13-3
Copying a Data Dictionary . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-4
Renaming a Data Dictionary . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-4
Considerations When SQL/400 Users Share Dictionaries . . . . . . . . . . . 13-4
SQL Terminology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-4
SQL Definitions Used by IDDU . . . . . . . . . . . . . . . . . . . . . . . . . 13-5
IDDU Definitions Used by SQL . . . . . . . . . . . . . . . . . . . . . . . . . 13-5

Chapter 14. Maintenance Requiring Commands or Programming . . . . 14-1


Linking and Unlinking Files and Definitions . . . . . . . . . . . . . . . . . . 14-1
Creating Definitions from Files . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-1
Making Changes to Definitions That Affect Files . . . . . . . . . . . . . . . . . 14-2
Changes Affecting Externally Described Files . . . . . . . . . . . . . . . . . 14-3
Changes Affecting Program-Described Files . . . . . . . . . . . . . . . . . 14-3
Creating a New Version of a Definition . . . . . . . . . . . . . . . . . . . . . 14-4
Copying Data Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-5
Differences between Program-Described and Externally Described Files . . 14-6

Chapter 15. AS/400 Security and IDDU . . . . . . . . . . . . . . . . . . . . 15-1


Authority Requirements for IDDU Operations . . . . . . . . . . . . . . . . . . . 15-1
Authority Requirements for Non-IDDU Dictionary Operations . . . . . . . . . 15-2
Authority/Rights Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-2

Chapter 16. Dictionary Files . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-1


Data Dictionary Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-1
Associated Logical Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-1
Cross-Reference Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-2

Appendixes

Appendix A. Reviewing File Processing (Preparing for IDDU) . . . . . . A-1


Current Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-1
Manual File Processing Operations . . . . . . . . . . . . . . . . . . . . . . . A-1
Computer File Processing Operations . . . . . . . . . . . . . . . . . . . . . . . A-2
Analyze File Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-2
Field Design Considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-3

Contents v
Appendix B. Practice Exercise . . . . . . . . . . . . . . . . . . . . . . . . . B-1

Appendix C. Data Descriptions on the AS/400 System . . . . . . . . . . . C-1


Describing Data on the AS/400 System . . . . . . . . . . . . . . . . . . . . . . C-1
Data Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C-1
Data Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C-1
Dictionary Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C-2
Database Files on the AS/400 System . . . . . . . . . . . . . . . . . . . . . . C-3
Files and Members . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C-3
Program-Described Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C-4
Externally Described Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . C-4

Appendix D. IDDU Commands . . . . . . . . . . . . . . . . . . . . . . . . . . D-1

Appendix E. Differences between IDDU on the AS/400 System and


System/36 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E-1
Conceptual Differences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E-1
Operational Differences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E-1
Command Differences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E-2

Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . H-1

Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . X-1

vi IDDU Use V4R1


Figures
1-1. Examples of Customer Data . . . . . . . . . . . . . . . . . . . . . . . . 1-1
1-2. Example of Employee Records . . . . . . . . . . . . . . . . . . . . . . 1-1
7-1. Date Format Options . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-11
7-2. Time Format Options . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-11
12-1. Example of All Information Printed for a File Definition . . . . . . . . 12-9
15-1. Generic Levels of Authority with IDDU . . . . . . . . . . . . . . . . . 15-1
15-2. Generic Levels of Authority for Dictionary Operations . . . . . . . . 15-2
15-3. Generic Authority Levels and Specific Rights . . . . . . . . . . . . . 15-2

 Copyright IBM Corp. 1997 vii


viii IDDU Use V4R1
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 product, program,
or service is not intended to state or imply that only that IBM product, program, or service may be used.
Subject to IBM's valid intellectual property or other legally protectable rights, any functionally equivalent
product, program, or service may be used instead of the IBM product, program, or service. The evaluation
and verification of operation in conjunction with other products, except those expressly designated by IBM,
are the responsibility of the user.

IBM may have patents or pending patent applications covering subject matter in this document. The fur-
nishing 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, 500 Columbus Avenue, Thornwood, NY
10594, U.S.A.

Licensees of this program who wish to have information about it for the purpose of enabling: (i) the
exchange of information between independently created programs and other programs (including this one)
and (ii) the mutual use of the information which has been exchanged, should contact the software interop-
erability coordinator. Such information may be available, subject to appropriate terms and conditions,
including in some cases, payment of a fee.

Address your questions to:

IBM Corporation
Software Interoperability Coordinator
3605 Highway 52 N
Rochester, MN 55901-7829 USA

This publication could contain technical inaccuracies or typographical errors.

This publication may refer to products that are announced but not currently available in your country. This
publication may also refer to products that have not been announced in your country. IBM makes no
commitment to make available any unannounced products referred to herein. The final decision to
announce any product is based on IBM's business and technical judgment.

This publication contains examples of data and reports used in daily business operations. 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.

This publication contains small programs that are furnished by IBM as simple examples to provide an
illustration. These examples have not been thoroughly tested under all conditions. IBM, therefore, cannot
guarantee or imply reliability, serviceability, or function of these programs. All programs contained herein
are provided to you "AS IS". THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE EXPRESSLY DISCLAIMED.

Trademarks and Service Marks


The following terms, denoted by an asterisk (*) in this publication, are trademarks of the IBM Corporation
in the United States or other countries or both:

 Copyright IBM Corp. 1997 ix


Application System/400 OS/400
AS/400 SAA
IBM Systems Application Architecture
OfficeVision SQL/400
OfficeVision/400 400
Operating System/400

Microsoft, Windows, and the Windows 95 logo are trademarks or registered trademarks of Microsoft Cor-
poration.

PC Direct is a trademark of Ziff Communications Company and is used by IBM Corporation under license.

UNIX is a registered trademark in the United States and other countries licensed exclusively through
X/Open Company Limited.

C-bus is a trademark of Corollary, Inc.

Java and HotJava are trademarks of Sun Microsystems, Inc.

Other company, product, and service names, which may be denoted by a double asterisk (**), may be
trademarks or service marks of others.

x IDDU Use V4R1


About IDDU Use (SC41-5704)
This book contains information on the concepts and procedures used in the AS/400
interactive data definition utility (IDDU) as well as information on maintaining and
improving dictionaries, definitions, and database files.

Before you use this book, you must be familiar with the introductory material for
using the AS/400 system, such as System Operation for New Users, SC41-3200.
A knowledge of high-level programming languages is helpful, but not necessary to
use IDDU.

If you want to use all of the AS/400 database capabilities, you must use data defi-
nition specifications (DDS) or the Structured Query Language (SQL). Read DB2 for
AS/400 Database Programming, SC41-5701, for information about database
design. Read the DDS Reference, SC41-5712, for information about DDS. Read
the DB2 for AS/400 SQL Reference, SC41-5612, and DB2 for AS/400 SQL Pro-
gramming, SC41-5611, for information about SQL.

For a list of related publications, see the Bibliography.

Who Should Use This Book


This book is written for persons using the OS/400 interactive data definition utility
(IDDU) to define data to be used in queries and documents. Data definitions and
data files created using IDDU are used by the data file utility (DFU), OfficeVision,
Query/400, and Client Access/400.

Prerequisite and Related Information


For information about other AS/400 publications (except Advanced 36), see either
of the following:
Ÿ The Publications Reference book, SC41-5003, in the AS/400 Softcopy Library.
Ÿ The AS/400 Information Directory, a unique, multimedia interface to a
searchable database that contains descriptions of titles available from IBM or
from selected other publishers. The AS/400 Information Directory is shipped
with the OS/400 operating system at no charge.

Information Available on the World Wide Web


More AS/400 information is available on the World Wide Web. You can access this
information from the AS/400 home page, which is at the following uniform resource
locator (URL) address:
http://www.as4ðð.ibm.com

Select the Information Desk, and you will be able to access a variety of AS/400
information topics from that page.

 Copyright IBM Corp. 1997 xi


xii IDDU Use V4R1
Part 1. Introduction to Data Definition
This part first introduces computer file concepts and establishes the relationships
between the information used in a business and the data that is handled by a com-
puter. Then it discusses the concepts of data dictionaries and data definitions as
created by the interactive data definition utility (IDDU). Finally, it tells how to start
and use IDDU to describe the data you will use in queries and documents.

Information on creating elements in the process (data dictionary, field/format/file


definitions, and the database file) is discussed in “Part 2. Defining Data.”

 Copyright IBM Corp. 1997


IDDU Use V4R1
Chapter 1. File Concepts
Before you read about how to use the interactive data definition utility (IDDU) for
describing your data in the AS/400* system, you should understand what data is
and how it is stored on the computer system.

Data is simply the information used in your business: customer names, account
balances, part numbers, and so forth. The data in your business can be kept in a
variety of ways and used for a variety of purposes.

For example, you may keep names and addresses and other information about
customers in an alphabetical arrangement of index cards, like this:
┌───────────────── ┌───────────────── ┌─────────────────
│ A─12345 │ A─34567 │ B─56789
│ Smith Company │ STN Company │ TUVW Corp.
│ Mr P W Bonner │ Mr Alex Jones │ Ms J Stiles
│ PO Box 9753 │ 1717 44 Street │ 5555 33 Ave.
│ Chicago, IL │ New York, NY │ Chicago, IL
│ 22334─4567 │ 65ð53─5678 │ 22334─6789
│ (516) ð32─5654 │ (2ð1) ð45─8675 │ (516) ð24─1222
Figure 1-1. Examples of Customer Data

You might use these names and addresses to:


Ÿ Address envelopes for a large mailing
Ÿ Type personalized letters as part of an advertising campaign
Ÿ Type reports summarizing different types of accounts

Or you may keep employee records for your company or department arranged on a
sheet of paper, like this:

Figure 1-2. Example of Employee Records


Serial Hiring Street Zip
Number Date Name Address City State Code Telephone
02841 11/12/89 Susan P Gantner 907 Abbey Hwy Mushroom Manor OR 67891 617 334-5551
12381 07/31/88 Perry C Swenson 19821 Metro Hwy St. Paul OR 67891 617 334-1515
23119 02/24/87 Matt F Thomas 961 S 19th Ave Piney Island OR 67890 617 235-5151

You might use this information to:


Ÿ Supply address and telephone lists
Ÿ Type letters relating to a company event
Ÿ List days of vacation or absence for each employee
Ÿ Supply employee lists by department or job title

Whether stored on the computer or on paper in your office file drawer, data is
organized into fields, records, and files.

 Copyright IBM Corp. 1997 1-1


Fields
A single item of data is called a field. For example, A-12345 on the index card is
data in the account number field; 907 Abbey Hwy on the employee list is data in
the street address field:
┌─────────────────
│ A─12345 ─ ─ ─ ─ ─ ─ Account number field
│ Smith Company
│ Mr P W Bonner
│ PO Box 9753
│ Chicago, IL
│ 22334─4567
│ (516) ð32─5654

Serial Hiring Street


Number Date Name Address City
02841 11/12/89 Susan P Gantner 907 Abbey Hwy Mushroom Manor

Records
A record is a collection of fields that holds information about a particular subject.
For example, each index card is a name-and-address record of a particular cus-
tomer; each line on the list is a record of a particular employee:

Customer Record

┌─────────────────
│ A─12345
│ Smith Company
│ Mr P W Bonner
│ PO Box 9753
│ Chicago, IL
│ 22334─4567
│ (516) ð32─5654

Employee Record

Serial Hiring Street


Number Date Name Address City
02841 11/12/89 Susan P Gantner 907 Abbey Hwy Mushroom Manor

Files
A file is a set of related records. For example, the stack of index cards with infor-
mation on each of your customers makes up a file; so do all the pages of employee
information.

File Storage
Computer files are magnetically recorded on specific areas of disk storage, some-
what like tracks on a phonograph album, so they take up considerably less space
and are less easily damaged than the paper files in your cabinet drawer.

1-2 IDDU Use V4R1


A-12345SMITH COMPANY PO BOX 9753 CHICAGO IL22334455675160325654
RSLL270-0

The specific areas of storage that hold files on this system are called libraries,
which could be compared to the drawer or cabinet holding the file folders in your
office.

Library

File
Record
Field

RSLL269-0

File Processing
File processing includes recording, classifying, sorting, calculating, storing,
selecting, retrieving, reproducing, reporting, communicating, and distributing data to
perform tasks required in your business.

Date Process Information

Name
Select
Address Label
appropriate
Account
fields
Number

RSLL259-0

Your work with files could include the tasks described in the following sections.

Chapter 1. File Concepts 1-3


Using Data in Documents
The word processing function of the IBM* Systems Application Architecture* (SAA*)
OfficeVision* program (if it is installed on your system) allows you to merge data
from your files into your text documents. Information on preparing documents is in
Using OfficeVision/400 Word Processing.

Combining Data and Text: A name and address are taken from a file and com-
bined with a form letter.

October 1, 1982

Alfredo R. Romero
2948 Skyview Dr.
Indianapolis, IN 28449

Dear Mr. Romero:

Thank you for becoming one of our company’s newest


stockholders. We appreciate your confidence in our
policies as is evidenced by your willingness to share
in the ongoing concerns of our firm. Enclosed is a
copy of the latest annual report and the most recent
stockholders’ information letters.

We look forward to a long and mutually profitable


relationship with you.

Sincerely,

Margaret W. Trimbull, President

RSLL257-1

Querying Data
You can request information from your files (such as search for, select, and list
particular records) using the AS/400 Query program (if it is installed on your
system). Information on writing queries is in the Query/400 Use book.

Looking at Each File Record: You need to find an employee’s hiring date.

RSLL255-1

Listing All the File Information: You need to print a list of all your customers.

1-4 IDDU Use V4R1


Smith Company
STN Company
TUVW Corp.

RSLL261-0

Selecting Records: You need to print a list of all your New York customers.

STN Corp.
NTN Inc.
Tern Co.

RSLL256-2

Maintaining Data
Adding, changing, and deleting records are all file maintenance activities. You can
do this work on the AS/400 system using a part of the AS/400 Application Develop-
ment Tools (if they are installed on your system) called the data file utility (DFU).
Information on maintaining data files is in the ADTS/400: Data File Utility book.

Adding Records to a File: A new employee name must be added to the


employee file in the proper alphabetic sequence.

Kay
Balar

RSLL252-1

Changing Records: An employee’s address must be changed.

Matt
Thomas
961 S 19th Ave.

RSLL253-2

Chapter 1. File Concepts 1-5


Deleting Records: An outdated record should be removed from the file.

TRASH

RSLL254-1

Describing Data
Before you can use any of the programs just mentioned to work with your data, you
must describe (or define) that data to the system. The next chapter describes the
concepts of defining data to be used in queries and documents.

1-6 IDDU Use V4R1


Chapter 2. Data Definition Concepts
Any program that uses a file requires some sort of description of that file and the
data in it. Just as you might tell someone in your office to look for the account
number in the upper left corner of an index card, you must also tell the computer
where your data starts, where it ends, whether it is numbers or letters, and so forth.

For example, a description of data on a customer’s account balance would include


at least such information as:
Ÿ The name of the field (perhaps BALANCE)
Ÿ How long the field is (probably seven positions, to contain numbers up to
99 999.99; the separators are added later)
Ÿ Where among the other fields in the record this field is located (for example,
after account number but before company name)
Ÿ What type of data the field contains (numeric, in this case)
Ÿ Whether the data includes a decimal point, and if so, how many positions (typi-
cally two)

Depending on how one is using the system, there are several methods of
describing data:
Ÿ Using statements within an application program written in a high-level language
such as RPG or COBOL. Data described in a program is known as program-
described data.
With this method, the file and the descriptions of its data are known only to that
application program; they cannot be used by any other program on the system.
Each program that refers to a file must contain its own set of file and data
descriptions.
Ÿ Using system functions (such as DDS or IDDU) to create data descriptions (or
definitions) and keep them with the file they describe. Data described outside
of an application program is known as externally described data.
With this method, the data descriptions can be shared by all programs using
that file.

When the interactive data definition utility (IDDU) is used to describe data, it col-
lects the data definitions that it produces into a data dictionary.

Database Files
A database is a collection of data files in the system that are described together in
one place using a common method of description that allows them to be used by
more than one program. Individual data files thus described are sometimes also
called database files.

 Copyright IBM Corp. 1997 2-1


Data Dictionaries
Just as a word dictionary contains definitions of the words used in a language, a
data dictionary contains definitions of the data stored on your system. A single
data dictionary could contain definitions of all the files, records, and fields used on
your system. Or several separate data dictionaries could define the data used by
different applications. You could, for example, have one data dictionary for cus-
tomer account applications and another for employee applications.

Dictionaries, Libraries, and Files


You can have as few or as many dictionaries as your business needs, but each
must be stored in a separate library on the system (and each has the same name
as its library). The actual data files can, but need not, be in the same library as the
data dictionary that describes them.

Library 1 Library 2

Data Dictionary 1 File B

Data definitions for File A data


.
.
Data definitions for File B .

File A

data
.
.
.

RSLL265-0

Advantages of a Data Dictionary


With a data dictionary, you can reduce the number of times you describe data to
your system because the data definitions are reusable; once you have defined a
street address field, for example, you can use that field definition in any record
format definition that describes a record containing street addresses.

And if you need to change an attribute of a field (for example, if your customer
account numbers now include alphabetic characters as well as numbers), you have
fewer definitions to change, and they are all in one place.

The dictionary also keeps track of where definitions are used and what files they
describe. Thus you can delete definitions that are not used or perhaps protect a
definition used in a special way in a particular file.

Data Definitions
Remember, the dictionary does not contain the data itself. Instead, it contains
information about various aspects of the data: location, format, attributes, structure,
use, and relationships.

2-2 IDDU Use V4R1


Because data is organized into files, records, and fields, a data dictionary contains
three kinds of data definitions:
Ÿ Field definitions
Ÿ Record format definitions
Ÿ File definitions

Field Definitions
Fields are single pieces of information within a computer record, similar to each of
the areas on an invoice. Field definitions, then, are the instructions that tell you
important information about the fields in a record:
What kind of data does the field contain, numbers or letters?
How long is the field? If the field contains a number, how many positions
follow the decimal point?
How is data in the field printed or displayed? What is the thousands sepa-
rator? What is the currency symbol? Where is the minus sign shown?

Record Format Definitions


A record format definition lists the fields in the record and identifies the order in
which the fields appear.

You can compare a record format definition to instructions that describe the kinds
of information in a document. An invoice, for example, contains blanks that
someone must fill in, such as a customer’s name and address. In effect, a record
format definition supplies the blank form for a computer record.

Record Format

.
Field 1 Field 2 Field 3 Field 4
RSLL266-1

File Definitions
A file definition identifies the kinds of records contained in a computer file.

Just as we compared a computer file to a folder in a cabinet drawer, you can


compare a file definition to labels that describe the kinds of documents contained in
the folder.

Current Employee Addresses

RSLL267-1

Chapter 2. Data Definition Concepts 2-3


How Do All These Definitions Fit Together?
Just as fields and records fit together to form data files on your system, data defi-
nitions work together to define those files. Field definitions are grouped together to
form record format definitions (and are often used in more than one format), and
then record format definitions are grouped together to form file definitions, as
shown in this illustration:

Field definitions Format definitions File definitions


Serial number field Employee record Employee file
Serial number field Employee
Middle initial field Last name field record format
Title field
Company name field First name field
Middle initial field Customer file
Subtitle field Subtitle field Customer
Street address field record format
City field City field
State field
First name field Zip code field
Telephone number field
Date hired field Date hired field

Country field
Customer record
Account number field Account number fie
Company name field
State field Title field
First name field
Street address field Middle initial field
Last name field
Last name Subtitle field
Street address field
Telephone number field City field
State field
Title field Zip code field
Country field
Zip code field RSLL268-1

The Operating System/400* (OS/400*) program that helps you do this grouping is
the interactive data definition utility (usually called IDDU).

Interactive Data Definition Utility (IDDU)


The interactive data definition utility (IDDU) is a program that guides you through
the steps required to describe (define) the characteristics of data and the contents
of files stored on your system and to maintain those data definitions in data diction-
aries.

The term interactive (in the program’s name) is defined as pertaining to the
exchange of information between people and a computer, and to you that means
when you give the program some piece of information, it responds immediately and
appropriately. For example:
If you type a 3 on the Select Definition Type display to indicate that File is the
definition type you want, IDDU takes you directly to the Work with File Defi-
nitions display.
If you specify that the field type is Character, IDDU shows you only the addi-
tional prompts required for character data; you don’t have to page through all
the displays that define numeric data.

2-4 IDDU Use V4R1


If you make an error entering data on a display, IDDU displays a message
telling you what is wrong as soon as you press the Enter key, so you can
quickly correct the mistake and proceed with your task.

IDDU Features
IDDU also includes a number of other features that make it easy to work with data
dictionaries and data definitions:
Ÿ Prompts
You can respond to people-language phrases instead of remembering some-
what obscure commands and keyword parameters; for example, Definition type
instead of DFNTYPE (type), Data dictionary instead of DTADCT (name).

à Select Definition Type


ð
Type choices, press Enter.

Definition type . . . . . . . _ 1=Field


2=Record format
3=File

Data dictionary . . . . . . . default___ Name, F4 for list

Ÿ Assumed choices (defaults)


You can accept IDDU’s best guess as the most common response to a prompt
and only type a choice when you want something different. For example,
packed is the assumed choice for numeric data type, but you can specify one
of three others instead.

à Numeric Field Options


ð
Definition . . . . . : XXXXXXXXXX Dictionary . . . . . : XXXXXXXXXX

Type choices, press Enter.

Numeric data type . . . . . . . . 2 1=Zoned, 2=Packed


3=Binary, 4=Floating point
Column headings:
Heading 1 . . . . . . . . . . . ____________________
Heading 2 . . . . . . . . . . . ____________________
Heading 3 . . . . . . . . . . . ____________________

Ÿ Lists
You can select from a list of all the available items instead of having to
remember and type names.

Chapter 2. Data Definition Concepts 2-5


Field
Opt Definition Date Text
_ __________
_ ACCOUNTNUM 1ð/19/87 Customer account type and number (x-nnnnn)
_ COMPANY 1ð/19/87 Customer's company name
_ DATE 1ð/ð2/87 (mmddyy)
_ FIRSTNAME 1ð/ð8/87 Employee's given name
_ LASTNAME 1ð/ð8/87 Employee's surname
_ SERIALNUM 1ð/ð8/87 Employee's serial number (nnnnnnn)
_ TELEPHONE 1ð/ð2/87 Area code + phone number (nnn-nnn-nnnn)

F3=Exit F5=Refresh F1ð=Work with database files


F11=Display names only F12=Cancel F22=Work with data dictionaries

á ñ

Ÿ Function keys
You can press a single key instead of learning and typing lengthy or cryptic
command instructions.

Data dictionary . . __________ Name, F4 for list

F3=Exit F4=Prompt F1ð=Work with database files


F12=Cancel F22=Work with data dictionaries

á ñ
Ÿ Online information
You can request and read information about IDDU and the system right at your
display station instead of having to keep this and other books nearby.

à ð
Type (Field type)

Type the appropriate number to indicate which type of field definition you
are creating.

1 = Character will create an alphanumeric field.

2 = Numeric will create a packed numeric field

Online information includes:


– Help information (brief reminders about specific displays, prompts, options,
and keys)
– Index search information (more detailed explanations of concepts and
tasks)
– Error recovery information (additional information on messages: what hap-
pened, whether you did something wrong, and what to do about it)

2-6 IDDU Use V4R1


IDDU Capabilities
Using IDDU, you can create new data dictionaries or data definitions (described in
Chapter 4, “Working with Data Dictionaries” through Chapter 7, “Defining Fields”),
and do any of the following (described in Chapter 12, “Maintaining Definitions” and
Chapter 13, “Maintaining Data Dictionaries”):
Ÿ Change existing data dictionaries or data definitions.
Ÿ Copy definitions from one data dictionary to another, or within the same data
dictionary.
Ÿ Delete data definitions from a data dictionary, or delete an entire data dic-
tionary.
Ÿ Print the information contained in a single data definition or in all data defi-
nitions of a certain type (for example, all field definitions) that are in a data
dictionary.
Ÿ Rename a data definition.
Ÿ Show which other data definitions and files use a particular data definition.
You can also work directly with database files through IDDU (as described in
Chapter 8, “Working with Database Files”):
Ÿ Create a new database file based on an existing file definition and its format
and field definitions.
Ÿ Add or change data in a database file.

You can perform additional IDDU-related tasks using the commands listed in
Appendix D, “IDDU Commands.”

Using Data in Queries and Documents


To use your data in queries or documents, you must first have a library so you
have a place for your data dictionary and database file.
Note: Information on writing queries to request information from your files is in
Query/400 Use. Information on preparing documents is in Using
OfficeVision/400 Word Processing.

Use IDDU to describe (or choose):


Ÿ A dictionary (so you have a place for your data definitions)
Ÿ File definitions (so you can tell the system what your data looks like)
Ÿ Record format definitions (so you can select which to put in your file definition)
Ÿ Field definitions (so you can select the ones to put in the record format defi-
nition)
Then you can select options from the IDDU menu to create:
Ÿ A database file (so you have a place to put your data)
Ÿ Data in the file (so your applications have something to work with)

The following chapter summarizes the process of using IDDU to describe a data
dictionary and data definitions for an application and “Part 2. Defining Data” on
page 3-9 describes each part of the process in more detail. If you are responsible
for maintaining the database and data dictionaries, you can find additional informa-

Chapter 2. Data Definition Concepts 2-7


tion about these tasks in “Part 3. Maintaining Data, Definitions, and Dictionaries” on
page 8-5.

2-8 IDDU Use V4R1


Chapter 3. Getting Started
This chapter tells you how to get to the interactive data definition utility (IDDU) on
the system and generally how the program takes you through the typical tasks
required to describe your data to use in queries and documents.

Getting to IDDU
You can get to the Interactive Data Definition Utility (IDDU) menu by either of two
menu paths, starting at the AS/400 system Main Menu and selecting the following
options:

Path 1
1. On the Main Menu, choose option 2 (Office tasks).
2. On the Office Tasks menu, choose option 3 (Decision support).
3. On the Decision Support menu, choose option 1 (IDDU).

Path 2
1. On the Main Menu, choose option 4 (Files, libraries, and folders).
2. On the Files, Libraries and Folders menu, choose option 1 (Files).
3. On the Files menu, choose option 5 (IDDU).

Or you can enter one of the following on any command line to go directly to the
Interactive Data Definition Utility (IDDU) menu:
STRIDD (a command that means Start IDDU)

GO IDDU (a command that means Go to the IDDU menu)


If you prefer not to use the menu paths, you can use the commands listed in
Appendix D, “IDDU Commands,” to go directly to individual IDDU displays.

Interactive Data Definition Utility (IDDU) Menu


This is the main menu for IDDU. Choosing one of the options will bring up displays
related to that choice.

 Copyright IBM Corp. 1997 3-1


à IDDU Interactive Data Definition Utility (IDDU)
ð
Select one of the following:

1. Work with data definitions


2. Work with data dictionaries
3. Work with database files

2ð. Work with libraries


21. Work with files

3ð. Office tasks

7ð. Related commands

Selection or command.
===> __________________________________________________________________________
_______________________________________________________________________________
F3=Exit F4=Prompt F9=Retrieve F12=Cancel F13=User Support
F16=System main menu
á ñ

Using Function Keys


From all IDDU (and system) menus and displays, you press the Enter key to tell
the system that you have completed your work for that display. You can also use
function keys (labeled Fn, where n is a number, like F3) to end your work, to get
more or different information, or to go to a different display. To see explanations of
the function keys, prompts, or options on a display, press the Help key or F1
(Help).

Choosing Options
From the IDDU menu, you can choose which of the data tasks (options 1, 2, and 3)
you want to do. You can also choose to do related tasks (options 20, 21, and 30)
or to look at or use the related IDDU commands (option 70).

Work with ... Displays


When you choose an option from the IDDU menu, you see a display showing the
various ways you can work with that object (for example: files, programs, libraries,
and folders).
Note: In some cases, you might first see a display allowing you to be more spe-
cific in your choice. For example, if you choose option 1 (Work with data
definitions) on the IDDU menu, you first see the Select Definition Type
display, where you can specify whether you want to work with field, record
format, or file definitions.

Then you see the appropriate Work with ... display:

3-2 IDDU Use V4R1


à Work with File Definitions
ð
Dictionary . . . . . : xxxxxxxxxx

Position to . . . . . . __________ Starting characters

Type options (and File Definition), press Enter.


1=Create 2=Change 3=Copy 4=Delete
6=Print 7=Rename 8=Display where used

File File File File


Opt Definition Opt Definition Opt Definition Opt Definition
_ __________
_ AAxxx _ BCxxx _ CExxx _ EBxxx
_ ABxxx _ BDxxx _ DAxxx _ ECxxx
_ ACxxx _ BExxx _ DBxxx _ EDxxx
_ ADxxx _ CAxxx _ DCxxx _ EExxx
_ AExxx _ CBxxx _ DDxxx _ FAxxx
_ BAxxx _ CCxxx _ DExxx _ FBxxx
_ BBxxx _ CDxxx _ EAxxx _ FCxxx
More...
F3=Exit F5=Refresh F1ð=Work with database files
F11=Display text F12=Cancel F22=Work with data dictionaries

á ñ
To do a task from any of the Work with ... displays, choose the task you want to do
and type the corresponding option number next to the object you want to work with
(a file definition, in the example display).

Using Lists
The names of all the available objects of the type you are working with are shown
in alphabetic order. (If the word More... appears in the lower right corner of the list,
you can see additional names by pressing the Page Down key.) If you want to
quickly find a name appearing later in the list, you can type the starting characters
of the name in the input field for the Position to prompt. The list then shifts so that
the first name starting with that character is shown in the upper left corner of the
list. For example, if you specified SA for the Position to prompt, the newly posi-
tioned list would look like this:

Position to . . . . . . __________ Starting characters

Type options (and File Definition), press Enter.


1=Create 2=Change 3=Copy 4=Delete
6=Print 7=Rename 8=Display where used

File File File File


Opt Definition Opt Definition Opt Definition Opt Definition
_ __________
_ SAxxx _ TCxxx _ UExxx _ WBxxx
_ SBxxx _ TDxxx _ VAxxx _ WCxxx
_ SCxxx _ TExxx _ VBxxx _ WDxxx
_ SDxxx _ UAxxx _ VCxxx _ WExxx
_ SExxx _ UBxxx _ VDxxx _ XAxxx
_ TAxxx _ UCxxx _ VExxx _ XBxxx
_ TBxxx _ UDxxx _ WAxxx _ XCxxx
More...
F3=Exit F5=Refresh F1ð=Work with database files
F11=Display text F12=Cancel F22=Work with data dictionaries

á ñ
If you need more information than just the object name to make your choice, you
can press F11 (Display text) to see an expanded list, like this:

Chapter 3. Getting Started 3-3


File
Opt Definition Date Text
_ __________
_ SAxxx mm/dd/yy xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
_ SBxxx mm/dd/yy xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
_ SCxxx mm/dd/yy xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
_ SDxxx mm/dd/yy xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
_ SExxx mm/dd/yy xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
_ TAxxx mm/dd/yy xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
_ TBxxx mm/dd/yy xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
More...
F3=Exit F5=Refresh F1ð=Work with database files
F11=Display names only F12=Cancel F22=Work with data dictionaries

á ñ
If you want to go back to the other kind of list, you can again press F11 (Display
names only).

Choosing Multiple Options


You can specify more than one task from a list, because in front of each name in
the list is an input field where you can type the option number of the task you want
to do with that item. Also, at the beginning of the list is a space where you can
type the name of an item and an option number for that item.

After you press the Enter key, IDDU presents displays to do the tasks in the order
the options are specified on the list. For example, if you specified the following
multiple options, you would first see the appropriate series of displays to create a
new file definition named GEORGE, then the displays to change file definition
ABxxx, then displays to rename file definition BExxx, then displays to delete file
definition DDxxx, and so forth.

Type options (and File Definition), press Enter.


1=Create 2=Change 3=Copy 4=Delete
6=Print 7=Rename 8=Display where used

File File File File


Opt Definition Opt Definition Opt Definition Opt Definition
1 GEORGE
_ AAxxx _ BCxxx _ CExxx _ EBxxx
2 ABxxx _ BDxxx _ DAxxx 2 ECxxx
_ ACxxx 7 BExxx _ DBxxx _ EDxxx
ADxxx _ CAxxx _ DCxxx _ EExxx
_ AExxx _ CBxxx 4 DDxxx 6 FAxxx
_ BAxxx _ CCxxx _ DExxx _ FBxxx
_ BBxxx _ CDxxx _ EAxxx _ FCxxx
More...
F3=Exit F5=Refresh F1ð=Work with database files
F11=Display text F12=Cancel F22=Work with data dictionaries

á ñ

IDDU Displays to Create or Change Objects


When you choose the options to create or change a dictionary or data definition,
you first see a display on which you enter information required for all objects of that
type. The information required for creating or changing an object is very similar.

For example, if you choose to create new field definitions, you see the Create Field
Definitions display.

3-4 IDDU Use V4R1


à Create Field Definitions
ð
Type information, press Enter to create.
Field type (size) . . : 1=Character (1-32766)
2=Numeric (1-31, decimal positions ð-31)
3=DBCS (4-32766, mixed; 1-16383, graphic)
4=Date/Time (no size)
More options. . . . . : Y=Yes

-------Field--------- Dec More


Name Type Size Pos Opt Text

__________ _ _____ __ _ _____________________________________________


__________ _ _____ __ _ _____________________________________________
__________ _ _____ __ _ _____________________________________________

Using the codes shown at the top of the display, you can type descriptions for nine
fields at a time, specifying for each what kind of field it is, its length, how many
positions after its decimal point (if it is a numeric field), a brief description, and
whether you want to specify more information about it on following displays. After
you press the Enter key, you are shown all appropriate additional displays (if any)
for the first field you specified, then all displays for the second field, and so forth.

To specify additional information about the field, you enter a Y under the More Opt
heading. The additional options for all field types include column headings, a long
comment, and keyboard control for input. For numeric fields, you can also specify
the type of numeric data and how (or if) you want the field to be edited (that is,
have commas, decimal points, currency symbols, and so forth inserted around the
numbers).

If you specify that you want more options for a character field, you see a display
like this:

à Character Field Options


ð
Definition . . . . . : xxxxxxxxxx Dictionary . . . . . : xxxxxxxxxx

Type choices, press Enter.

Hexadecimal
data type . . . . . . . . . . . N Y=Yes, N=No

Column headings
Heading 1 . . . . . . . . . . . ____________________
Heading 2 . . . . . . . . . . . ____________________
Heading 3 . . . . . . . . . . . ____________________

Null attribute . . . . . . . . . . 3 1=Null, 2=Not Null


3=Not null with default

Variable length . . . . . . . . . N Y=Yes, N=No

Allocated length . . . . . . . . . ____ð ð-3274ð characters

More...
F3=Exit F12=Cancel

á ñ

Chapter 3. Getting Started 3-5


à Character Field Options
ð
Definition . . . . . : xxxxxxxxxx Dictionary . . . . . : xxxxxxxxxx

Type choices, press Enter.

Keyboard shift for


display file reference . . . . . _ 1=Select, 4=Remove

Long comment . . . . . . . . . . . 1 1=Select, 4=Remove

Alternative name (Alias) . . . . . _______________________________

Coded Character Set


Identifier (CCSID) . . . . . . . ______ 1-65535

Notice that the choices for several prompts on the above display are Select or
Remove instead of actual values. This technique helps you control the number of
displays you must page through as you create or change definitions. You only see
additional displays to enter new or different information if you specify Select for
these prompts. Or, you can leave the prompt blank and IDDU keeps the existing
information for that prompt. If you do not remember what information currently
exists, you can specify Select to see the next display.

Creating Data Definitions


The process of creating data definitions happens in this sequence:
1. Before you create any data definitions, you must first have a data dictionary for
them.
2. Then you define your fields, record format(s), and file.
Because defining record formats and files mostly consists of selecting defi-
nitions to be included, you must first have definitions to select from. You can
either build all the necessary definitions, starting with the fields, and then
assemble them; or you can start with the file definition and create the others as
the displays ask for them.
The first method may be easier to follow if you have many new definitions to
create or if you are relatively inexperienced with IDDU. You may find the
second method somewhat faster if you already have most of your definitions
created and ready to select from or if you are familiar with IDDU.
3. Finally, after you have the necessary definitions in your dictionary, you can
create the file and enter data into it.

The chapters in “Part 2. Defining Data” on page 3-9 are arranged in the creating
sequence: first, dictionaries; then, file definitions, format definitions, and field defi-
nitions; and finally, database files. Each chapter gives the information you need to
plan and create that kind of object.

3-6 IDDU Use V4R1


Working with Data Definitions
Besides creating new definitions, you can also copy existing definitions between or
within dictionaries, change them as needed, rename them, delete them, print or
display them, and show where they are used. Chapter 12, “Maintaining Definitions”
describes these tasks.

Practicing with IDDU


If you would like to practice trying IDDU before you use it to describe your own
data, a practice exercise is included in Appendix B, “Practice Exercise” that should
help you get acquainted with the tasks of data definition. Also, if you would like
more information on analyzing and describing the files in your office, you might find
Appendix A, “Reviewing File Processing (Preparing for IDDU),” helpful.

Chapter 3. Getting Started 3-7


3-8 IDDU Use V4R1
Part 2. Defining Data
This part provides information on how to plan for and define data using IDDU, and
assumes the concepts in “Part 1. Introduction to Data Definition” are understood. It
describes the tasks related to creating data dictionaries and definitions for files,
record formats, and fields. Also, this part discusses creating database files using
IDDU definitions and entering data into database files using DFU.

Tasks for maintaining definitions and dictionaries (including copying, changing,


printing, and deleting) are discussed in “Part 3. Maintaining Data, Definitions, and
Dictionaries.”

 Copyright IBM Corp. 1997


IDDU Use V4R1
Chapter 4. Working with Data Dictionaries
Data dictionaries allow you to create definitions of fields, formats, or files once, so
that the definitions can be used many times to describe different files. For
example, a billing department and a sales department both use the same customer
information when creating documents to send to people. If one person creates the
definition, many people can use it.

While a dictionary and the applications that use its definitions do not have to be in
the same library, you must create a data dictionary if you not yet have one. Each
dictionary has the same name as the library that contains it.

Creating a Data Dictionary


You can create a data dictionary in any library on the system to which you have the
proper level of authority. You can either use the Work with Data Dictionaries
display or type the Create Data Dictionary (CRTDTADCT) command on any
command line. Remember, a library can have only one data dictionary.

You might want to create more than one data dictionary for your area. You might
create different data dictionaries for different types of data: for example, one data
dictionary to describe inventory information and another to describe employee infor-
mation.
Note: The dictionary creator has the authority to limit who can work in each data
dictionary and what kind of work they can do.

You need to do the following steps to create a data dictionary:


1. Choose option 2 (Work with data dictionaries) from the IDDU menu (or type
WRKDTADCT on a command line).
2. On the Work with Data Dictionaries display, choose option 1 (Create) and type
the name of the dictionary (which is the same as the name of the library that
will contain the dictionary).

à Work with Data Dictionaries


ð
Position to . . . . . . __________ Starting characters

Type options (and Data Dictionary), press Enter.


1=Create 2=Change 4=Delete 6=Print

Data Data Data Data


Opt Dictionary Opt Dictionary Opt Dictionary Opt Dictionary
1 ACCOUNTS

Note: If the library you specify does not exist, the system shows you the
Create a Library display (if you are authorized to create libraries). After
you create a library from that display, you continue to the Create a Data
Dictionary display.
3. On the Create a Data Dictionary display, the name of the specified library
appears as the name of the dictionary.

 Copyright IBM Corp. 1997 4-1


à Create a Data Dictionary
ð
Dictionary . . . . . : ACCOUNTS

Type choices, press Enter.

Authority . . . . . . . \LIBCRTAUT \LIBCRTAUT, \ALL, \CHANGE,


\USE, \EXCLUDE
Authorization list name

Long comment . . . . . _ 1=Select, 4=Remove

Text . . . . . . . . . __________________________________________________

From this display, you can:


a. Choose the authority others have with this dictionary.
b. Choose whether to provide an extended description (long comment) for this
dictionary.
c. Type a brief text description of the dictionary.
4. If you choose 1 (Select) for the Long comment prompt, the Edit a Long
Comment display appears next. There you can type as detailed a description
of this dictionary as necessary.
5. After you finish the display(s), the system creates the dictionary and sends you
a completion message. (This process can take some time.)

Considerations for securing (assigning authority to) and describing a dictionary are
discussed in the following topics.

Securing a Data Dictionary


For security reasons, consider controlling the access other users will have to your
dictionaries. The Authority prompt on the Create a Data Dictionary display allows
you to specify how much control other users have over the contents of the dic-
tionary. (See “Changing a Data Dictionary” on page 13-1 for information on
making changes in authority.)

For more information about resource and office security, see the books Security –
Reference and Managing OfficeVision/400.

Levels of Authority
You can grant the following access, or levels of authority, to other users when you
create a dictionary:

*LIBCRTAUT
A user can be allowed or denied the authority to use the object created using
the Create Authority (CRTAUT) value in the library in which the object is being
created.

*ALL
All users can work with the definitions in this dictionary, including changing
them, and can change others' authority to the dictionary, subject to additional
individual security restrictions.

4-2 IDDU Use V4R1


*CHANGE
All users can work with the definitions in this dictionary, including changing
them, but cannot change authority to the dictionary.

*USE
All users can copy and print definitions from the dictionary and display where
they are used but cannot change the dictionary or its definitions.

*EXCLUDE
No other user has any access to this dictionary.

Authorization Lists
If you want different users to have different levels of authority, you can specify the
name of a user-created authorization list containing the names of specific users to
be authorized to this dictionary and the authority level for each individual. The
authorization list must already exist on the system before you create the dictionary.
Refer to Security – Reference for details.

Describing a Data Dictionary


You can describe the content, the purpose, or other information about a dictionary
by using the Long comment and Text prompts.

Long Comment
The Long comment prompt lets you enter, on the Edit a Long Comment display, up
to 1360 characters of information about the dictionary. Examples of this information
might be identifying the files defined by this data dictionary, or identifying who
created the dictionary and who is responsible for maintaining it. The information
you put in the long comment can be read on the edit display when you choose to
change the dictionary and printed by using the Print key (or other methods of
printing a copy of displays).

Text Description
The Text prompt lets you write a short description (up to 50 characters) about the
dictionary that may be helpful in reminding you of the purpose and contents of the
dictionary. The information you put in the text field is shown in lists of dictionaries
and can be printed by using the Print key (or other methods of printing a copy of
displays).

Maintaining a Data Dictionary


Besides creating a data dictionary, you can also work with dictionaries in other
ways. You can:
Ÿ Change a dictionary you have authority over.
Ÿ Delete a dictionary you have authority over.
Ÿ Print information about a dictionary.

These dictionary maintenance tasks are described in Chapter 13, “Maintaining Data
Dictionaries.”

Chapter 4. Working with Data Dictionaries 4-3


4-4 IDDU Use V4R1
Chapter 5. Defining Files
This chapter describes how to plan for, create, and maintain file definitions. A file
definition has at least one record format definition that describes the records in the
file.

Planning a File Definition


When you are planning to create (or change) a file definition, you may find it helpful
to use a work sheet to organize the description of the file and then refer to the work
sheet as you go through the interactive data definition utility (IDDU) displays.

An example of a file definition work sheet, including the most commonly used file
definition prompts on the displays, is supplied on the following page. You can copy
and use this work sheet, or you may want to create one designed for your own
applications.

The descriptions that follow the work sheet will help you in completing it.

 Copyright IBM Corp. 1997 5-1


File Definition Work Sheet

Data Dictionary Name _____________________________

File definition name . . . . . _ _ _ _ _ _ _ _ _ _ (up to 1ð characters)

Record format definition name(s)

_ _ _ _ _ _ _ _ _ _ New or existing definition? _____

_ _ _ _ _ _ _ _ _ _ New or existing definition? _____

_ _ _ _ _ _ _ _ _ _ New or existing definition? _____

Key field name(s)

_ _ _ _ _ _ _ _ _ _ Ascending or descending? _____

_ _ _ _ _ _ _ _ _ _ Ascending or descending? _____

_ _ _ _ _ _ _ _ _ _ Ascending or descending? _____

Long comment . . . . . . . . . (up to 136ð characters)


____________________________________________________________________________________________
____________________________________________________________________________________________
____________________________________________________________________________________________
____________________________________________________________________________________________
____________________________________________________________________________________________
____________________________________________________________________________________________
____________________________________________________________________________________________
____________________________________________________________________________________________

Text . . . . . . . . . . . . . _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ (up to 5ð characters


of description)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

5-2 IDDU Use V4R1


Data Dictionary Name
This is the name of the data dictionary that will contain this file definition. It is the
same as the name of the library containing the dictionary.

File Definition Name


The name of the file definition you are creating can be up to 10 characters.

You can begin a file definition name with any alphabetic character (A through Z) or
one of the symbols $, #, @. You can also use any of those characters and
symbols for the remainder of the name, as well as the numbers 0 through 9, the
period (.), and the underscore character (_).

However, an extended name uses all characters except the embedded blank,
device control characters, *, ?, ', and, " (for example, “PAY (12)” can be used
when it is enclosed in quotation marks).

Use meaningful names to make all of your data definitions clear to users not
familiar with your data. Use abbreviations for a file definition name when a com-
plete descriptive name cannot fit in 10 characters (8 characters for an extended
name).

For your convenience, you might give the file and the file definition the same name.
This naming convention lets all users easily associate the file (the data) with the file
definition (the description). Creating database files is discussed in “Creating a
Database File” on page 8-1.
Note: You may have more than one definition with the same name. Your
descriptions of the definitions should help you determine the differences
between the definitions.

Record Format Definition Names


A file definition may have one or more record format definitions, although only one
is required. Most files contain only one type of record. If you use a single record
format definition, you can do one of the following:
Ÿ Name a yet-to-be-created record format definition (see “Record Format Defi-
nition Name” on page 6-3 for guidelines on naming record formats).
Ÿ Let IDDU name your new record format definition when you create it. IDDU
adds an R to the file name (for example, if the file name is PAYROLL, the
format would be named PAYROLLR).
IDDU does not provide a record format definition name when the file definition
name is an extended name.
Ÿ Choose a record format definition that already exists in the dictionary.

You might want to define multiple record formats for a single file. For example, a
sales file might contain one order header record and several transaction records for
each order. If one customer placed 10 different orders, for example, there would
be 10 order header records for that customer. Information common to each trans-
action, such as the customer’s name and address and the sales representative’s
name, would be stored in the order header record, while unique information, such
as item number and quantity, would be stored in each transaction record.

Before you decide to use a file with multiple record types, however, look carefully at
the possible file uses to make sure you can create the necessary output from such

Chapter 5. Defining Files 5-3


a file. There might be some reports or lists you want to create that require all
records in a file to be of the same record type.

Certain kinds of fields cannot be used in a file with multiple record formats:
Ÿ Date/time/timestamp fields
Ÿ Variable-length fields
Ÿ Null-capable fields
Ÿ DBCS-graphic fields

You should use record ID codes in the record format definitions for files with mul-
tiple formats. Otherwise, if no record ID codes are defined, all the records are used
for each format in the file. For more information on record ID codes, see “Using
Record Identification Codes” on page 10-1. Additionally, a file definition that con-
tains multiple formats can produce only a program-described file when the file is
created. “Program-Described Files” on page C-4 discusses considerations when
using files with multiple record formats.

Key Field Definition


You can specify up to 120 key fields for a file definition. Key fields are used to
arrange the sequence of the records in a file. You can specify ascending or
descending sequence for each key field.

You can use key fields only in a single format file definition that does not have
record ID codes. Only fields used within the record format may be selected as key
fields.
Note: The total size of key fields is limited to 2000 bytes, unless duplicate keys
are allowed and arranged in first-changed first-out order (FCFO). For FCFO
files, the total size limit for key fields is 1995 bytes.

To determine the total combined length of your key fields, you have to make
adjustments if certain kinds of fields are used as key fields:
Ÿ For each key field that is null capable, add an extra byte to the total to
account for nulls.
Ÿ For each key field that is variable length, add two bytes to account for
the length value.
Ÿ For each key field that is both null capable and variable length, add
three bytes to the total to account for nulls and length value.
Ÿ For each key field that is DBCS-graphic, double the field length (number
of characters) to account for each character being stored as two bytes.
If all key fields are DBCS-graphic, the maximum total length is either
1000 characters or 997 characters for a FCFO file.
For more information on selecting key fields, see “Selecting Key Field Sequence”
on page 11-1.

Long Comment
You can enter up to 1360 characters of information about the content and purpose
of a definition in a long comment.

The long comment could include such information as:


Ÿ Source (the name of the department that originated this file)

5-4 IDDU Use V4R1


Ÿ Operational information (storage media, backup requirements, start again and
recovery procedures, and availability of critical personnel)
Ÿ Relationship (description of associations between different file types and
between different types of processes)

Text
You can type up to 50 characters of information when creating a file definition to
help you identify what the field contains. This description is shown when you view
a list of fields.

Creating a File Definition


Creating a file definition consists mainly of selecting from existing record formats or
creating a new one.

You need to do the following steps to create a file definition:


1. Choose option 1 (Work with data definitions) from the IDDU menu (or type
WRKDTADFN on a command line).
2. On the Select Definition Type display, select option 3 (File) and type the name
of the dictionary (or choose it from the list).

à Select Definition Type


ð
Type choices, press ENTER.

Definition type . . . . . . _ 1=Field


2=Record format
3=File

Data dictionary . . . . . . default___ Name, F4 for list

3. On the Work with File Definitions display, choose option 1 (Create) and specify
the name of the new file definition.

à Work with File Definitions


ð
Dictionary . . . . . : XXXXXXXXXX

Position to . . . . . . __________ Starting characters

Type options (and File Definition), press Enter.


1=Create 2=Change 3=Copy 4=Delete
6=Print 7=Rename 8=Display where used

File File File File


Opt Definition Opt Definition Opt Definition Opt Definition
1 THOMAS____

4. Next you will see the Create File Definition display. If you used the work sheet
to plan your file definition, you may want to refer to it as you continue this task.

Chapter 5. Defining Files 5-5


à Create File Definition
ð
Definition . . . . . : XXXXXXXXXX Dictionary . . . . . : XXXXXXXXXX

Type choices, press Enter.

Record formats
option . . . . . . . 2 1=Create and/or select formats
2=Create default format
and select fields

For choice 2=Create default format:


Format . . . . . . default___ Name

Select key field


sequence . . . . . . N Y=Yes, N=No

Long comment . . . . . _ 1=Select, 4=Remove

Text . . . . . . . . . __________________________________________________

From this display, you can:


a. Choose whether you want to select your record format(s) from those
already in the dictionary (option 1) or to create a single new format now
(option 2). (If you want to create multiple record formats, choose option 1.)
b. If you choose to create a single format, name the new record format defi-
nition (or accept the default name provided by the system).
c. Choose whether to have key fields.
d. Choose whether to provide an extended description (long comment) for this
file definition.
e. Type a brief text description of the file definition.
5. If you chose option 1 (Create and/or select formats), the next display you see
will be Create and Select Record Formats, where you can select and sequence
the formats to be included in this file definition.

à Create and Select Record Formats


ð
Definition . . . . . : XXXXXXXXXX Dictionary . . . . . : XXXXXXXXXX

Position to . . . . . . . __________ Format, sequence (ð-99999)

Type sequence numbers (ð-99999), (and Format), press Enter.


Type format, press F6 to create.

Seq Format Seq Format Seq Format


_____ __________
_____ XXXXXXXXXX _____ XXXXXXXXXX _____ XXXXXXXXXX

See “Selecting a Record Format for a File Definition” on page 5-8 for a dis-
cussion of this display.
6. If you chose option 2 (Create default format and select fields), the next display
you see is Create and Select Field Definitions, where you can choose the field
definitions to be included in the new record format and the order in which the
fields are to be arranged in the record.
The record format name that you (or IDDU) previously specified on the Create
File Definition display appears at the top of this display.

5-6 IDDU Use V4R1


à Create and Select Field Definitions
ð
Definition . . . . . : fmtnamR Dictionary . . . . . : XXXXXXXXXX

Position to . . . . . . . __________ Field, sequence (ð-99999)

Type sequence numbers (ð-99999), (and Field), press Enter.


Type field, press F6 to create.

Seq Field End Seq Field End Seq Field End


_____ __________

See “Selecting a Field Definition” on page 6-6 for a discussion of this display.
a. If you type the name and sequence of a new field definition in the first posi-
tion of the list and press F6 (Create field definition), you will see the Create
Field Definitions display. Use this to choose the field definitions to include
in the new record format and the order the fields are arranged in the
record. (See “Planning a Field Definition” on page 7-1 for information on
defining fields, and “Selecting a Field Definition” on page 6-6 for informa-
tion on using the Create and Select Field Definitions display.)
b. When you return to the Create and Select Field Definitions display after
completing your work with fields, press the Enter key (without making any
changes to the display) to tell IDDU that you want the record format defi-
nition created.
7. If you entered Y at the Select key field sequence prompt, the Select Key Field
Sequence display will appear next. This display allows you to choose the order
of the key fields.
When you press the Enter key, the display appears again if you made changes.
Press the Enter key to proceed. If you do not change the display, pressing the
Enter key allows the program to proceed. See “Selecting Key Field Sequence”
on page 11-1 for more information on using the Select Key Field Sequence
display.
8. If you chose 1 (Select) for the Long comment prompt, the Edit a Long
Comment display appears next. There you can type a detailed description of
the file definition you are creating.
9. When you return to the Work with File Definitions display, press F3 (Exit) to
return to the IDDU menu or command line.

Creating a Record Format for a File Definition


You can create a file definition with a single (new) record format without using the
Create Record Format Definition display. On the Create a File Definition display,
choose option 2 (Create default format and select fields), name the new record
format definition (or accept the system-supplied name), and press the Enter key.

The system-supplied name for this record format definition is the file name, plus a
last character of R, unless the file definition name is 10 characters (in which case
the system duplicates the entire name). You can type over this system-supplied
name with another as your application requires.

When you press the Enter key, the Create and Select Field Definitions display
appears, and the record format definition will be created with the file definition. The
tasks on that display are discussed in “Selecting a Field Definition” on page 6-6.

Chapter 5. Defining Files 5-7


à Create and Select Field Definitions
ð
Definition . . . . . : addressR Dictionary . . . . . : XXXXXXXXXX

Position to . . . . . . . __________ Field, sequence (ð-99999)

Type sequence numbers (ð-99999), (and Field), press Enter.


Type field, press F6 to create.

Seq Field End Seq Field End Seq Field End


_____ __________
_____ ACCOUNTNUM XXXXX _____ XXXXXXXXXX XXXXX _____ XXXXXXXXXX XXXXX

Selecting a Record Format for a File Definition


If you chose option 1 (Create and/or select formats) on the Create File Definition
display, the Create and Select Record Formats display appears. On this display
you can select and sequence one or more existing record format definitions from a
list or create new record formats for this file definition. You do this by typing a
sequence number in the Seq field for the desired formats. Whether you are
selecting from existing record format definitions or creating new ones, only defi-
nitions with sequence numbers will be selected and used by the file definition.

à Create and Select Record Formats


ð
Definition . . . . . : XXXXXXXXXX Dictionary . . . . . : XXXXXXXXXX

Position to . . . . . . . __________ Format, sequence (ð-99999)

Type sequence numbers (ð-99999), (and Format), press Enter.


Type format, press F6 to create.

Seq Format Seq Format Seq Format


1ð __________
3ð ADDRESS _____ XXXXXXXXXX _____ XXXXXXXXXX
_____ XXXXXXXXXX _____ XXXXXXXXXX _____ XXXXXXXXXX
_____ XXXXXXXXXX _____ XXXXXXXXXX _____ XXXXXXXXXX
_____ XXXXXXXXXX _____ XXXXXXXXXX _____ XXXXXXXXXX
_____ XXXXXXXXXX _____ XXXXXXXXXX _____ XXXXXXXXXX
_____ XXXXXXXXXX _____ XXXXXXXXXX _____ XXXXXXXXXX
_____ XXXXXXXXXX _____ XXXXXXXXXX _____ XXXXXXXXXX
_____ XXXXXXXXXX _____ XXXXXXXXXX _____ XXXXXXXXXX
More...

F3=Exit F5=Refresh F6=Create record format definition


F11=Display Text F12=Cancel F2ð=Renumber
á ñ
The sequence number of a record format indicates the relative location of the
format name within the list of record format definition names. The names of record
formats that are not associated with a file definition, but are available from the dic-
tionary, appear without sequence numbers in the lower portion of the list.

Select from existing record format definitions by specifying a sequence number next
to the record format definition name in the list. When you specify a sequence
number for a format name and press the Enter key, the name is positioned accord-
ingly in the list. The list is repositioned to the sequence number or to the name you
specify (in the Position to prompt) when you press the Enter key. When you
specify a name and no name match is found, the nearest item preceding the name

5-8 IDDU Use V4R1


specified is positioned at the top of the list of format names without sequence
numbers. See “Using Lists” on page 3-3.

To change the sequence number of a record format in the list, type the new
sequence number next to the record format name and press the Enter key; the
name will be moved to the new position.

To remove the name of a format from the list of format definitions used by the file
definition, remove the sequence number by spacing over it.

You can create a new record format definition by typing the name of a new record
format definition on the top line of the list. Then either accept the sequence
number the system assigns to it or type over it with an appropriate new number to
properly position the definition in sequence.

After you type the record format name to be created, press F6 (Create record
format definition) to go to the Create a Record Format display.

Maintaining File Definitions


Besides creating a file definition, you can also work with definitions in other ways.
You can:
Ÿ Change a definition
Ÿ Copy a definition
Ÿ Delete a definition
Ÿ Print information about a definition
Ÿ Rename a definition
Ÿ Display the where-used information about a definition

These maintenance tasks for file definitions are described in Chapter 12, “Main-
taining Definitions.”

Chapter 5. Defining Files 5-9


5-10 IDDU Use V4R1
Chapter 6. Defining Record Formats
Use a record format definition to describe the layout of a data record and define the
sequence of fields within a record. When discussing a record format definition, we
frequently drop the term definition (as we do for field definition) and refer to it as a
record format, sometimes even as a format.

Planning a Record Format Definition


When you are planning to create (or change) a record format definition, you may
find it helpful to use a work sheet to organize the description of the field and then
refer to the work sheet as you go through the interactive data definition utility
(IDDU) displays.

An example of a record format definition work sheet, including the most commonly
used record format definition prompts on the displays, is supplied on the next page.
You can copy and use this work sheet, or you may want to create one designed for
your own applications.

The descriptions that follow the work sheet will help you in completing it.

 Copyright IBM Corp. 1997 6-1


Record Format Definition Work Sheet

Data Dictionary Name _____________________________

Record format definition name . . . . . _ _ _ _ _ _ _ _ _ _

Field definitions:

Seq Name New? Seq Name New?

____ _ _ _ _ _ _ _ _ _ _ __________ ____ _ _ _ _ _ _ _ _ _ _ __________

____ _ _ _ _ _ _ _ _ _ _ __________ ____ _ _ _ _ _ _ _ _ _ _ __________

____ _ _ _ _ _ _ _ _ _ _ __________ ____ _ _ _ _ _ _ _ _ _ _ __________

____ _ _ _ _ _ _ _ _ _ _ __________ ____ _ _ _ _ _ _ _ _ _ _ __________

____ _ _ _ _ _ _ _ _ _ _ __________ ____ _ _ _ _ _ _ _ _ _ _ __________

____ _ _ _ _ _ _ _ _ _ _ __________ ____ _ _ _ _ _ _ _ _ _ _ __________

____ _ _ _ _ _ _ _ _ _ _ __________ ____ _ _ _ _ _ _ _ _ _ _ __________

____ _ _ _ _ _ _ _ _ _ _ __________ ____ _ _ _ _ _ _ _ _ _ _ __________

____ _ _ _ _ _ _ _ _ _ _ __________ ____ _ _ _ _ _ _ _ _ _ _ __________

____ _ _ _ _ _ _ _ _ _ _ __________ ____ _ _ _ _ _ _ _ _ _ _ __________

Long comment . . . . . . . . . (up to 136ð characters)


____________________________________________________________________________________________
____________________________________________________________________________________________
____________________________________________________________________________________________
____________________________________________________________________________________________
____________________________________________________________________________________________
____________________________________________________________________________________________
____________________________________________________________________________________________
____________________________________________________________________________________________

Text . . . . . . . . . . . . . _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ (up to 5ð characters


of description)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

6-2 IDDU Use V4R1


Data Dictionary Name
This is the name of the data dictionary that will contain this format definition (it will
be the same as the library containing the dictionary).

Record Format Definition Name


The name of the record format definition you are creating can be up to 10 charac-
ters long.

You can begin a record format definition name with any alphabetic character (A
through Z) or one of the symbols $, #, @. You can also use any of those charac-
ters and symbols for the remainder of the name, as well as the numbers 0 through
9 and the underscore character ( _ ).

Use a descriptive name for a record format definition. For example, if a definition
uses field names related to vacation, you might use a name to indicate this. This
helps you identify the definition when you see the name.

Notes:
1. RPG requires that the record format name be different from the name of the file
that uses it.
2. You may have more than one record format definition with the same name.
Your descriptions of the definitions should help you determine the differences
between the definitions.

Field Definitions
When you create record format definitions for a new file, you choose the fields that
will be included in the record and the order in which they are positioned. You can
choose any definitions in the same dictionary as the record format definition, or you
can create new ones.

Consider the following when defining the sequence of fields in a record:


Ÿ Displaying
If the main purpose of the file is to display information for viewing (as in a dis-
played query), you should determine which information the viewer needs when
the record is displayed. Although you can specify the order of the fields as
they may appear in a report, it might be more convenient for the fields con-
taining the most important information to appear at the beginning of the record.
Ÿ Updating
If the file is to be updated frequently, determine which fields will be changed
most often. When an operator updates the file, the fields are displayed in the
order in which they appear in the record. Define the most frequently updated
fields first and place them toward the beginning of the record. This saves the
operator time when updating the file.
Ÿ Sorting
How records in the file are sorted is also important in determining the order of
fields within a record. When viewing or printing records, it might be convenient
for the fields used for sorting to appear at the beginning of the record, although
you can specify the order of the fields as they may appear in a report. For
example, if employee records are to be sorted in ascending order by employee
number, place the employee number field at or toward the beginning of the

Chapter 6. Defining Record Formats 6-3


record. This can provide an easier reference, or better continuity, for the
printed or displayed file.
Ÿ Entering
The order of the fields as they appear on the source input document is impor-
tant. For ease of entry, the field order in the file and the field order on the
source document should match.

Long Comment
You can enter up to 1360 characters of information about the content and purpose
of a definition.

The long comment could include such information as:


Ÿ Source (the name of the department that originated this record format)
Ÿ Application usage (how the format is used in various applications)
Ÿ Report usage (description of the production reports that use this format)
Ÿ Forms (any specific forms used to print this format)
Ÿ Record ID (description of selection values for this format)

Text
You can type up to 50 characters of information to help you identify what the record
contains when creating a record format definition. This description is shown when
you view a list of formats.

Record ID Codes
Record ID codes should be specified when multiple record format definitions are
used by a file definition for a file.

See Chapter 10, “Record Format Definition Considerations,” for more information
about record ID codes.

Creating a Record Format Definition


You need to do the following steps to create a record format definition:
1. Choose option 1 (Work with data definitions) from the IDDU menu (or type
WRKDTADFN on a command line).
2. On the Select Definition Type display, select option 2 (Record format), and type
the name of the dictionary (or choose it from the list).

à Select Definition Type


ð
Type choices, press Enter.

Definition type . . . . . . . _ 1=Field


2=Record format
3=File

Data dictionary . . . . . . . __________ Name, F4 for list

3. On the Work with Record Format Definitions display, choose option 1 (Create),
and specify the name of the new record format definition.

6-4 IDDU Use V4R1


à Work with Record Format Definitions
ð
Dictionary . . . . . : XXXXXXXXXX

Position to . . . . . . __________ Starting character(s)

Type options (and Record Format Definition), press Enter.


1=Create 2=Change 3=Copy 4=Delete
6=Print 7=Rename 8=Display where used

Format Format Format Format


Opt Definition Opt Definition Opt Definition Opt Definition
_ __________

4. Now the Create Record Format Definition display appears. If you used the
work sheet to plan your record format definition, you may want to refer to it as
you continue this task.

à Create Record Format Definition


ð
Definition . . . . . : XXXXXXXXXX Dictionary . . . . . : XXXXXXXXXX

Type choices, press Enter.

Create and select


field definitions . . Y Y=Yes, N=No

Specify
record ID codes . . . N Y=Yes, N=No

Long comment . . . . . . _ 1=Select, 4=Remove

Text . . . . . . . . . . ___________________________________________________

On this display:
a. Indicate that you will create new field definitions for this format and/or
select from the definitions that exist in the dictionary. (Because this is a
Create task, you cannot change the first item.)
b. Choose whether to identify record ID codes for this format (required if mul-
tiple formats exist in the file definition).
c. Choose whether to provide an extended description (long comment) for this
definition.
d. Type a brief text description for this definition.
5. Next the Create and Select Field Definitions display appears, where you can
choose the field definitions to include in the new record format and the order
the fields are arranged in the record. See “Selecting a Field Definition” on
page 6-6 for information on using this display.

Chapter 6. Defining Record Formats 6-5


à Create and Select Field Definitions
ð
Definition . . . . . : FMTNAMR Dictionary . . . . . : XXXXXXXXXX

Position to . . . . . . . __________ Field, sequence (ð-99999)

Type sequence numbers (ð-99999), (and Field), press Enter.


Type field, press F6 to create.

Seq Field End Seq Field End Seq Field End


_____ __________
______ XXXXXXXXXX XXXXX _____ XXXXXXXXXX XXXXX _____ XXXXXXXXXX XXXXX

a. If you type the sequence and name of a new field definition in the first posi-
tion of the list and press F6 (Create field definitions), the Create Field Defi-
nitions display appears. (See “Planning a Field Definition” on page 7-1 for
information on defining fields.) Pressing the Enter key without changing the
display causes the Create and Select Field Definitions display to appear
again.
b. When you return to the Create and Select Field Definitions display after
completing your work with fields, press the Enter key (without making any
changes to the display) to tell IDDU that you are ready for the next step.
6. If you chose Y for the Specify record ID codes prompt, the Define Record ID
Codes display appears next. See “Using Record Identification Codes” on
page 10-1 for information on using this display.
7. If you chose 1 (Select) for the Long comment prompt, the Edit a Long
Comment display appears next. There you can type a detailed description of
this record format definition. Pressing the Enter key as you complete the Long
Comment will bring you to the Work with Record Format Definitions display.
8. When you return to the Work with Record Format Definitions display, press F3
(Exit) to return to the IDDU menu or command line.

Selecting a Field Definition


Whether you select from existing field definitions or create new ones, only field defi-
nitions with sequence numbers are used by the record format definition. Use the
Create and Select Field Definitions display to select and sequence one or more
existing definitions from a list or create new field definitions. You do this by typing
a sequence number in the Seq field for the desired fields.

à Create And Select Field Definitions


ð
Definition . . . . . : FMTNAMR Dictionary . . . . . : XXXXXXXXXX

Position to . . . . . . . __________ Field, sequence (ð-99999)

Type sequence numbers (ð-99999), Field, and press Enter.


Type field, press F6 to create.

Seq Field End Seq Field End Seq Field End


_____ __________
_____ XXXXXXXXXX XXXXX _____ XXXXXXXXXX XXXXX _____ XXXXXXXXXX XXXXX
_____ XXXXXXXXXX XXXXX _____ XXXXXXXXXX XXXXX _____ XXXXXXXXXX XXXXX
_____ XXXXXXXXXX XXXXX _____ XXXXXXXXXX XXXXX _____ XXXXXXXXXX XXXXX

6-6 IDDU Use V4R1


The sequence number describes the position of a field definition in the record
format. When you specify a sequence number to a field definition, that number will
be assigned to the definition, and it will be positioned accordingly in the list.

You can use F11 (Display text) to see the field type of each field (for example,
character, variable-length character, date, packed, zoned, binary, or floating point).
Field definitions with sequence numbers have already been selected to be used by
the format definition named on the display, and will be used in the ascending order
of those sequence numbers as they appear in the upper portion of the list. The
value shown in the End column can be used to determine the length of the field
definition. By using F11 (Display text), you can use the date and text columns to
determine which of any identically named fields you want to use, because each
field must have a unique name (and alias) within the record format.

Do not let the total of field sizes used by a single record format definition exceed
32 766 bytes. If you exceed that size, IDDU will not let you save the definition.

The field definitions in this dictionary that are not selected for this format, but are
available to be used, appear without sequence numbers in the lower portion of the
list.

To create new field definitions, type each new definition name on the top line of the
list. The system will assign a sequence number which you can accept, or you can
type over it with an appropriate number. If you do not specify a sequence number
for the new definition, the new name will be placed in alphabetical order in the
lower portion of the list with the other names without sequence numbers.

After you type the name of a field definition to be created, press F6 (Create field
definition) to go to the Create Field Definitions display, which is discussed in “Cre-
ating a Field Definition” on page 7-12.

Maintaining Record Format Definitions


Besides creating a record format definition, you can also work with definitions in
other ways. You can:
Ÿ Change a definition
Ÿ Copy a definition
Ÿ Delete a definition
Ÿ Print information about a definition
Ÿ Rename a definition
Ÿ Display the where-used information about a definition

These record format definition maintenance tasks are described in Chapter 12,
“Maintaining Definitions.”

Chapter 6. Defining Record Formats 6-7


6-8 IDDU Use V4R1
Chapter 7. Defining Fields
Use a field definition to tell the system certain characteristics about the data. For
example, does the field contain characters or numbers, and how big is the field?
When discussing a field definition, we frequently drop the term definition (as we do
for record format) and refer to it as a field.

You need a different field definition for each unique field in the files. However,
when you have a data dictionary, a field that appears in many files with the same
characteristics in each file needs only one field definition. For example, a field
created to handle names could be used throughout all your applications.

Planning a Field Definition


When you are planning to create (or change) a field definition, you may find it
helpful to use a work sheet to organize the description of the field. An example of
a field definition work sheet, including the most commonly used field definition
prompts on the IDDU displays, follows. You can copy and use this work sheet, or
you may want to create one designed for your own applications.

The descriptions that follow the work sheet will help you in completing it.

 Copyright IBM Corp. 1997 7-1


Field Definition Work Sheet

You must define the following information for all field types:

Data Dictionary Name _____________________________

Field definition name . . . . _ _ _ _ _ _ _ _ _ _ (up to 1ð characters)

Type . . . . . . . . . . . . . ___________________ (Character, Numeric, DBCS, or Date/Time)

Size . . . . . . . . . . . . . ___________________ (up to 32766 for Character or Bracketed


DBCS fields; 16383 for DBCS-Graphic;
31 for Numeric; blank for Date/Time)

Decimal positions . . . . . . ___________________ (ð-31 for Numeric, otherwise blank)

Text . . . . . . . . . . . . . _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ (up to 45 characters of


description creating,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 5ð when changing)

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

More options?. . . . . . . . . ___________________ (yes or no – see following sections


of work sheet for possible choices)

More options allows this information for all field types:

Null attribute. . . _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ (Null, Not Null, Not Null with


Default)
Column headings
Heading 1 . . . . . . . . . _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ (up to 2ð characters
per heading)
Heading 2 . . . . . . . . . _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Heading 3 . . . . . . . . . _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Alias. . . _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ (up to 3ð characters)

Long comment . . . . . . . . . (up to 136ð characters)


____________________________________________________________________________________________
____________________________________________________________________________________________
____________________________________________________________________________________________
____________________________________________________________________________________________
____________________________________________________________________________________________
____________________________________________________________________________________________
____________________________________________________________________________________________
____________________________________________________________________________________________

7-2 IDDU Use V4R1


More options allows this information for numeric field types:

Numeric data type. . . . . . . ___________________ (zoned, packed, binary, or floating


point)

Numeric editing mode . . . . . ___________________ (Numeric field, Date/Time, Edit Code, or


Edit Word)
Numeric field editing choices:

Decimal point . . . . . . . . . . _______________ (. , : $ or none)

Thousands separator . . . . . . . _______________ (. , ' blank or none)

Use sign for negative number? . . _______________ (yes or no)

If yes, place where?. . . . . _______________ (right or left)

Use currency symbol?. . . . . . . _______________ (yes or no)

If yes, place where?. . . . . _______________ (right or left)

Print zero value? . . . . . . . . _______________ (yes or no)

Replace leading zeros?. . . . . . _______________ (yes or no)

If yes, with what?. . . . . . _______________ (blanks, asterisks, or


floating currency symbol)
Show single leading zero? . . _______________ (yes or no)

Date or time separator. . . . . . . . _______________ (. / : - or ,)

More options allows this information for character (SBCS) field types:

Data type . . . . . . . . . . . . . . . . _______________ (character (SBCS), hexadecimal)

Variable length . . . . . . . . . . . . . _______________ (yes or no)

Allocated length . . . . . . . . . . . . _______________ (up to 3274ð characters for


non-null fields, up to 32739
characters for null fields)

Coded Character Set

Identifier (CCSID) . . . . . . . . . . . . . . . _______________ (up to 65535)

Chapter 7. Defining Fields 7-3


More options allows this information for DBCS field types:

DBCS data type. . . . . . . . . . . . . . _______________ (open, only, either, graphic)

Variable length . . . . . . . . . . . . . _______________ (yes or no)

Allocated length . . . . . . . . . . . . _______________ (up to 3274ð characters for


non-null bracketed DBCS fields
or 1637ð for non-null graphic
DBCS fields; one character
less for null fields)
Coded Character Set

Identifier (CCSID) . . . . . . . . . . . . . . . _______________ (up to 65535)

More options allows this information for Date/Time field types:

Data type . . . . . . . . . . . . . . . . _______________ (Date, Time, Timestamp)

For date fields

Date format. . . . . . . . . . . . . . _______________ (\USA, \ISO, EUR, \JIS,


\MDY, \DMY, \YMD, \JUL)

Date separator . . . . . . . . . . . . _______________ (slash, period, comma,


dash, or blank if format
is not \USA, \ISO,
\EUR, \JIS)

For time fields

Time format. . . . . . . . . . . . . . _______________ (\USA, \ISO, \EUR, \JIS,


\HMS)

Date separator . . . . . . . . . . . . _______________ (colon, period, comma, or


blank if format is not
\USA, \ISO, \EUR, \JIS)

For timestamp: format and separator already specified

Notes:

7-4 IDDU Use V4R1


Basic Characteristics of All Field Definitions
The following characteristics are common to all field definitions.

Data Dictionary Name


This is the name of the data dictionary that will contain this field definition (it will be
the same as the library containing the dictionary).

Field Name
The name of the field definition you are creating can be up to 10 characters.

You can begin a field definition name with any alphabetic character (A through Z)
or one of the symbols $, #, @. You can also use any of those characters and
symbols for the remainder of the name, as well as the numbers 0 through 9 and
the underscore character (_).

Use meaningful names to make all of your data definitions clear to users not
familiar with your data. Use abbreviations for a field name when a complete
descriptive name cannot fit in 10 characters. You should use the same field name
across all data dictionaries. For example, if you use LASTNAME for all the field
names that refer to the last name, this helps you identify the field definition when
you see it regardless of what dictionary you are in.

If a field is used in many files and has the same characteristics in each file, you
should reuse the same field definition in each file definition.
Note: You may have more than one field definition with the same name. Your
description of the definitions should help you determine the differences
between the definitions.

Field Type
The field type definition specifies whether the data in the field is character (single-
byte character set (SBCS) characters or numbers), numeric, double-byte character
set (DBCS characters or numbers), or date/time. (You can further define these
data types by choosing More options.)

Field Size
The field size is the length of the field, specified as follows:
Ÿ For the default numeric data type, packed (decimal), field size is the number of
digits. The maximum size is 31. See “Additional Characteristics for Numeric
Fields” on page 7-8 for maximum field sizes of other numeric data types.
Ÿ For character (SBCS) data type, field size is the number of characters. The
maximum size is 32 766 (32 740 for a variable-length character field).
Ÿ For bracketed-DBCS data types (if your system supports DBCS), field size is
twice the number of double-byte characters plus two, which allows for the
shift-out and shift-in (bracket) characters. The maximum size is 32 766
(32 740 for a variable-length DBCS field).
Ÿ For DBCS-graphic data type, field size is specified as the number of double-
byte characters. The maximum size you can specify is 16 383 characters
(16 370 characters for a variable-length graphic field). The actual storage
space required for the field is twice the number of characters.

Chapter 7. Defining Fields 7-5


Ÿ Date/time field size cannot be specified because it is automatically determined
by the date/time data type.

The total space required for all fields in a single record format definition cannot
exceed 32 766 bytes.

Each field should be long enough to contain the largest number of characters or
digits for that field in any record. For example, the length of each customer’s name
varies, but 20 positions might be long enough to contain most customer names.
For another example, if you have a field that will contain the name of a state, do
not make the field long enough for Massachusetts when you are only going to enter
MA. You cannot easily make a field shorter after it is linked to a disk file.

How you plan to use the data in the field should determine the length of your data
field. For example, you might break a very long field into smaller fields to be sure
you can fit the information from the file in your report or document.

Decimal Positions
Use the decimal positions field when you are defining a numeric field. The system
allows up to 31 positions, but in all cases, the number of decimal positions cannot
exceed the field size.

In the case of floating-point numbers, the number of positions is the number of sig-
nificant digits.

Text
You can type up to 45 characters of information when creating a field definition (up
to 50 when changing). This description is shown when you view a list of fields and
helps you identify what the fields contain.

More Options
To define additional information about your field, specify yes for the More options
prompt. The topics on “Additional Characteristics for All Field Types” and “Addi-
tional Characteristics for Numeric Fields” on page 7-8 discuss this information.

Additional Characteristics for All Field Types


You can further define the data as to required control of keyboard entry,
description, labeling, and detailed numeric characteristics by choosing More options
when creating or changing a field definition.

Column Headings
You can specify three column headings, each up to 20 characters long, that
describe the data in the field. These headings are used in reports produced by
applications using the field. If you do not specify a column heading, the office
applications of the AS/400 system use the field name as the first column heading.

You can change the column headings in the report or document using Query/400 or
OfficeVision; the column headings in the field definition, however, remain
unchanged.

7-6 IDDU Use V4R1


Null Attribute
If you do not add data to a file, you can specify how space for the data appears.
The values allowed for the null attribute are:
Ÿ Null means that the field has no value.
Ÿ Not null means that a value must be entered at data entry time.
Ÿ Not null with default means that a default value will be provided.
The default null attribute is not null with default. For IDDU, the default values are
blank for character and DBCS values, 0 for numeric values, and the following for
date/time values:
Date 1 January 1940
Time 0 hours 0 minutes 0 seconds
Timestamp 1 January 1940 0 hours 0 minutes 0 seconds

Long Comment
You can enter up to 1360 characters of detailed information about the content and
purpose of a definition.

The long comment could include such information as:


Ÿ Source (the name of the organization that generated the particular field)
Ÿ Data structure (the rules and structure that the data must adhere to)
Ÿ Value and description (the valid range of values and codes as well as a
description of the values for a specific field)
Ÿ Glossary (an explanation of the terms/fields peculiar to the industry in which
your business happens to be)
Ÿ Source of input (an explanation of which sources generate the data for the
field)

Keyboard Shift
You can control what type of (and whether) data can be entered in each field. Key-
board shift is used when a program uses a display file that refers to fields in the
database file currently being defined. However, the data file utility (DFU) does not
use keyboard shift. See “Part 3. Maintaining Data, Definitions, and Dictionaries” for
information on keyboard shift.
Note: Keyboard shift does not support DBCS fields, but does support character
and numeric fields.

Alias (Alternative Name)


Some high-level programming languages use an alias as an alternative name for
the field described by a definition. However, the alias is not used by any of the
office applications of the AS/400 system. See “Part 3. Maintaining Data, Defi-
nitions, and Dictionaries” for information on aliases.

Chapter 7. Defining Fields 7-7


Additional Characteristics for Numeric Fields
For numeric fields, there are also characteristics such as the type of numeric data
and any other editing unique to a numeric field. This additional editing can be for a
number, date, or time value. You can also specify the time and date separator, the
thousands symbol, and the symbol and location for negative values, currency, and
leading zeros.

Numeric Data Type


For a numeric field, you can accept packed (decimal) as the data type, or you can
specify one of the following data types to describe the way the data is stored:
Ÿ Zoned means this field can contain zoned decimal data, with a maximum field
length of 31 positions, any or all of which can be decimal.
Ÿ Packed (the default data type) means this field can contain packed decimal
data, with a maximum field length of 31 positions, any or all of which can be
decimal.
Ÿ Binary means this field contains binary data, with a maximum field length of 9
positions, any or all of which can be decimal.
Ÿ Floating point means this field contains floating point data, with a maximum
field length for single (short) precision of 9 positions, and for double (long) pre-
cision of 17 positions, any or all of which can be decimal.

DFU supports only binary, zoned decimal, and packed decimal data types for
numeric fields. IDDU field definitions for fields used by the data file utility must
adhere to this restriction.

Numeric Editing Choices


You can specify these different numeric editing characteristics:
Ÿ Field editing, including separators, symbols, and treatment of zeros
Ÿ Date or time value separators
Ÿ An edit code, which is a single character representing a set of editing charac-
teristics
Ÿ An edit word, which is a string of characters that control the final appearance of
the edited field

Field editing and date/time editing are described in the following paragraphs; edit
codes and edit words, because they are infrequently used with Office and Query
applications, are discussed in Chapter 9, “Field Editing Techniques.” A system-wide
view of edit codes and edit words is presented in the DDS Reference.

Numeric Field Editing: You can specify any of the following:


Ÿ Decimal point can be period (.), comma (,), colon (:), currency ($), or none.
Ÿ Thousands separator can be period (.), comma (,), apostrophe ('), blank, or
none.
Ÿ Negative sign
– Choose whether to show a negative symbol.
– Specify up to six valid system characters for a symbol.
– Choose a location relative to the value; left, right, or both.
Ÿ Currency symbol

7-8 IDDU Use V4R1


– Choose whether to show a currency symbol.
– Specify up to six valid system characters for a symbol.
– Choose a location relative to the value; left, right, or both.
Ÿ Print a zero value specifies whether zero values are to be printed.
Ÿ Replace leading zeros specifies whether the leading zeros of a value are to
be replaced. If so, you can choose to replace them with blanks, asterisks, a
single floating currency symbol, or a single leading zero.
Ÿ Show single leading zero specifies whether a single leading zero should be
printed.

Date/Time Editing: The separator can be a period (.), slash (/), colon (:), hyphen
(-), or comma (,).

Additional Characteristics for Character and DBCS Fields


Character (SBCS) and DBCS fields have additional options that allow you to define
a field as variable length and then define the allocated data length. You can also
specify character set identifiers for systems with either the same or different lan-
guages than your own.

Character (SBCS) Data Type


For a character (SBCS) field, you can accept character as the data type, or you
can specify hexadecimal data type:
Ÿ Character (the default data type) means this field can contain any of the char-
acters in the single-byte character set.
Ÿ Hexadecimal means this field can contain only hexadecimal data, consisting of
the characters 0 through 9 and A through F.

DBCS Data Types


For a DBCS field, you can specify one of the bracketed-DBCS data types or
DBCS-graphic data type:
Ÿ DBCS-open means this field can contain a mixture of SBCS and
bracketed-DBCS data.
Ÿ DBCS-only means this field can contain only bracketed-DBCS data.
Ÿ DBCS-either means this field can contain either SBCS data or
bracketed-DBCS data, but not both types.
Ÿ Graphic means this field can contain DBCS-graphic data.

Variable Length
You can specify whether a field is to be variable length. The values allowed in this
field are Y=Yes and N=No. The default value for this field is No. If you specify a
length, it is assumed to be the maximum length of the variable-length field
(including the two bytes for the shift-out and shift-in (bracket) characters, if it is a
bracketed-DBCS field). You cannot specify a value greater than 32 740 (16 370
for a DBCS-graphic field).

Chapter 7. Defining Fields 7-9


Allocated Length
If you specify a variable-length field, you can also specify the allocated length,
which is the estimated length that the field will be most of the time. This reduces
the amount of space used to store the field in the database. For example, you can
define a variable-length character field as 100 characters with an allocated length of
30 characters. This means the majority of the data will be 30 characters long but
some could be as long as 100 characters.

The allocated length must be less than or equal to the field length. If the field is a
null-capable character field, then the maximum allowable allocated length is 32739.
Otherwise, the maximum allowable allocated length is 32740.

Coded Character Set Identifier (CCSID)


You can specify the coded character set identifier (CCSID) you want to use. The
CCSID enables conversion of data from one coded character set to another. The
valid values range from 1 to 65535. The system uses the default value if the
CCSID is not specified when the file is created. If you specified the field to be a
hexadecimal field, the field is automatically tagged with CCSID 65535.

Example of conversion:
Ÿ A field is tagged with a CCSID of 227 (Danish).
Ÿ Your job CCSID is 037 and you a working on an English (037 code page) key-
board.
Ÿ You enter the character $ (hex value 5B) as input into the field. Database con-
verts the hex value 5B into the CCSID 227 hex value 67 (character $) to pre-
serve the dollar sign.

For additional information about CCSIDs, see National Language Support,


SC41-5101.

Additional Characteristics for Date/Time/Timestamp Fields


For Date, Time, and Timestamp fields, there are characteristics for defining formats
and separators. Format and separators can only be changed for date and time
fields. Timestamp fields have fixed formats with separators that look like
YYYY-MM-DD-hh.mm.ss.uuuuuu and have a fixed length of 26 characters.

Date Format
Use the Date Format field to specify how you want your date to appear. Use one
of the predefined standard formats listed in Figure 7-1, or define your own format.

7-10 IDDU Use V4R1


Figure 7-1. Date Format Options
Country Standard Format Fixed Length
*USA (IBM USA Standard) mm/dd/yyyy 10
*ISO (International Standards Organization) yyyy–mm–dd 10
*EUR (IBM European Standard) dd.mm.yyyy 10
*JIS (Japanese Industrial Standard Christian Era) yyyy–mm–dd 10
*MDY (Month/Day/Year) mm/dd/yy 08
*DMY (Day/Month/Year) dd/mm/yy 08
*YMD (Year/Month/Day) yy/mm/dd 08
*JUL (Julian) yy/ddd 06

Date Separator
If you specified *MDY, *DMY, *YMD, or *JUL date format, you can specify a date
separator. The date separators for the *USA, *ISO, *EUR, and *JIS values are
predetermined and cannot be changed. The following values are valid date separa-
tors:
Ÿ slash (/)
Ÿ period (.)
Ÿ comma (,)
Ÿ dash (–)
Ÿ blank ( )

Time Format
Use the Time Format field to specify how you want your time to appear. Use one
of the predefined standard formats listed in Figure 7-2, or define your own format.

Figure 7-2. Time Format Options


Country Standard Format Fixed Length
*USA (IBM USA Standard) hh:mm AM 08
hh:mm PM
*ISO (International Standards Organization) hh.mm.ss 08
*EUR (IBM European Standard) hh.mm.ss 08
*JIS (Japanese Industrial Standard Christian Era) hh:mm:ss 08
*HMS (Hours/Minutes/Seconds) hh:mm:ss 08

Time Separator
If you specified *HMS as the time format, you can specify a time separator. The
time separators for the *USA, *ISO, *EUR, and *JIS values are predetermined and
cannot be changed. The following values are valid time separators:
Ÿ colon (:)
Ÿ period (.)
Ÿ comma (,)
Ÿ blank ( )

Chapter 7. Defining Fields 7-11


Creating a Field Definition
You need to do the following steps to create a field definition:
1. Choose option 1 (Work with data definitions) from the IDDU menu (or type
WRKDTADFN on a command line).
2. On the Select Definition Type display, select option 1 (Field) and type the name
of the dictionary (or choose it from the list).

à Select Definition Type


ð
Type choices, press Enter.

Definition type . . . . . . . _ 1=Field


2=Record format
3=File

Data dictionary . . . . . . . default___ Name, F4 for list

3. On the Work with Field Definitions display, choose option 1 (Create) and
specify the name of the new field definition.

à Work with Field Definitions


ð
Dictionary . . . . . : XXXXXXXXXX

Position to . . . . . . __________ Starting characters

Type options (and Field Definition), press Enter.


1=Create 2=Change 3=Copy 4=Delete
6=Print 7=Rename 8=Display where used

Field Field Field Field


Opt Definition Opt Definition Opt Definition Opt Definition
_ __________

4. Now you see the Create Field Definitions display. If you used the work sheet
to plan your field definition, you may want to refer to it as you continue this
task.

à Create Field Definitions


ð
Type information, press Enter to create.
Field type (size) . . : 1=Character (1-32766)
2=Numeric (1-31, decimal positions ð-31)
3=DBCS (4-32766, mixed; 1-16383, graphic)
4=Date/Time (no size)
More options. . . . . : Y=Yes

-------Field--------- Dec More


Name Type Size Pos Opt Text

__________ _ _____ __ _ _____________________________________________


__________ _ _____ __ _ _____________________________________________
__________ _ _____ __ _ _____________________________________________

From this display you can specify any additional descriptive information
needed, such as the field’s type, size, or text. For numeric fields, you have to
specify the number of decimal positions. When necessary, indicate more
options are required.

7-12 IDDU Use V4R1


5. If you specified Yes for the More options prompt, you next see the Character
Field Options display, the Numeric Field Options display, the DBCS Field
Options display, or the Date/Time Field Options display. The following display
is a generic example of the options available on these displays.

à ... Field Options


ð
Definition . . . . . : XXXXXXXXXX Dictionary . . . . . : XXXXXXXXX

Type choices, press Enter.

... data type __

Column headings:
Heading 1 . . . . . . . . . . . ____________________
Heading 2 . . . . . . . . . . . ____________________
Heading 3 . . . . . . . . . . . ____________________

You can specify detailed data type, column headings, long comment, and an
alias for all fields. For numeric fields, you can choose numeric editing and key-
board shift. For character fields, you can choose keyboard shift.
6. If you chose numeric field editing, you see the Describe Numeric Field Editing
display, on which you can choose the specific kind of editing you want to do.

à Describe Numeric Field Editing


ð
Definition . . . . . : XXXXXXXXXX Dictionary . . . . . : XXXXXXXXXX

Type choices, press Enter.

Decimal separator . . . . . . . _ 1=. 2=, 3=: 4=$ 5=None


Thousand separator . . . . . . . _ 1=. 2=, 3=' 4=Blank 5=None

Show negative sign . . . . . . . _ Y=Yes N=No


Left negative sign . . . . . . ______
Right negative sign . . . . . ______
Show currency symbol . . . . . . _ Y=Yes N=No
Left currency symbol . . . . . ______
Right currency symbol . . . . ______
Print zero value . . . . . . . . _ Y=Yes N=No
Replace leading zeros . . . . . _ Y=Yes N=No
Replace with . . . . . . . . . _ 1=Blanks
2=Asterisks
3=Floating currency symbol
Single leading zero . . . . . . _ Y=Yes N=No

F3=Exit F12=Previous

á ñ
Depending on the edit mode you choose, you will get another display on which
to specify your requirements.
7. If you chose 1 (Select) for the Long comment prompt, the Edit a Long
Comment display appears next. There you can type as detailed a description
of this file definition as necessary.
8. Pressing the Enter key returns you to the Create Field Definitions display after
defining the field. Press the Enter key again (without making any changes to
the display) to tell IDDU that you are ready for the next step. (You could now
specify additional fields to create.)
9. Pressing the Enter key returns you to the Work with Field Definitions display,
and pressing F3 (Exit) returns you to the IDDU menu or command line.

Chapter 7. Defining Fields 7-13


Maintaining Field Definitions
Besides creating a field definition, you can also work with definitions in other ways.
You can:
Ÿ Change a definition
Ÿ Copy a definition
Ÿ Delete a definition
Ÿ Print information about a definition
Ÿ Rename a definition
Ÿ Display the where-used information about a definition

These field definition maintenance tasks are described in Chapter 12, “Maintaining
Definitions.”

7-14 IDDU Use V4R1


Chapter 8. Working with Database Files
When the appropriate definitions have been created and exist in the dictionary, you
can use the interactive data definition utility (IDDU) to create database files and go
to the data file utility (DFU) to enter data into those files.

You use the Work with Database Files display to name the database files you want
to work with and to describe the kind of work you want to do. After you have
created the definitions that describe a file and placed them in a dictionary, you can
choose either to create a database file or to enter data into an existing file (using
DFU).

Creating a Database File


After you have completed creating the necessary file definitions, you can create the
database file using the Work with Database Files display. You can get to this
display either from the main IDDU menu, or by entering the WRKDBFIDD
command.

Create as many files as you require by entering a new file name each time you
return to the display. These file names might have a level of authority previously
assigned to them (authority holder). This will affect the authority you can assign.

You need to do the following to create a database file:


1. Choose option 3 (Work with database files) from the IDDU menu (or type
WRKDBFIDD on a command line).
2. On the Work with Database Files display, choose option 1 (Create), name the
new file, and if necessary, specify the library that will contain the file.

à Work with Database Files


ð
Library . . . . . . . . default___ Name, F4 for list
Position to . . . . . . __________ Starting characters

Type options (and Database file), press Enter.


1=Create 2=Enter data

Database Database Database Database


Opt File Opt File Opt File Opt File
_ __________

3. You see the Create a Database File display next, showing the name of the new
file and its library.

 Copyright IBM Corp. 1997 8-1


à Create Data Base File
ð
File . . . : XXXXXXXXXX Library . . . . : XXXXXXXXXX

Type choices, press Enter.

Related definition information:

File definition . . . . . . __________ Name, F4 for list

Dictionary . . . . . . . . default___ Name, F4 for list

Authority . . . . . . . . . . \LIBCRTAUT \LIBCRTAUT, \ALL, \CHANGE


\USE, \EXCLUDE
Authorization list name

F3=Exit F4=List F6=Create file definition F12=Previous

á ñ
On this display, specify the name of the file definition and the dictionary, and
also choose the authority others have to this file. Press F6 (Create file defi-
nition) to create a file definition for the file.
4. When the system creates the file, it is automatically linked to its file definition.
This linking of files and file definitions is discussed in “Linking and Unlinking
Files and Definitions” on page 14-1.

Securing a Database File


For security reasons, you should control the access that other users have to your
database file.

When a file is created using dictionary definitions, many people can use the file,
even though they might not be authorized to use the dictionary. However, they
must be authorized to a data dictionary before they can change the definitions in
that dictionary.

The Authority prompt on the Create a Database File display allows you to specify
how much control other users have over the contents of the file.

Levels of Authority
You can grant the following access, or levels of authority, to other users when you
create a database file:

*LIBCRTAUT
A user can be allowed or denied the authority to use the file created using the
Create Authority (CRTAUT) value in the library in which the file is being
created.

*ALL
All users can work with the data in this file and can change others’ authority to
the file data.

*CHANGE
All users can work with the data in this file, including changing it, but cannot
change authority to the file.

8-2 IDDU Use V4R1


*USE
All users can copy and print data from this file, but they cannot alter the con-
tents of the file. This is called read authority.

*EXCLUDE
No other user has any access to this file.

Authorization Lists
If different users have different levels of authority, you can specify the name of a
user-created authorization list containing the names of specific users to be author-
ized to this file and the authority level for each individual. The authorization list
must already exist on the system before you create the file.

For more information about authorization lists, see Security – Reference and Man-
aging OfficeVision/400.

Entering Data into a Database File


You use DFU to work with the data files described by an IDDU-created file defi-
nition. DFU lets you:
Ÿ Add records to a file
Ÿ Change records in a file
Ÿ Delete records from a file

After the file has been created, you can enter data into it by choosing option 2
(Enter data) on the Work with Database Files display and specifying the name of
the appropriate file definition.

DFU will read the file definition name and create a temporary data entry program
that allows you to enter, change, and delete records in the associated file. DFU
uses all the formats and fields you have defined in your file definition. The tempo-
rary program will disappear when you are finished with the data entry.

See the ADTS/400: Data File Utility book for detailed information on using DFU.

Chapter 8. Working with Database Files 8-3


8-4 IDDU Use V4R1
Part 3. Maintaining Data, Definitions, and Dictionaries
This part describes the tasks related to maintaining data dictionaries, and file,
record format, and field definitions.

These tasks include copying, changing, printing, deleting, and showing where defi-
nitions are used. Some experience with IDDU is assumed and, in some cases, an
understanding of programming relationships.

 Copyright IBM Corp. 1997


IDDU Use V4R1
Chapter 9. Field Editing Techniques
This chapter provides information on performing more complicated field editing
functions using the interactive data definition utility (IDDU). These functions require
an understanding of one or more of the following:
Ÿ Programming techniques
Ÿ Display field input requirements
Ÿ Multiple record formats
Ÿ High-level language requirements

Edit Codes
Edit codes are letters or numbers indicating that a defined pattern of editing should
take place in a field before the field is displayed or printed. Edit codes allow a user
to define how data will be presented on a printer or display. For further information
on edit codes see the DDS Reference book.

Specify either an OS/400 edit code or a user-defined edit code to control the
printing of output-capable numeric fields as follows:
Ÿ Suppress leading zeros.
Ÿ Punctuate a field with commas and periods to show the decimal column and to
group digits by threes.
Ÿ Print negative values with a minus sign or CR to the right of the value.
Ÿ Print zero values as zeros or spaces.
Ÿ Print asterisks to the left of significant digits to provide protection.
Ÿ Print the currency symbol defined for your system (QCURSYM) immediately to
the left of the leftmost significant digit (called a floating-currency symbol).
For fixed-currency symbols, use an edit word instead of an edit code.
Ÿ Edit the field as defined in a user-defined edit code.

à Specify Edit Code


ð
Definition . . . . . : XXXXXXXXXX Dictionary . . . . . : XXXXXXXXXX

Type choices, press Enter.

Edit code . . . . . . . _ 1-4, A-D, J-Q, X-Z, user defined 5-9

Optional edit code


modifier . . . . . . _ 1=Asterisk fill
2=Floating currency symbol

You cannot specify an edit code and an edit word for the same field.

 Copyright IBM Corp. 1997 9-1


Edit Code Table
The OS/400 edit codes are the characters 1 through 4, A through D, J through Q,
and X through Z.

Use an edit code of X to suppress the leftmost zero of a 3- to 6-digit date field, and
the two leftmost zeros of a 7-digit date field. The Y edit code additionally inserts
slashes (/) between the month, day, and year. The Z edit code removes any plus
or minus sign from a numeric field and changes the sign of the units column to a
hexadecimal F.
Note: Edit code X does not affect printer files. AS/400 hardware operates with a
preferred sign of F, which is equivalent to using edit code X.

The common values among all of these edit codes are:


Ÿ Left negative symbol = N through Q
Ÿ Left currency symbol = symbol defined for your system (QCURSYM)
Ÿ Right currency symbol = none
Ÿ Replace leading zeros = yes

Print Right Print


Edit Thousands Negative Negative Zero
Code Separator Value Symbol Value
1 See below N Y
2 See below N N
3 None N Y
4 None N N
A See below Y CR Y
B See below Y CR N
C None Y CR Y
D None Y CR N
J See below Y - Y
K See below Y - N
L None Y - Y
M None Y - N
N See below Y - Y
O See below Y - N
P None Y - Y
Q None Y - N

The symbols for decimal point and thousands separator (when indicated above),
and the showing of a single leading zero (to the left of the decimal point), are all
dependent on the system value for the decimal format (QDECFMT).

Decimal Show
Format Decimal Thousands Single
Value Point Separator Zero
Blank . , N
I , . N
J , . Y

The printed currency symbol and the character that replaces leading zeros depend
on the edit code modifier selected.

9-2 IDDU Use V4R1


Modifier Print Replace Zeros
Value Currency With:
Blank N blanks
Asterisk N *
Currency Y Floating currency

You can optionally specify either asterisk fill or a floating currency symbol with edit
codes 1 through 4, A through D, and J through Q. For asterisk fill, an asterisk (*) is
written for each zero suppressed, and a complete field of asterisks is printed for a
zero-balance field.

The floating-currency symbol appears to the left of the leftmost significant digit. It
does not print on a zero balance when an edit code is used that suppresses the
zero balance. The symbol you specify must match the system value for the cur-
rency symbol (QCURSYM). (The symbol must match when the file is created. It
does not have to match when the file is used.)
Note: If an edit code is changed after a file is created, the new edit code is not
used unless the file is re-created. Instead, the editing specified at the time
the file was created continues to be used.

Edit Word
You can specify the free-format editing of numeric fields on the AS/400 system
using the Specify Edit Word display.

à Specify Edit Word


ð
Definition . . . . . : XXXXXXXXXX Dictionary . . . . . : XXXXXXXXXX
Length . . . . . . : XXXXX
Heading 1 . . . . : XXXXXXXXXXXXXXXXXXXX
Heading 2 . . . . : XXXXXXXXXXXXXXXXXXXX
Heading 3 . . . . : XXXXXXXXXXXXXXXXXXXX

Type edit word, press Enter. (Enclose edit word in apostrophes. Each blank is
replaced by a digit, each ampersand (&) by a blank.)

Edit word . . . . . _______________________________________________________


________________________________________________________________________________
________________________________________________________________________________
_________________________________

F3=Exit F12=Previous

á ñ
An edit word specifies the form in which the field values are to be displayed and
inserts characters directly. The edit word can also be used to suppress leading
zeros and provide asterisk fill protection for a field.

An edit word used to format a field can be up to 246 characters. The edit word
must be enclosed in apostrophes ('), and any embedded apostrophes must be
typed twice (''). You cannot specify both an edit code and an edit word for the

Chapter 9. Field Editing Techniques 9-3


same field. A complete discussion of the definition of edit words is in the DDS
Reference.

Alias (Alternative Name)


The alias is used by some high-level programming languages as an alternative
name for the field described by a definition. The alias is not used by any of the
office applications of the AS/400 system. A common practice is to make the alias
the same as the name given to this field by the program that uses a file.

When used, an alias must be unique in the record format definition, with no other
field definition used by the same record format having either the same alias or the
same name. That is, any field’s name must not be the same as some other field’s
alias. It can be no longer than 30 characters. An alias must begin with an alpha-
betic character followed by alphanumeric characters A through Z, 0 through 9, or
underscore; however, an underscore cannot be used as the last character.

Do not make an alias the same as any other alias, or the same as any field defi-
nition name that will be used by the same record format definition. When renaming
a field definition, you cannot use a new name that is the same as a field name or
an alias within the same record format definition.

Keyboard Shift and Data Type


A display file determines the characteristics of the data entered and shown on a
display. You cannot define a display file with IDDU, but a display file can refer to
the files created using IDDU definitions. These definitions would determine the field
characteristics, one of which is keyboard shift.

To specify which type of shift the keyboard should be placed in for the operator, or
what DBCS data type will be accepted when the file is being used, choose 1
(Select) for the Keyboard shift for display file reference prompt on the character or
numeric field options displays. The DBCS data type is chosen directly on the
DBCS Field Options display. Remember that DFU does not recognize keyboard
shift.
Note: If Hexadecimal data type is chosen, the keyboard shift cannot be specified.

Character Keyboard Shift


To choose the keyboard shift for a character field, specify 1 (Select) for the Key-
board shift for display file reference prompt on the Character Field Options display.

9-4 IDDU Use V4R1


à Character Field Options
ð
Definition . . . . . : FIELDNAME Dictionary . . . . . : MYDICT

Type choices, press Enter.

Hexadecimal
data type . . . . . . . . . . . Y Y=Yes, N=No

Column headings:
Heading 1 . . . . . . . . . . . ____________________
Heading 2 . . . . . . . . . . . ____________________
Heading 3 . . . . . . . . . . . ____________________

Null Attribute . . . . . . . . . . 3 1=Null, 2=Not null


3=Not null with default

Variable length . . . . . . . . . N Y=Yes, N=No

Allocated length . . . . . . . . . ____ð ð-3274ð characters

More...
F3=Exit F12=Cancel

á ñ

à Character Field Options


ð
Definition . . . . . : FIELDNAME Dictionary . . . . . : MYDICT

Type choices, press Enter.

Keyboard shift for


display file reference . . . . . _ 1=Select, 4=Remove

Long comment . . . . . . . . . . . _ 1=Select, 4=Remove

Alternative name (Alias) . . . . . _______________________________

Coded Character Set


Identifier (CCSID) . . . . . . . _____ 1-65535

Bottom
F3=Exit F12=Cancel

á ñ
If you do not specify a shift, the system selects the appropriate shift. When you do
specify a shift on the Character Field Options display, you go to the Specify Char-
acter Keyboard Shift display, where you can specify these shifts:

Alphanumeric
Lets all characters be entered.

Numeric only character


Allows entry of the digits 0 through 9, plus (+), minus (-), comma (,),
period (.), and spaces.

Digits only
Allows entry of only the digits 0 through 9. No special characters or blanks are
allowed.

Chapter 9. Field Editing Techniques 9-5


Alphabetic only
Allows only alphabetic characters, comma (,), dash (–), and space be entered.

Numeric shift
Allows numeric entry; all characters are valid.

Katakana
Allows Katakana entry; all characters are valid.

Inhibit
Locks the keyboard so no data can be entered.

Numeric Keyboard Shift


To choose the keyboard shift for a numeric field, specify 1 (Select) for the Key-
board shift for display file reference prompt on the Numeric Field Options display.

à Numeric Field Options


ð
Definition . . . . . : NUMERIC Dictionary . . . . . : MYDICT

Type choices, press Enter.

Numeric data type . . . . . . . . 2 1=Zoned, 2=Packed


3=Binary, 4=Floating point
Column headings:
Heading 1 . . . . . . . . . . . _______________________________
Heading 2 . . . . . . . . . . . _______________________________
Heading 3 . . . . . . . . . . . _______________________________

Null attribute . . . . . . . . . . 3 1=Null, 2=Not null


3=Not null with default

Numeric editing . . . . . . . . . _ 1=Select, 4=Remove

Keyboard shift for


display file reference . . . . . _ 1=Select, 4=Remove

More...
F3=Exit F12=Cancel

á ñ

à Numeric Field Options


ð
Definition . . . . . : NUMERIC Dictionary . . . . . : MYDICT

Type choices, press Enter.

Long comment . . . . . . . . . . . _ 1=Select, 4=Remove

Alternative name (Alias) . . . . . ______________________________

Bottom
F3=Exit F12=Cancel

á ñ

9-6 IDDU Use V4R1


When you do not specify a keyboard shift, the system default is signed shift, unless
an edit code or edit word is specified. When either an edit code or edit word is
specified, numeric only character shift is used. When you do specify a shift, the
Specify Numeric Keyboard Shift display appears, where you can specify these
shifts:

Signed
Allows numeric entry of only the digits 0 through 9. To leave the input field, the
operator must press the Field Exit key, the Field + key, the Field - key, or a
cursor movement key.

Numeric only character


Allows numeric entry of the digits 0 through 9, plus (+), minus (-), comma (,),
period (.), and spaces.

Numeric
Allows numeric entry; all characters are valid.

Inhibit
Locks the keyboard so no data can be entered.

Digits only
Allows numeric entry of only the digits 0 through 9. No special characters or
blanks are allowed.

DBCS Data Type


To control the keyboard data type for a double-byte character field, specify the
correct option on the DBCS Field Options display.

à DBCS Field Options


ð
Definition . . . . . : DBCSFIELD Dictionary . . . . . : MYDICT

Type choices, press Enter.

DBCS data type . . . . . . . . . . 1 1=Open, 2=Only


3=Either, 4=Graphic

Column headings:
Heading 1 . . . . . . . . . . . ______________________________
Heading 2 . . . . . . . . . . . ______________________________
Heading 3 . . . . . . . . . . . ______________________________

Null attribute . . . . . . . . . . 3 1=Null, 2=Not null


3=Not null with default

Variable length . . . . . . . . . Y Y=Yes, N=No

Allocated length . . . . . . . . . ____ð ð-3274ð


ð-1637ð (graphic only)
More...
F3=Exit F12=Cancel

á ñ

Chapter 9. Field Editing Techniques 9-7


à DBCS Field Options
ð
Definition . . . . . : DBCSFIELD Dictionary . . . . . : MYDICT

Type choices, press Enter.

Long comment . . . . . . . . . . . 1 1=Select, 4=Remove

Alternative name (Alias) . . . . . ______________________________

Coded Character Set


Identification . . . . . . . . . _____ 1-65535

Bottom
F3=Exit F12=Cancel

á ñ
You can specify:

Open
Allows both single-byte character set (SBCS) and bracketed double-byte char-
acter set (DBCS) data to be entered.

Only
Allows only bracketed-DBCS data to be entered.

Either
Initially allows entry of SBCS data, but allows the operator to change and enter
bracketed-DBCS data. The first character entered in a field determines what
can be entered in the rest of the field.

Graphic
Allows only graphic (nonbracketed) DBCS data to be entered.

Date/Time Data Type


To control the format and separator type for the date and time section of your
output, specify the correct option on the Date/Time Field Options display.

9-8 IDDU Use V4R1


à Date/Time Field Options
ð
Definition . . . . . : DATEFIELD Dictionary . . . . . : MYDICT

Type choices, press Enter.

Date/Time data type . . . . . . . 1 1=Date, 2=Time, 3=Timestamp

Column headings:
Heading 1 . . . . . . . . . . . ______________________________
Heading 2 . . . . . . . . . . . ______________________________
Heading 3 . . . . . . . . . . . ______________________________

Null attribute . . . . . . . . . . 3 1=Null, 2=Not null


3=Not null with default

Date format . . . . . . . . . . . 2 1=\USA, 2=\ISO, 3=\EUR, 4=\JIS


5=\MDY, 6=\DMY, 7=\YMD, 8=\JUL

Date separator . . . . . . . . . . _ 1=/ 2=. 3=, 4=- 5=blank

More...
F3=Exit F12=Cancel

á ñ

à Date/Time Field Options


ð
Definition . . . . . : TIMEFIELD Dictionary . . . . . : MYDICT

Type choices, press Enter.

Date/Time data type . . . . . . . 2 1=Date, 2=Time, 3=Timestamp

Column headings:
Heading 1 . . . . . . . . . . . ______________________________
Heading 2 . . . . . . . . . . . ______________________________
Heading 3 . . . . . . . . . . . ______________________________

Null attribute . . . . . . . . . . 3 1=Null, 2=Not null


3=Not null with default

Time format . . . . . . . . . . . _ 1=\USA, 2=\ISO, 3=\EUR, 4=\JIS


9=\HMS

Time separator . . . . . . . . . . _ 1=: 2=. 3=, 4=blank

More...
F3=Exit F12=Cancel

á ñ

Chapter 9. Field Editing Techniques 9-9


à Date/Time Field Options
ð
Definition . . . . . : TIMESTAMP Dictionary . . . . . : MYDICT

Type choices, press Enter.

Date/Time data type . . . . . . . 3 1=Date, 2=Time, 3=Timestamp

Column headings:
Heading 1 . . . . . . . . . . . ______________________________
Heading 2 . . . . . . . . . . . ______________________________
Heading 3 . . . . . . . . . . . ______________________________

Null attribute . . . . . . . . . . 3 1=Null, 2=Not null


3=Not null with default

More...
F3=Exit F12=Cancel

á ñ

à Date/Time Field Options


ð
Definition . . . . . : TIMESTAMP Dictionary . . . . . : MYDICT

Type choices, press Enter.

Long comment . . . . . . . . . . . _ 1=Select, 4=Remove

Alternative name (Alias) . . . . . ______________________________

Bottom
F3=Exit F12=Cancel

á ñ

9-10 IDDU Use V4R1


Chapter 10. Record Format Definition Considerations
This chapter discusses record identification codes and how to use them effectively
with program-described files.

Using Record Identification Codes


At times, you will want to perform a task using selected records from a program-
described file (see Appendix C, “Data Descriptions on the AS/400 System”) instead
of the entire file, as when the file has multiple formats (see “Record Format Defi-
nition Names” on page 5-3). For example, the file can have one format for names
and addresses and another format for customer orders. You need record identifica-
tion (ID) codes to identify which records are to be used with each format.

You should specify record ID codes when multiple record format definitions are
used by a file definition for a file. If you do not use record ID codes to specify
record selection comparisons, the system assumes you want to include all the
records that can be read from the file. The system also assumes you want to
process all the records using the first record format definition used by the file defi-
nition for the file.

You can select specific records by asking the system to search through the file for
only those records that pass certain tests. The system will select records by
making comparisons between the data in the file and the specified qualifying condi-
tions. These qualifications are called record identification (ID) codes. Record ID
codes specify tests that:
Ÿ Identify different record types contained in the file.
Ÿ Identify certain records in the file.

When you create a record format definition, use the Define Record ID Codes
display to specify up to 70 tests used for identifying and selecting the records to be
processed by the record format definition. Only character and zoned fields can be
used for record ID codes.

 Copyright IBM Corp. 1997 10-1


à Define Record ID Codes
ð
Definition . . . . . : XXXXXXXXXX Dictionary . . . . . : XXXXXXXXXX

Type field comparisons for record ID codes, press Enter.


Tests: EQ, NE, ZN, NZ, DG, ND

Field Position Test Value And/Or


__________ _____ _____ _ ______
__________ _____ _____ _ ______
__________ _____ _____ _ ______
__________ _____ _____ _ ______
__________ _____ _____ _ ______ XXXXXXXXXXXX
-------------------------------------------------------------------------------
List of Field Definitions

Name Length Type Name Length Type


XXXXXXXXXX XXXXXXXX XXXXXXXXXX XXXXXXXXXX XXXXXXXX XXXXXXXXXX
XXXXXXXXXX XXXXXXXX XXXXXXXXXX XXXXXXXXXX XXXXXXXX XXXXXXXXXX
XXXXXXXXXX XXXXXXXX XXXXXXXXXX XXXXXXXXXX XXXXXXXX XXXXXXXXXX
XXXXXXXXXX XXXXXXXX XXXXXXXXXX XXXXXXXXXX XXXXXXXX XXXXXXXXXX
XXXXXXXXXXXX
F3=Exit F11=Display text F12=Cancel F24=More keys

á ñ
When you use Client Access to transfer an IDDU-defined file to the personal com-
puter, you can select the record format definition you want to use to do the transfer.
Using tests defined by the record ID code specified in the selected record format
definition, Client Access transfers the records that pass those tests.

When you use AS/400 Query to report data in a file, or use the data file utility to
add or update data in a file, you select a record format definition to be used in
processing the file. The content of a field or fields within each record is compared
with the record ID codes specified in the selected record format definition. If the
specified conditions, or tests, are true (the data passes the tests specified by the
record ID codes), the record is included in the report.

10-2 IDDU Use V4R1


Chapter 11. File Definition Considerations
This chapter describes special functions available for file definition.

The performance of some applications can be improved by using keyed files and by
accessing records by key. This chapter describes how to define key fields.

Selecting Key Field Sequence


Key fields allow you to arrange records within a file. For example, if you have a file
of customer names and each customer’s balance due your company, you can
arrange the records either by the customer name (alphabetically) or by the balance
due. The records, when balance due is the key field, can be ordered in descending
sequence with the largest amount owed your company returned first.

When creating or changing a file definition using key fields, you can specify the
following:
Ÿ Selection and sequence of key fields
Ÿ Ascending or descending sequence for each key field
Ÿ Key field value of signed, unsigned, absolute value, digit portion, or zone
portion
Ÿ Whether duplicate keys are allowed
Ÿ Sequence of records with duplicate keys

If you enter Y at the Select key field sequence prompt on the Create File Definition
or Change File Definition displays, the Select Key Field Sequence display appears.
Note: You may see the Create and Select Field Definition display immediately, or
the Create and Select Record Format display may appear before the Select
Key Field Sequence display appears.

à Select Key Field Sequence


ð
Definition . . . . . . . : XXXXXXXXXX Dictionary . . . . . : XXXXXXXXXX
Record format . . . . . : XXXXXXXXXX

Type sequence number (ð-9999), (and Field), press Enter.

Seq Field Length Type Text


____ __________
____ XXXXXXXXXX XXXXXXXX XXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

When your selection of fields is complete, press the Enter key. (The display may
be used for viewing only.) If changes were made, the display appears again so
you can verify the changes. Press the Enter key again to proceed. If changes
were not made, pressing the Enter key causes the process to continue.

 Copyright IBM Corp. 1997 11-1


Changing File Key Attributes
Additional key field sequencing attributes at the file level are available by pressing
the F19 (Change file key attributes) on the Select Key Field Sequence display.
These attributes apply to the entire key, which is the combination of all the key
fields.

à Change File Key Attributes


ð
Definition . . . . . : XXXXXXXXXX Dictionary . . . . . : XXXXXXXXXX

Type choices, press Enter.

Allow duplicate key values . . . . Y Y=Yes, N=No

Key order . . . . . . . . . . . . 1 1=First in, first out


2=Last in, first out
3=First changed, first out

Note: The Key order prompt is only shown if you press the Enter key with Y (the
default) in the Allow duplicate key values prompt.

The following explains the prompts on this display:


Definition
Name of the file definition you are creating or changing.
Dictionary
Name of the dictionary containing your file definition.
Allow duplicate key values
Type the letter of the appropriate option.
Y=Yes You want to allow records to have duplicate key values.
N=No You do not want to allow records to have duplicate key
values.
When you choose Y and press the Enter key, the Key order prompt
appears and you can specify how records with duplicate key values are
retrieved from the file. When you select N and press the Enter key, the
Allow duplicate null fields prompt appears and you can specify if you
want null fields to be included.
Key order
Specify the order in which to retrieve records with duplicate key values
from among the following options:
1=First in, first out
From the records with duplicate key values, you want to
retrieve the first record added to the file, then the second
record added, and so on.
2=Last in, first out
From the records with duplicate key values, you want to
retrieve the last record added to the file, then the second-to-
last record added, and so on.
3=First changed, first out
From the records with duplicate key values, you want to
retrieve the record with the key value that was changed first,

11-2 IDDU Use V4R1


then the record with the key value that was changed second,
and so on.
Allow duplicate null fields
Specify whether a null field is to be considered a unique key or not.
Although unique keys was specified in the Allow duplicate key fields
prompt, you can further specify if null fields are to be included:
Y=Yes If a field you specified to be a key is also a null field, then
this null field is allowed to have duplicates only for the null
value.
N=No If a field you specified to be a key is also a null field, then
this null field is also a unique key field.

Changing Key Field Sequence Attributes


You can define additional key field sequencing attributes by pressing F13 (Change
key field sequence attributes) on the Select Key Fields display on page 11-1. The
Change Key Field Sequence Attributes display allows changes in:
Ÿ Order:
Ascending
Records are arranged from lowest to highest key field value.
Descending
Records are arranged from highest value to lowest key field value.
Ÿ Value:
1=Signed Records are arranged using the numeric value of the key field. The
data must be numeric.
2=Unsigned
Records are arranged using the character value of the key field.
The data can be of any type.
3=Absolute value
Records are arranged using the absolute value of the key field,
meaning the sign of the numeric value is ignored. The data must be
numeric.
4=Digit portion
Records are arranged using only the right 4 bits in each byte of the
key field. The data must be character or zoned decimal.
5=Zone portion
Records are arranged using only the left 4 bits in each byte of the
key field. The field must be character or zoned decimal.

Chapter 11. File Definition Considerations 11-3


à Change Key Field Sequence Attributes
ð
Definition . . . . . . . : XXXXXXXXXX Dictionary . . . . . : XXXXXXXXXX
Record format . . . . . : XXXXXXXXXX

Type changes, press Enter.


A/D: A=Ascending, D=Descending
Value: 1=Signed, 2=Unsigned, 3=Absolute value
4=Digit portion, 5=Zone portion

A/D Value Field Type Text


A d XXXXXXXXXX XXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
A d XXXXXXXXXX XXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
A d XXXXXXXXXX XXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
A d XXXXXXXXXX XXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
A d XXXXXXXXXX XXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

11-4 IDDU Use V4R1


Chapter 12. Maintaining Definitions
To maintain definitions, choose option 1 (Work with definitions) on the Interactive
Data Definition Utility (IDDU) menu or enter the Work with Data Definitions
(WRKDTADFN) command on any command line. The Select Definition Type
display will appear. Choose option 1 (Field), option 2 (Record format), or option 3
(File) and press the Enter key.

The Work with ... Definitions display will appear. On that display, you can choose
to do the following:
Ÿ Create a new definition
Ÿ Change a definition
Ÿ Copy a definition
Ÿ Delete a definition
Ÿ Print or display the details of a definition
Ÿ Rename a definition
Ÿ Display the where-used information about a definition

à Work with ... Definitions


ð
Dictionary . . . . . : XXXXXXXXXX

Position to . . . . . . __________ Starting characters

Type options (and File Definition), press Enter.


1=Create 2=Change 3=Copy 4=Delete
6=Print 7=Rename 8=Display where used

File File File File


Opt Definition Opt Definition Opt Definition Opt Definition
_ __________
_ XXXXXXXXXX _ XXXXXXXXXX _ XXXXXXXXXX _ XXXXXXXXXX

Creating definitions is discussed in Chapter 7, “Defining Fields,” Chapter 6,


“Defining Record Formats,” and Chapter 5, “Defining Files.” You can choose up to
72 definitions to work with on the list display. The various tasks can be mixed on
the same list, meaning that you can, for example, change one field definition and
rename another.

Changing a Definition
Before you begin to change a definition, choose option 8 (Display where used) on
the Work with ... Definitions display to confirm that the definition is not linked to a
database file, because you cannot change a linked definition. IDDU does not
check for this link until you attempt to save the changes. Linking and unlinking
definitions and files is discussed in Chapter 14, “Maintenance Requiring Com-
mands or Programming.”

This and other potential error conditions are not tested for until near the end of the
definition process. Messages presented on the End ... Definition display describe
the cause of any errors that prevent you from saving the definition.

 Copyright IBM Corp. 1997 12-1


à End ... Definition
ð
Definition . . . . . : XXXXXXXXXX Dictionary . . . . . : XXXXXXXXXX
Created . . . . . . : XXXXXXXXXX Created by . . . . . : XXXXXXXXXX

Type choice, press Enter.


Save definition . . . . . . . . Y Y=Yes, N=No

List of Items Using this Definition

Definition Type Lib/Date Text


XXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXX
Press Enter to continue.

F3=Exit F11=Display names only F12=Cancel

á ñ
You change a definition by choosing option 2 (Change) on the Work with ... Defi-
nitions display.

When you press the Enter key, you will see the Change ... Definition display with
the name of the definition and its dictionary. In addition, you see the ID of the
person who originally created the definition and the date, and the ID of the person
who last changed it and the date. When you get to the Field Options display, you
can also change the long comment and the text describing the definition. When the
Long Comment field of the Change ... Definition display is marked with a >, a long
comment already exists for that definition.

Changing a File Definition


When you do not create new or select different record format definitions, the file
definition continues to use the ones that were previously selected for it. See “Cre-
ating a Record Format Definition” on page 6-4 and “Selecting a Record Format for
a File Definition” on page 5-8 for information about these subjects.

IDDU cannot detect changes that affect the relationships between the file and any
other program or utility; therefore, you must be aware of these programs and the
file characteristics they expect. For example, you could use AS/400 Query to
create a query of a file, and then use IDDU to change the size of a field or the
number or arrangement of fields without changing the name of the file or its defi-
nition. These changes will cause Query errors, and Query will describe the
detected changes.

Changing a Record Format Definition


When you complete any work changing a record format, you will use the End
Record Format Definition display to confirm the work you did, and to see the other
definitions and database files affected by changes to the record format definition. If
any of your work causes errors, you will not be allowed to save your changes.

On the Change a Record Format Definition display you can also choose to create
or select field definitions, and to specify record ID codes.

12-2 IDDU Use V4R1


When you choose to create or select field definitions, you go to the Create and
Select Field Definitions display; see “Selecting a Field Definition” on page 6-6.

The Specify record ID code field is marked with a > when record ID codes have
already been defined. If no record ID codes are defined, all the records are used
for each format in the file. When you choose to specify record ID codes, you go to
the Define Record ID codes display; see “Using Record Identification Codes” on
page 10-1.

Changing a Field Definition


For a field definition, you can also specify the field characteristics.

The type of field can be character, numeric, DBCS, or date/time. You must specify
the field size (except for date/time fields) and you can also enter a brief description.
Numeric fields require that you specify the number of decimal positions.

When you choose to specify more options for each of the four types of fields, you
can also work on field options displays. These additional options include column
headings, null values, keyboard shift values, long comments, and an alias for the
field described by the definition. See “Additional Characteristics for All Field Types”
on page 7-6, and Chapter 9, “Field Editing Techniques,” for details about the addi-
tional options.

When a changed field is to be used in a record format ID code test, be sure that
the data type of the field is specified only as zoned or character. This condition is
not tested for until near the end of the definition process. If the data in a field is not
either zoned or character, you will not be able to save the new definition. Record
format ID codes are discussed in “Using Record Identification Codes” on
page 10-1.

Also, do not change the size of a field definition so that the position tested for in a
record format ID code test is greater than the new field size. This also is not tested
for until near the end of the definition process. If you exceed the size limit you will
not be able to save the definition.

Do not increase the length of a field if such an increase will make the total length of
all fields in the record format definition greater than 32 766 bytes (32 740 bytes if a
variable-length field is used).

Remember that only character (SBCS) and DBCS fields can be variable-length and
that the maximum length of a variable-length field is 32 740 (16 370 for
DBCS-graphic fields).

Do not make an alias the same as any other alias, or the same name as any field
definition name that will be used by the same record format definition.

If a field is used as a key field, you cannot save a change that would exceed the
maximum key length. Also, you cannot change to a data type that cannot provide
the key field value specified in the file definition.

When you complete your work changing a field, use the End Field Definition display
to confirm the work you did and to see the other definitions and database files
affected by the changed definition. Remember that if any of your work causes
errors, you will not be allowed to save your changes.

Chapter 12. Maintaining Definitions 12-3


Exiting the Definition Process
If you decide to quit while creating or changing a definition, press F3 (Exit). When
you do this, the Exit Definition Process display will appear. Choose to exit IDDU
without saving the definitions you created/changed or choose to resume the IDDU
session.

à Exit Definition Process


ð
Dictionary . . . . . . : XXXXXXXXXX

Work on the following definitions will not be saved:

Definition Type Option Definition Type Option


XXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXXXX
XXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXXXX
XXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXXXX
XXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXXXX
XXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXXXX
XXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXXXX

Select one of the following:

2=Exit without saving


3=Resume IDDU Session

Selection

F12=Cancel

á ñ
To save a definition, do not use the (F3) Exit. Enter the desired information and
press the Enter key until the End ... Definition display appears.

Copying Definitions
You can create a copy of any definition (in any dictionary you are authorized to
work in) and all its associated definitions. You can copy a file definition and all of
its associated record format and field definitions, a record format definition and all
of its associated field definitions, or a field definition. The copy can be made either
to the same dictionary or to another dictionary.

Choose option 3 (Copy) on the Work with ... Definitions display. Type the name of
the definition to copy, and press the Enter key. The following display appears:

12-4 IDDU Use V4R1


à Copy ... Definition
ð
From ... . . . . : XXXXXXXXXX Dictionary. . . . . . : XXXXXXXXXX
Created . . . . . : XXXXXXXX Created by. . . . . . : XXXXXXXXXX
Text . . . . . . : XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Type choices, press Enter.

To ... definition . . . . . . . default___ Name, F4 for list

Dictionary . . . . . . . . . default___ Name, F4 for list

F3=Exit F4=List F12=Previous

á ñ
On the Copy ... Definition display, type a name for this copy of the definition and
the name of the dictionary into which you want the copy placed.

On the Copy ... Definition display, you can see the name of the definition you are
copying, the dictionary it is in, the date when it was created and the user ID of the
person who created it. Also, if one was entered, a brief description of the definition
is shown.

When you are copying a file definition or a record format definition into a different
dictionary, new versions of the definitions used by the file or record format will be
created in the (copied to) dictionary if identical versions do not already exist.

After you press the Enter key on the Copy ... Definition display, you will go to the
Confirm Copy display. Use that display to confirm or cancel the copying of the
definition.

à Confirm Copy
ð
Copy ... Definition
From . . . . . . . . : XXXXXXXXXX Dictionary . . . . . : XXXXXXXXXX
To . . . . . . . . . : XXXXXXXXXX Dictionary . . . . . : XXXXXXXXXX

Type choice, press Enter.


Copy definitions . . . . . . . . Y Y=Yes, N=No

Definitions to be Included in the Copy


Definition Type Definition Type Definition Type
XXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXX XXXXXXXXXXXX
XXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXX XXXXXXXXXXXX
XXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXX XXXXXXXXXXXX

The confirmation display gives you the opportunity to check the name of the defi-
nition being copied, and the name being assigned to the copy, as well as the
names of any other definitions that will be included in the copy.

Chapter 12. Maintaining Definitions 12-5


Deleting Definitions
You can delete a file, record format, or field definition by choosing option 4 (Delete)
on the Work with ... Definitions display. Type the name of the definition to be
deleted and press the Enter key. The following Confirm Delete of ... Definition
display is shown.

à Confirm Delete of ... Definition


ð
Definition . . . . . : XXXXXXXXXX Dictionary . . . . . : XXXXXXXXXX
Created . . . . . . : XXXXXXXXXX Created by . . . . . : XXXXXXXXXX
Text . . . . . . . . : XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Type choice, press Enter.

Delete . . . . . . . Y Y=Yes, N=No

List of Items Affected by Delete

Definition Type Msg Definition Type Msg


XXXXXXXXXX XXXXXXXXXXXXXXXX XXXX XXXXXXXXXX XXXXXXXXXXXXX XXXX
XXXXXXXXXX XXXXXXXXXXXXXXXX XXXX XXXXXXXXXX XXXXXXXXXXXXX XXXX
XXXXXXXXXX XXXXXXXXXXXXXXXX XXXX XXXXXXXXXX XXXXXXXXXXXXX XXXX
XXXXXXXXXX XXXXXXXXXXXXXXXX XXXX XXXXXXXXXX XXXXXXXXXXXXX XXXX
XXXXXXXXXX XXXXXXXXXXXXXXXX XXXX XXXXXXXXXX XXXXXXXXXXXXX XXXX
XXXXXXXXXX XXXXXXXXXXXXXXXX XXXX XXXXXXXXXX XXXXXXXXXXXXX XXXX

F3=Exit F11=Display text F12=Cancel

á ñ
Use the Confirm Delete of ... Definition display to be sure that you are deleting the
appropriate definition, and to determine what items will be affected by the deletion.

You will not be allowed to delete a definition if:


Ÿ A file definition is linked to a database file.
Ÿ A record format definition is the only one in a file definition.
Ÿ A field is used as a key field or in a record format ID test.
Ÿ A field definition is the only one used by a record format.

You will get a message when you attempt the deletion if it will cause errors in a
related definition or file.

Printing Definitions
On the Work with ... Definition display, name the definition to print, and choose
option 6 (Print). When you press the Enter key, you see the following Print Options
display, where you confirm the name of the data definition you named on the Work
with ... Definitions display as the definition you want to print. If necessary, you can
change this to the name of a different definition.

12-6 IDDU Use V4R1


à Print Options
ð
Dictionary . . . . . : XXXXXXXXXX

Type choices, press Enter.

Definition type . . . . . . . . _ 1=File, 2=Format, 3=Field

Definition . . . . . . . . . . __________ \ALL, Name


Creation date . . . . . . . . __________

File information . . . . . . . 1 1=Basic, 2=Detail,


3=Extended, 4=All, 5=None

Format information . . . . . . 1 1=Basic, 3=Extended, 4=All


5=None

Field information . . . . . . . 1 1=Basic, 2=Detail,


3=Extended, 4=All, 5=None

Printer device . . . . . . . . \PRINT____ \PRINT, \, Name

F3=Exit F12=Previous

á ñ
On this display you choose the level of detail to print or display, and you can
specify the name of a printer device (a printer or a print queue). You can also
display the definition (rather than printing it) by specifying an * for the Printer
prompt.
Note: You can also print or display the contents of a data dictionary with the
Display Data Dictionary (DSPDTADCT) command, described in
Appendix D, “IDDU Commands.”

For a definition, you can choose to print:


Ÿ A basic summary of a definition, listing the following:
– The name and type of the definition.
– The dictionary containing the definition.
– For a file, the number of record formats contained.
– For a format, the number of fields and the record length.
– For a field, the data type, field length, number of decimal positions, and any
column headings. When file or record format definitions are printed, the
basic field information also includes buffer length, buffer position, and field
usage.
– Any descriptive text associated with the definition.
Ÿ A detailed summary of a field definition, which includes all basic information as
well as the creation date and user-ID of the person who created it, and the
last-change date and user-ID of the person who last changed it, plus any alias,
keyboard shift, or numeric editing information.
Ÿ A detailed summary of a file definition, which includes all basic information plus
any key field information.
Ÿ An extended summary of a definition, which prints all the information printed in
a basic, or detailed, listing plus any long comment.

Chapter 12. Maintaining Definitions 12-7


Ÿ All of the information, which includes the extended listing plus the where-used
information for a definition. In addition, for a record format, the record ID code
information is printed.

Figure 12-1 is an example of a complete file definition printout that illustrates the
level of detail available. You must have the capability to print 132 columns to be
sure of seeing all of the detail printed.

12-8 IDDU Use V4R1


57ðxSSx Rðx Mðx 611111 Display File/Field Information

Dictionary . . . . . . . . . . : SYSDICT
Definition or generic\ . . . . : FILEDEFN
Definition type . . . . . . . . : \FILE
File information . . . . . . . : \ALL
Record format information . . . : \ALL
Field information . . . . . . : \BASIC

File Information

File name . . . . . . . . . . : FILEDEFN


Number of record formats. . . : 1
Type of file . . . . . . . . : Physical
Last changed . . . . . . . . : ð3/ð6/84
Changed by . . . . . . . . . : ARCHER
Created . . . . . . . . . . . : 11/ð4/83
Created by . . . . . . . . . : MILLER
File text . . . . . . . . . . : practice definition for DFU and Query

Record Format Information

Record format name . . . . . : NAMEADDRR


Number of fields . . . . . . : 8
Record length . . . . . . . . : 95
Last changed . . . . . . . . : ð8/ð6/83
Changed by . . . . . . . . . : COOPER
Created . . . . . . . . . . . : ð3/ð4/82
Created by . . . . . . . . . : FENSTER

Record Format Where Used List

Name Type Lib/Date Text

FILEDEFN FILE DEF 12/29/83 practice definition for DFU and Query

Field Level Information

Data Field Buffer Buffer Field


Field Type Length Length Position Usage Column Heading

LASTNAME CHAR 15 15 1 Both


Field text . . . . . . . . . . . . : Last name
FIRSTNAME CHAR 1ð 1ð 16 Both
Field text . . . . . . . . . . . . : First name
ADDRESS1 CHAR 2ð 2ð 26 Both
Field text . . . . . . . . . . . . : Address line 1
ADDRESS2 CHAR 2ð 2ð 46 Both
Field text . . . . . . . . . . . . : Address line 2
CITY CHAR 15 15 66 Both
Field text . . . . . . . . . . . . : City
STATE CHAR 2 2 81 Both
Field text . . . . . . . . . . . . : State

Data Field Buffer Buffer Field


Field Type Length Length Position Usage Column Heading

ZIP CHAR 9 9 83 Both


Field text . . . . . . . . . . . . : Zip code
AMOUNT PACKED 6 2 4 92 Both
Field text . . . . . . . . . . . . : Amount

Figure 12-1. Example of All Information Printed for a File Definition

Chapter 12. Maintaining Definitions 12-9


Renaming Definitions
To rename a definition, choose option 7 (Rename) on the Work with ... Definition
display, identify the definition to be renamed, and press the Enter key. You see the
following Rename ... Definition display, where you can determine the items affected
by renaming the definition.

à Rename ... Definition


ð
Definition . . . . . : XXXXXXXXXX Dictionary . . . . . : XXXXXXXXXX
Created . . . . . . : XXXXXXXXXX Created by . . . . . : XXXXXXXXXX
Text . . . . . . . . : XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Type choice, press Enter.


New name . . . . . . . . . __________

List of Items Affected by Rename

Definition Type Msg Definition Type Msg


XXXXXXXXXX XXXXXXXXXXXXXXXX XXXX XXXXXXXXXX XXXXXXXXXXXXXXX XXXX
XXXXXXXXXX XXXXXXXXXXXXXXXX XXXX XXXXXXXXXX XXXXXXXXXXXXXXX XXXX
XXXXXXXXXX XXXXXXXXXXXXXXXX XXXX XXXXXXXXXX XXXXXXXXXXXXXXX XXXX
XXXXXXXXXX XXXXXXXXXXXXXXXX XXXX XXXXXXXXXX XXXXXXXXXXXXXXX XXXX
XXXXXXXXXX XXXXXXXXXXXXXXXX XXXX XXXXXXXXXX XXXXXXXXXXXXXXX XXXX
XXXXXXXXXX XXXXXXXXXXXXXXXX XXXX XXXXXXXXXX XXXXXXXXXXXXXXX XXXX
XXXXXXXXXX XXXXXXXXXXXXXXXX XXXX XXXXXXXXXX XXXXXXXXXXXXXXX XXXX
XXXXXXXXXX XXXXXXXXXXXXXXXX XXXX XXXXXXXXXX XXXXXXXXXXXXXXX XXXX
XXXXXXXXXXXX

F3=Exit F11=Display text F12=Cancel

á ñ
You cannot rename:
Ÿ Any definition if it will cause errors in other definitions
Ÿ A field definition if the new name is the same as its current alias
Ÿ A field definition if the new name is the same as any another field name or
alias used by the same record format
Ÿ A record format definition if the new name is the same as that for another
record format definition used by the same file definition
Ÿ A file definition if it is linked to a database file

Linking and unlinking definitions and files is discussed in Chapter 14, “Maintenance
Requiring Commands or Programming.” All the IDDU commands are discussed in
Appendix D, “IDDU Commands.”

When the rename occurs, all references to the old definition name in other defi-
nitions are changed to the new name.

Displaying Where Definitions Are Used


You can determine the names of the files and definitions that use a definition. On
the Work with ... Definitions display, choose option 8 (Display where used), type the
name of the definition, press the Enter key, and the following display appears:

12-10 IDDU Use V4R1


à Display Where ... Definition Used
ð
Definition . . . . . : XXXXXXXXXX Dictionary . . . . . : XXXXXXXXXX
Created . . . . . . : XXXXXXXXXX Created by . . . . . : XXXXXXXXXX
Text . . . . . . . . : XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Definition Type Lib/Date Text


XXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXX
Press Enter to continue.

F3=Exit F11=Display names only F12=Cancel

á ñ
All Display Where ... Definition Used displays show:
Ÿ The name of the dictionary containing the definition
Ÿ The date when the definition was created
Ÿ The user ID of the person who created the definition
Ÿ A brief description of the definition, if one was entered

On the Display Where File Definition Used display, you also see:
Ÿ A list of the files that use the definition

On the Display Where Format Definition Used display, you also see:
Ÿ A list of the files and file definitions that use the definition

On the Display Where Field Definition Used display, you also see:
Ÿ A list of the files, file definitions, and record format definitions that use the defi-
nition

Recovering a Definition
When a system failure such as a power failure interrupts the creation or changing
of a definition, the system attempts to save the work in progress. The work is
saved for a file or record format definition that was not completely created, or for a
file, record format, or field definition that was not completely changed. When you
attempt to work with the incomplete definition, you will see the Recover ... Work
display or Recover ... Definition Changes display. Also, if a field (or group of fields)
was being created via IDDU, the next time the user working on those fields selects
to create fields, the Recover Field Definition Work display is shown.

Chapter 12. Maintaining Definitions 12-11


à Recover ... Definition Changes
ð
Definition. . . . . . : XXXXXXXXXX Dictionary . . . . . : XXXXXXXXXX
Created . . . . . . . : XXXXXXXXXX Created by . . . . . : XXXXXXXXXX
Last changed . . . . : XXXXXXXXXX Changed by . . . . . : XXXXXXXXXX
Text . . . . . . . . : XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Date when definition was interrupted. . . . . . . . . . . . . . : XXXXXXXX


User ID of person working with definition . . . . . . . . . . . : XXXXXXXXXX

The last request for the definition ended abnormally.

Select one of the following:

1. Attempt recovery of changes made to the interrupted definition


2. Delete changes to the interrupted definition

Selection
===>
á ñ
The Created, Created by, Last changed, and Changed by fields are not shown on
the Recover ... Definition Work display.

You can either attempt to recover and resume the interrupted session or continue
with your current task, discarding the information saved from the interrupted
session. The attempt to recover will begin at the appropriate Change (or Create)
Definition display.

12-12 IDDU Use V4R1


Chapter 13. Maintaining Data Dictionaries
To maintain dictionaries, choose option 2 (Work with data dictionaries) on the Inter-
active Data Definition Utility (IDDU) menu, or enter the Work with Data Dictionaries
(WRKDTADCT) command on any command line.

Use the Work with Data Dictionaries display to choose the dictionary to maintain
and to describe the kind of maintenance you want to do. On that display, you can
choose to:
Ÿ Create a new dictionary
Ÿ Change a dictionary
Ÿ Delete a dictionary
Ÿ Print information about a dictionary

à Work with Data Dictionaries


ð
Position to . . . . . . __________ Starting characters

Type options (and Data Dictionary), press Enter.


1=Create 2=Change 4=Delete 6=Print

Data Data Data Data


Opt Dictionary Opt Dictionary Opt Dictionary Opt Dictionary
1 SALES
_ AAXXXXXXXX _ BCXXXXXXXX _ CEXXXXXXXX _ EBXXXXXXXX

Creating dictionaries is discussed in Chapter 4, “Working with Data Dictionaries.”

Additionally, you can do maintenance of dictionaries that does not use the Work
with Data Dictionaries display. This includes:
Ÿ Saving a dictionary
Ÿ Restoring a dictionary
Ÿ Renaming a dictionary

These tasks are described later in this chapter, as is the effect on dictionary use of
definitions created or used by the Structured Query Language/400 (SQL/400*) lan-
guage.

Chapter 14, “Maintenance Requiring Commands or Programming,” describes other


work with dictionaries, including:
Ÿ Changing dictionary definitions linked to a file
Ÿ Changing copies of dictionary definitions
Ÿ Adding definitions from an externally described file to a dictionary

Changing a Data Dictionary


For any data dictionary you have created, you can change the level of security by
changing the access authority of others to the definitions. You can also change the
long comment and the text that describe the dictionary. To make changes, choose
option 2 on the Work with Data Dictionaries display and specify the dictionary you
want to work with. Then, on the Change Data Dictionary display, you can:

 Copyright IBM Corp. 1997 13-1


Ÿ Press F18 (Change authority) to specify the changes you want to make to the
access of others to the dictionary and its data definitions. Choose option 1
(Select) to view or change the Long comment. You can also choose option 4
(Remove) to delete it entirely (or press the spacebar for a space to keep it as it
is).
Ÿ Type in any change to the Text description.
Note: You cannot rename a dictionary or a library that contains a dictionary; this is
not the same as changing a dictionary. However, you can restore a dic-
tionary to a library you have named, at which time the dictionary copy will
have the name of the library into which it was “restored.”

Deleting a Data Dictionary


To delete a dictionary, choose option 4 (Delete) on the Work with Data Dictionaries
display and specify the dictionary you want to delete. You then see the Confirm
Delete of Data Dictionary display, where you can verify the name and description of
the dictionary specified to be deleted. You can also use the Delete Data Dictionary
(DLTDTADCT) command described in Appendix D, “IDDU Commands.” With the
DLTDTADCT command, a message appears telling you if the delete was suc-
cessful.

à Confirm Delete of Data Dictionary


ð
Dictionary . . . . . : DICTNAME
Text . . . . . . . . : ANY TEXT ENTERED ABOUT THIS DICTIONARY AND ITS USE

Type choice, press Enter.


Delete . . . . . . . Y Y=Yes, N=No

List of Items Affected by Delete

Name Type Msg Name Type Msg


xxxxxxxxxx xxxxxxxxxxxxxxxx xxxx xxxxxxxxxx xxxxxxxxxxxxxxxx xxxx
xxxxxxxxxx xxxxxxxxxxxxxxxx xxxx xxxxxxxxxx xxxxxxxxxxxxxxxx xxxx
xxxxxxxxxx xxxxxxxxxxxxxxxx xxxx xxxxxxxxxx xxxxxxxxxxxxxxxx xxxx

To confirm that you really do want to delete a dictionary, type a Y for the Delete
prompt; or, if necessary, you can cancel the deletion by typing an N for this prompt.

When a dictionary is linked to an externally described file, the links are removed
during the deletion. You cannot delete a dictionary while it is linked to a program-
described file. You must use the Link Data Definition (LNKDTADFN) command
described in Appendix D, “IDDU Commands,” to unlink them.

Printing the Contents of a Data Dictionary


You can choose to print the contents of a dictionary and name the dictionary to
print from using the Work with Data Dictionaries display. When you press the Enter
key, you see the following Print Options display, where you choose the types of
definitions (field definition, record format definition, or file definition) and the level of
information you want to print for each type of definition.

13-2 IDDU Use V4R1


à Print Options
ð
Dictionary . . . . . : XXXXXXXXXX

Type choices, press Enter.

Definition type . . . . . . . . _ 1=File, 2=Format, 3=Field

Definition . . . . . . . . . . __________ \ALL, Name


Creation date . . . . . . . . __________

File information . . . . . . . 1 1=Basic, 2=Detail,


3=Extended, 4=All, 5=None

Format information . . . . . . 1 1=Basic, 3=Extended, 4=All


5=None

Field information . . . . . . . 1 1=Basic, 2=Detail,


3=Extended, 4=All, 5=None

Printer device . . . . . . . . \PRINT____ \PRINT, \, Name

F3=Exit F12=Previous

á ñ
The level of detail printed is the same as for printing the individual definitions, as
described under “Printing Definitions” on page 12-6. Alternatively, you can view
the contents of a data dictionary with the Display Data Dictionary (DSPDTADCT)
command described in Appendix D, “IDDU Commands.”

Other Dictionary Maintenance


There are other tasks you might want to perform when working with dictionaries,
such as saving or renaming a dictionary. There are no IDDU options to do these
things, but it is possible to do them by using AS/400 commands and features.

Data Dictionary Recovery: Saving and Restoring


A dictionary is saved and restored as part of the SAVLIB and RSTLIB commands.
To be able to recover the definitions in a dictionary, you must save (copy) the
library containing the definitions to another medium, such as tape or diskette, at
regular intervals, and keep the copy in another secure place away from the imme-
diate area of the system.
Note: Interrupted work in progress from create or change operations is not saved
or restored when the dictionary is saved or restored.

When it becomes necessary to restore the dictionary (or any part of the library),
you have only to reload the saved files from the backup medium using the RSTLIB
command after deleting the existing dictionary. To recover individual definitions,
see “Recovering a Definition” on page 12-11. When files existing in one library are
dependent on the definitions in another library’s dictionary, the library containing the
data dictionary should be restored first. This would be the case if a file were linked
to the definitions in a different library, or if a logical file has been created that
depends on the definitions in a different library.
Note: A dictionary that contains or has contained variable-length character, DBCS,
null-capable, or date/time fields cannot be saved prior to Version 2 Release
1.1. A dictionary that contains or has contained DBCS-graphic fields or file

Chapter 13. Maintaining Data Dictionaries 13-3


definitions with a key length greater than 120 bytes (115 bytes for FCFO)
cannot be saved prior to Version 2 Release 2.

For more general information about saving and restoring libraries and about using
the SAVLIB and RSTLIB commands, see CL Reference and Backup and Recovery.

Copying a Data Dictionary


You can copy a dictionary by creating a new dictionary and then copying the defi-
nitions of the original dictionary into the new one using the technique described in
“Copying Definitions” on page 12-4. When you copy a file definition, all of the defi-
nitions used by that file definition are also copied. The only definitions in the dic-
tionary that would not be automatically copied are those that are not being used.
Another technique would be to save and rename the dictionary as described in
“Renaming a Data Dictionary.”

Renaming a Data Dictionary


Rename a dictionary by saving the library containing the dictionary and restoring it
under a different name.

Considerations When SQL/400 Users Share Dictionaries


If IDDU users and SQL users share dictionaries, there are certain topics that must
be considered, including terminology and definitions.

SQL Terminology
SQL uses its own terminology in naming objects. When SQL creates a collection, it
is actually a library with a dictionary. When SQL creates a table, it is actually a file
with a definition. In general, the definitions in the dictionary can be worked with by
using IDDU. The following table shows the relationship between AS/400 object
names and SQL object names:

System Terms SQL Terms


Library: Groups related objects and allows Collection: Consists of a library, a journal,
the user to find the objects by name. a journal receiver, a data dictionary, and a
SQL catalog. A collection groups related
objects and allows the user to find the
object by name.
Physical file: A set of records. Table: A set of columns and rows.
Record: A set of fields. Row: The horizontal part of a table con-
taining a serial set of columns.
Field: One or more characters of related Column: The vertical part of a table of one
information of one data type. data type.
Logical file: A subset of the fields and View: A subset of the columns and rows of
records of one or more physical files. one or more tables.

When SQL users and IDDU users share the same dictionary, some definitions
created by one may be used by the other. Both IDDU users and SQL users must
understand how they will affect each other.

13-4 IDDU Use V4R1


SQL Definitions Used by IDDU
When a definition is created by SQL, it is immediately linked to a file. IDDU users
can use the definition, print it, copy it, or view where it is used while it is still linked.
When the definition is no longer linked, then IDDU can be used to change or delete
it.

When SQL no longer needs a definition, it is deleted unless it has been used by
IDDU. If the definition has been used by IDDU, it will not be dropped from the
dictionary when the SQL table is dropped. Only through SQL can you delete defi-
nitions created and used only by SQL (and then only when the definition is not
linked to a file).

IDDU Definitions Used by SQL


SQL users can use a definition created by IDDU. When SQL needs a definition,
the dictionary is searched for a similar definition. When a matching definition is
found, it is used rather than creating a new definition.

Because SQL automatically links the definitions to files, definitions being used by
SQL cannot be deleted or changed by IDDU users. IDDU users can continue to
use the definition. They can print it, copy it, and view where it is used.

SQL deletes a definition when it is no longer needed, unless it is used by another


file. However, SQL only deletes definitions created by SQL. Definitions created by
IDDU are not deleted by SQL.

Unsupported SQL
SQL-created files are linked to the data dictionary associated with the collection
when the file is created. The Add Data Definition (ADDDTADFN) command does
not support SQL-created files because of this link. An error message informs you
that the command does not operate on SQL files.

Dictionaries created by SQL cannot be deleted using IDDU unless they have been
created as part of a library during a restore operation. Also, IDDU cannot restore a
SQL dictionary into an existing library. The library to receive the dictionary must be
created by the restore command. SQL files cannot be linked again to different dic-
tionaries.

Chapter 13. Maintaining Data Dictionaries 13-5


13-6 IDDU Use V4R1
Chapter 14. Maintenance Requiring Commands or
Programming
Many operations related to data dictionaries require that the link between a file defi-
nition and a file be created or removed. The two commands used to manipulate
links are the Link Data Definition (LNKDTADFN) command and the Add Data Defi-
nition (ADDDTADFN) command.

In other cases, various other control language commands not directly related to
IDDU must be used. Yet other operations require that various programming lan-
guages be used because they support the type of data being worked on.

Linking and Unlinking Files and Definitions


You can link and unlink data definitions and the files they describe using the Link
Data Definition (LNKDTADFN) command discussed in Appendix D, “IDDU
Commands.” Program-described files and externally described files can be unlinked
using the LNKDTADFN command, but only program-described files can be linked
using the LNKDTADFN *LINK command. Externally described files must be linked
using the ADDDTADFN command.
Note: The LNKDTADFN *UNLINK *ALL command only unlinks program-described
files. Externally described files must be unlinked one at a time when using
the LNKDTADFN command to unlink.

Additionally, the following considerations apply:


Ÿ When a file is linked, the text of the definition becomes the text of the file.
Ÿ A file can be linked to only one definition, but a definition can be linked to mul-
tiple files.
Ÿ When linking a keyed file, the starting and ending positions of the key must
match the starting and ending positions of fields in the definition. If the starting
and ending positions do not match, the file and file definition cannot be linked.
Ÿ A definition cannot be linked to if it contains a date/time field, variable-length
field, null-capable field, or DBCS-graphic field.
Ÿ A file must be in the same auxiliary storage pool as the definition to which the
file is being linked.

Creating Definitions from Files


The Add Data Definition (ADDDTADFN) command allows you to add the definitions
of an externally described file to an existing data dictionary. These definitions then
become available for use with other files through the dictionary.

To use the command, you must know the name of the file and the library containing
it (library name/file name) so the file's name and library can be added to the speci-
fied dictionary. The default library for the file is *LIBL, or you can specify *CURLIB
for the library if you know the name of the current library.

You can place the file definition in any dictionary in any library to which you are
authorized. For example:

 Copyright IBM Corp. 1997 14-1


ADDDTADFN FILE(MYLIB/MYDEF) DCT(MINE)
adds the definition of the file MYDEF, found in library MYLIB, to dictionary MINE.

The ADDDTADFN command also creates a link between the file and the definition.
If you use the command again with the same file, the first link is dropped, and the
file is linked to the new definition.

Not all file definitions can be added to a dictionary using the ADDDTADFN
command. In general, these can be added:
Ÿ Physical files
Ÿ Nonjoin logical files with one format and no select/omit specifications

When a database file uses a function not supported by IDDU, all of the file’s
descriptions might not be added to the dictionary by the ADDDTADFN command,
and only field and record format definitions are created. Database files using the
following functions lose the description of the given function, and the file definition
is not created:
Ÿ Field default values
Ÿ Field validity check codes
Ÿ Key fields defined using names based on a physical file

Descriptions of the following functions are dropped on an ADDDTADFN command.


However, a file definition is still created.
Ÿ Derived fields
Ÿ Renamed fields

Database files using the following functions do not have any definitions added to a
dictionary by the ADDDTADFN command:
Ÿ Access path sharing
Ÿ Alternative collating sequence

Making Changes to Definitions That Affect Files


The definitions in a dictionary describing a file cannot be changed while the file is
linked to the definitions. Linking and unlinking program-described database files
using the Link Data Definition (LNKDTADFN) command is discussed in “Linking
and Unlinking Files and Definitions” on page 14-1. Externally described database
files created using IDDU can be unlinked using the LNKDTADFN command, but
cannot be linked again using the LNKDTADFN command. For these files, it is nec-
essary to use the Add Data Definition (ADDDTADFN) command to place the file’s
definitions in a dictionary. This process forces the link between the file and the
definitions in the original dictionary to be opened. The ADDDTADFN command is
discussed in “Creating Definitions from Files” on page 14-1.

After the file is unlinked from its definitions, you can add fields or make other
changes to the definitions. See Chapter 12, “Maintaining Definitions” for informa-
tion about changing the file, field, and record format definitions that describe a file.

14-2 IDDU Use V4R1


Changes Affecting Externally Described Files
When you change a dictionary definition that affects externally described files, use
the following process:
1. Use the Display Where File Definition Used display to determine which files are
affected by a change. Select this display from the Work with File Definitions
display. See “Linking and Unlinking Files and Definitions” on page 14-1 for
more information about the effects of unlinking a definition.
2. Save the files so that backup copies will be available if needed.
3. Remove the link between the files and the definitions. Externally described
files can be unlinked with the LNKDTADFN command, or you can change the
links to another (temporary) dictionary with the ADDDTADFN command.
Create the temporary dictionary by using:
a. CRTLIB tempdict
b. CRTDTADCT tempdict
c. ADDDTADFN filename tempdict
Repeat the ADDDTADFN command for each externally described file affected if
you choose not to use the LNKDTADFN command.
4. Rename the files by using:
RNMOBJ filename \FILE tempfile
5. Change the definitions with IDDU. See Chapter 12, “Maintaining Definitions.”
6. Create new files with the original names using IDDU. See Chapter 12, “Main-
taining Definitions.”
7. Copy the data from the original files to the new files. See “Copying Data Files”
on page 14-5.
8. Delete the original files and temporary dictionary by using:
a. DLTF tempfile
b. DLTDTADCT tempdict
c. DLTLIB tempdict
9. If any queries are defined for the files, the AS/400 Query definitions need to be
updated. See Query/400 Use.
10. Save the new files so that backup copies are available if needed.

Changes Affecting Program-Described Files


The processes used to change a dictionary definition affecting program-described
files differ depending on whether the fields are being altered. The methods fol-
lowing are specific to either unchanged or changed fields.

Record Length and Field Positions Unchanged


Use the following process when you change a dictionary definition that affects
program-described files, and if fields are not being added, deleted, resequenced, or
changed in size or type:
1. Remove the link between the files and the definitions.
LNKDTADFN \UNLINK filename
2. Change the definitions with IDDU. See Chapter 12, “Maintaining Definitions.”
3. Link the definitions and the files again.

Chapter 14. Maintenance Requiring Commands or Programming 14-3


LNKDTADFN \LINK filename dictionary definition date (or \FIRST)
4. If any queries are defined for the file, the query definitions must be updated.
See Query/400 Use.

Record Length and Field Positions Changed


Use the following process when you change a definition that affects program-
described files, and fields are being added, deleted, sequenced again, or changed
in size or type:
1. Save the files so that a backup copy is available if needed.
2. Remove the link between the files and the definitions.
LNKDTADFN \UNLINK filename
3. Rename the files.
RNMOBJ filename \FILE tempfile
4. Change the definitions with IDDU. See Chapter 12, “Maintaining Definitions.”
5. Create a new file with the original name using IDDU. See Chapter 8, “Working
with Database Files.”
6. Copy the data from the original files to the new files.
In most cases this will require you to create a program to perform the neces-
sary data conversions. However, if the only change is adding fields to the end
of a record format, you can use the following command.
CPYF tempfile filename FROMMBR(\ALL) TOMBR(\FROMMBR) MBROPT(\ADD) FMTOPT(\NOCHK)

Refer to the CL Reference for more information on the CPYF command.


7. Delete the original files.
DLTF tempfile
8. If any queries are defined for the files, the query definitions must be updated.
See Query/400 Use.
9. Save the new files so that backup copies are available if needed.

Creating a New Version of a Definition


You can also change definitions affecting files by copying the definitions and
changing the copied versions. This process can be used for either externally
described or program-described files, as follows:
1. Create new versions of the definitions to be changed.
a. Copy each definition to a temporary name.
b. Rename the new definition to match the original name.
c. Change the new version.
2. For each upper-level definition affected (for example, a file definition), create a
new version that selects the changed definition.
a. Copy each definition to a temporary name.
b. Rename the new definition to match the original name.
c. Change the new version (of the upper-level definition) to select the new
version of the lower-level definition (for example, a record format definition).
3. For each file affected, create a new file with the same name.
a. Save the original files so that backup copies are available if needed.

14-4 IDDU Use V4R1


b. Rename the files.
RNMOBJ filename \FILE tempfile
c. Create a new file with the original name using IDDU. See Chapter 8,
“Working with Database Files.”
4. Copy the data from the original files to the new files. See “Copying Data Files.”
5. Delete the original files.
DLTF tempfile
6. Delete the original versions of all changed definitions.
7. If any queries are defined for the file, the query definitions must be updated.
See Query/400 Use.
8. Save the new files so that backup copies are available if needed.

Copying Data Files


In many cases, the data can be copied using the Copy File (CPYF) command. In
some cases, however, you will need to create a program to copy the data. When
using the CPYF command, you need to determine whether the data can be copied
exactly, or if changes are required as it is copied.

Refer to Data Management for more information on the CPYF command.

Data Unchanged
If the data can be copied exactly, use the CPYF command:
CPYF tempfile filename FROMMBR(\ALL) TOMBR(\FROMMBR) MBROPT(\ADD) FMTOPT(\NOCHK)

The data can be copied exactly for the following types of changes:
Ÿ Renaming a definition
Ÿ Changing a definition’s text or long comment
Ÿ Changing a field’s column headings, editing characteristics, keyboard shift, or
alternative (alias) name
Ÿ Adding fields to the end of a record format
Ÿ Changing record ID codes for a record format
Ÿ Adding or sequencing record formats again within a file definition
Ÿ Deleting a record format from a file definition, if the record length of the file
remains the same
Ÿ Changing a character field to a zoned numeric field of the same size
Ÿ Changing a zoned numeric field to a character field of the same size
Ÿ Changing a character field to a DBCS field of the same size
Ÿ Changing a DBCS field to a character field of the same size
Ÿ Changing decimal positions for a zoned or packed numeric field
Ÿ Selecting key fields for a file definition

Chapter 14. Maintenance Requiring Commands or Programming 14-5


Data Converted
For externally described files, the CPYF command can perform some conversions
while copying the data.

Changes other than those listed here will require that you to create a high-level
language program to copy the data; for example, changing a character field to a
numeric field other than zoned numeric. You must use a programming language
that supports the types of data being converted.
CPYF tempfile filename FROMMBR(\ALL) TOMBR(\FROMMBR) MBROPT(\ADD) FMTOPT(\MAP \DROP)

The data can be converted by the CPYF command for the following types of
changes:
Ÿ Adding fields to a record format definition (the CPYF command inserts default
values for new fields)
Ÿ Deleting fields from a record format definition (the data for these fields is
deleted during the copy)
Ÿ Sequencing fields again in a record format definition
Ÿ Changing the size of a field (the data is either padded or truncated)
Ÿ Changing the numeric field from one numeric type to another (unless it is a
binary field with decimal positions greater than zero, which cannot be changed)

Differences between Program-Described and Externally Described


Files
Whether a file is externally described or program-described affects how certain
commands operate on the file and the dictionary associated with the file.

Restore or Create Duplicate Object


On a restore, copy, or Create Duplicate Object (CRTDUPOBJ) of a database file, if
the original file is linked, the system attempts to link the new file.

When the original file is linked to the dictionary in the library containing the file, and
the library containing the new file also contains a dictionary, the system attempts to
link the new file to the dictionary in the library containing the new file. For program-
described files there is no assurance that the definition matches the old definition,
and if the definition is not found, the file is not linked. If no dictionary exists in the
To library, the link is made to the original dictionary.

Change File
When a linked, externally described file is changed using the Change Physical File
(CHGPF) or Change Logical File (CHGLF) commands, the new definition of the file
is added to the data dictionary.

When a linked program-described file is changed, no change is made to the data


dictionary.

14-6 IDDU Use V4R1


Chapter 15. AS/400 Security and IDDU
This chapter explains the levels of authority needed to work with IDDU. It covers
dictionaries, libraries, and files, as well as the commands required to perform the
tasks.

Authority Requirements for IDDU Operations


Figure 15-1 shows the generic levels of authority required for operations with
IDDU. When the generic level includes specific rights, this is indicated by a foot-
note number after a generic level. These footnote numbers indicate the entry in the
“Authority/Rights Table” on page 15-2 that shows the relationship between the
generic authority level and the specific rights.

In all of the tables, the entry na indicates a not-applicable item.

Figure 15-1. Generic Levels of Authority with IDDU


Authority Required to: Dictionary Library File Library Command/Authority
Work with Dictionaries na na na na WRKDTADCT *USE
Create Dictionary na *CHG 1. na na CRTDTADCT *USE
Change Dictionary *ALL 1. *USE 1. na na
Delete Dictionary *ALL 3. *USE 1. na na DLTDTADCT *USE
Print Dictionary *USE *USE 1. na na DSPDTADCT *USE

Work with Definitions na na na na WRKDTADFN *USE


Select Dfn Type *USE *USE 1. na na
Create Definition *CHANGE *USE 1. na na
Change Definition *CHANGE *USE 1. na na
Copy Dfn from Dict *USE *USE 1. na na
Copy Dfn to Dict *CHANGE *USE 1. na na
Delete Definition *CHANGE *USE 1. na na
Print Definition *USE *USE 1. na na DSPDTADCT *USE
Rename Definition *CHANGE *USE 1. na na
Display Where Used *USE *USE 1. na na

Work with DB Files na na na na WRKDBFIDD *USE


Create File
Authority holder *USE *USE 1. *ALL *CHG 1. CRTPF *USE
No authority holder *USE *USE 1. na *CHG 1. CRTPF *USE
Enter Data (DFU) *USE *USE 1. *USE *USE 1. UPDDTA *USE
add change delete *USE 1. *CHANGE *USE 1.

Start IDDU via command na na na na STRIDD *USE

Add Definitions *CHANGE *USE 1. *ALL 2. *USE 1. ADDDTADFN *USE

Link File & Definition *USE *USE 1. *ALL 2. *USE 1. LNKDTADFN *USE

Unlink File na *USE 1. *ALL 2. *USE 1. LNKDTADFN *USE

The following tables show levels of authority required for operations done outside of
IDDU and how generic authority levels correspond to specific rights.

 Copyright IBM Corp. 1997 15-1


Authority Requirements for Non-IDDU Dictionary Operations
Figure 15-2 shows the generic levels of authority required for dictionary operations
done outside of IDDU. When the generic level includes specific rights, this is indi-
cated by a number after the generic level. In these cases, see Figure 15-3, for the
relationship between the generic authority level and the specific rights.

Figure 15-2. Generic Levels of Authority for Dictionary Operations


Authority Dictionary
Required to: Dictionary Library Files Other Command/Authority
Change Dict
Ownership See Security Guide *ALL 4. CHGOBJOWN *USE
Save Dictionary *ALL 4. *USE *ALL 4. na SAVLIB *USE
Restore Dictionary *ALL 4. *CHANGE 2. *ALL 4. na RSTLIB *USE

When you have special save system authority (*SAVSYS), the authorities listed for
saving and restoring a dictionary are not required.

Authority/Rights Table
Figure 15-3 shows how generic authority levels correspond to specific rights.

Figure 15-3. Generic Authority Levels and Specific Rights


Object Rights Data Authority
Object Authority Opr Mgt Exist Read Add Update Delete
*ALL X X X X X X X
*ALL 1. X X X X X X
*ALL 2. X X
*ALL 3. X X
*ALL 4. X

*CHANGE X X X X X
*CHANGE 1. X X
*CHANGE 2. X X X

*USE X X
*USE 1. X

*EXCLUDE

15-2 IDDU Use V4R1


Chapter 16. Dictionary Files
This appendix lists the files that are used by IDDU. These include the files that
make up each dictionary created by IDDU and the system-wide cross-reference
files created when OS/400 is installed.

As initially created, these files have *EXCLUDE authority assigned to them. The
authority level must be changed to the *USE level for any files that are to be
accessed.

These files can be read directly by a high-level language program or by a query.


Detailed information about the internal content and organization of the files is avail-
able by using the Display File Field Description (DSPFFD) command.

Data Dictionary Files


When a dictionary is created, these files are created in the library containing the
dictionary. They are used by IDDU to store the data definitions and other dictionary
information.

File ID File Purpose Description


QIDCTP02 Dictionary Comments Long comments for definitions
QIDCTP10 Field Attributes Field definitions
QIDCTP20 Record Format Attributes Record format definitions
QIDCTP21 Record Format’s Fields Fields in record format definitions
QIDCTP25 Record Format’s Record ID Tests Record format ID tests in record format defi-
nitions
QIDCTP30 File Attributes File definitions
QIDCTP31 File’s Record Format Record formats in file definitions
QIDCTP51 Key Fields Key fields in file descriptions
QIDCTP52 File’s SQL/400 Create Text SQL create text in file definitions
QIDCTP53 Logical File’s Physical Physical file of a logical file

Associated Logical Files


The following logical files provide alternative presentations of some of the data from
the dictionary definition files.

File ID File Purpose Description


QIDCTL76 Fields by Alias Fields by name assigned as alias
QIDCTL80 Fields in a Dictionary Fields by external field name
QIDCTL81 Formats in a Dictionary Formats by external format name
QIDCTL82 Files in a Dictionary Files external file name
QIDCTL86 Files Using a Format Files using a record format
QIDCTL84 Formats Using a Field Record formats using a field
QIDCTL88 Files Using a field Files using a field

 Copyright IBM Corp. 1997 16-1


Cross-Reference Files
These system-wide cross-reference files are created when the OS/400 program is
installed.

File ID File Purpose Description


QADBXREF Cross-reference file (physical) System database files and links to file definitions
QADBXOWN Associated logical file Alternative presentations of data
QADBXDIC Associated logical file Alternative presentations of data
QADBXFIL Associated logical file Alternative presentations of data

QADBFDEP Cross-reference dependency (physical) File-to-file dependency


QADBLDEP Associated logical file Alternative presentations of data
QADBLDNC Associated logical file Alternative presentations of data

16-2 IDDU Use V4R1


Appendixes
This part provides appendixes that support IDDU users interested in:
Ÿ Preparing for IDDU
Ÿ Working with a practice exercise
Ÿ Gaining an understanding of data and data descriptions on the AS/400 system
Ÿ Reviewing a brief presentation of the commands related to IDDU
Ÿ Determining the differences between System/36 and the AS/400 system

IDDU users will not use all of the information in these appendixes.

 Copyright IBM Corp. 1997


IDDU Use V4R1
Appendix A. Reviewing File Processing (Preparing for IDDU)
This appendix discusses the different ways manual file processing and computer-
based file processing is handled on an AS/400 system, as well as discussing file
design considerations.

Current Operations
Before setting up data files in your office, you should review your current file oper-
ations. The file processing operations that are discussed here are manual file and
computer-based file processing operations on an AS/400 system. The manner of
your current operation controls how you should now handle files in your area using
the AS/400 system.

Manual File Processing Operations


In some areas, the AS/400 system will be the first system to automate your file
processing operations. Currently, you might be making a new telephone list each
time someone moves or changes a number by manually retyping it.

Analyze your current manual operations by asking yourself and others the following
questions:
Ÿ About the input:
– What information do you want to keep in the system?
– What source documents (including handwritten notes and telephone
memos) do you now use? Where does the information originate?
– Is any data duplicated in these documents?
– Is any data supplied regularly?
Ÿ About the process:
– What operations do you need to do for each task?
– What decisions are necessary?
– What steps are repeated?
– What paths does the paperwork follow?
– How dependent is each process on the completion of the preceding
process?
Ÿ About the output:
– What lists, reports, and letters are now being made from the information in
the file; and what other types of output could you make from the informa-
tion in the file? For example, would you like to sort the information into an
alphabetic or numeric arrangement, or calculate mathematical results?
– How often are reports made?
– To whom are reports distributed?
– Do any reports or documents contain duplicate information?
– Is useful information missing from the reports?
– Can the data be resorted or recalculated quickly?

 Copyright IBM Corp. 1997 A-1


Computer File Processing Operations
Your office may now share an AS/400 system with another department, which has
set up file processing operations. You should analyze your file processing needs
and then ask yourself the following questions:
Ÿ Are the files available to all who need to use them?
Ÿ Is the information you need to do a task contained in one file?
Ÿ Is the data arranged in consistent formats that have meaning?
Ÿ How often do you change a file (per day, per week, or per month)?

Analyze File Information


It is valuable to conduct a survey of your area regarding the kinds of records and
lists you currently keep in your office, if you currently post information for data
entry, and if you already supply reports containing data. By analyzing this survey,
you should be better able to identify how your users will use data files in reports
and documents.

You should also check potential sources of files by talking to the people who work
in the area where files are kept. They might be able to supply additional informa-
tion about how the file is maintained and used.

As you identify existing files, define the various purposes of each file by completing
the following steps:
1. Collect and examine the different sample output documents made from a file.
When you need to make new reports or letters, sketch a sample to show what
information to include and in what sequence.
2. Identify the variable information on each sample document. When the sample
document is a list or report, you might find almost the entire output consists of
variable information.
3. Mark the fields of the sample document represented by variables.
4. Mark the variables that are a result of calculations using fields in the file; indi-
cate those that are inquiries of the data.
5. List the fields of information currently in the existing file, and for each field:
Ÿ A field name (a maximum of 10 characters) that is descriptive of the data.
Ÿ A field data type: character, numeric, DBCS (double-byte character set),
date, time, or timestamp.
Ÿ The maximum possible field length.
Ÿ The number of decimal positions in numeric fields.
Ÿ Any other relevant information about each field, such as:
– Are the names of states indicated by 2-character abbreviations?
– Are leading zeros shown; indicated; replaced?
– How are decimal points indicated?
– How are credits or negative values indicated?
– Does a currency symbol appear; where?
– How are dates and times shown?
Ÿ How each field is used, and any relationships it might have with other
fields.

A-2 IDDU Use V4R1


After you have assembled a list of uses and purposes for the potential fields of
each file, decide which of these fields should be a part of the file when it is in the
system.
Ÿ What fields from the information source are used in the proposed output?
These need to be fields in the file.
Ÿ Is there information in the proposed output that is not the result of calculations?
Each of these items should become fields in the file.
Ÿ When a field in the information source is not used in the proposed output,
where is the information in that field used now? Why is this information
included in the existing information source?
– Locate any output documents you do not have, such as infrequently made
letters or reports.
– Some information in a file, while not used directly as output, is needed to
calculate another variable. For example, an employee’s year of birth might
not be printed in a report, but it might be used to analyze age and eligibility
for retirement.
– The information might not be used at all. For example, information no
longer used continues to be followed and kept. However, check with
everyone who works with the file because that field might be used by
someone you are not aware of. When in doubt, include the information as
a field in the file on the system.

Field Design Considerations


Before you define and create the field on your system, some potential problems
can be avoided with good file design. Examine the following types of commonly
used information:
Ÿ Names
Ÿ Addresses
Ÿ Dates
Ÿ Fields containing both characters and numbers (such as part numbers)
Ÿ Fields combining more than one kind of information

Name Fields
As you design your file, you might consider a person’s full name (first name, middle
initial, last name, and title) to be one field of information. However, you should look
at how the name will be used in output.
Ÿ For example, when you list a field in a query report or in a document, the
system prints all the information in the field. Thus, if a person’s full name is in
one field, the full name will be printed every time that field is used.
When you are sending a person a letter, a salutation such as Dear Mr. William
A. Jones is awkward. Also, if you are using such a name field to alphabetically
sort a list of names, the field will be sorted by the M, not by the J in Jones.
Ÿ Remember to include a title field (Mr., Mrs., and so on) in any file in which you
have names. The system does not know what title belongs with a name.
Unless you have a title field in your file, one solution would be to use one title
in the shell document with all names; but that can result in a letter to a Mr.
Sally Brown. Another solution would be to include the title with the name, but

Appendix A. Reviewing File Processing (Preparing for IDDU) A-3


that means the salutation would address someone as Dear Miss Sally Brown,
never Dear Miss Brown or Dear Sally.
Ÿ Include a subtitle field for such attributes as Jr. or III. The subtitle in the last
name field, such as Brown, Jr. would print correctly on a mailing list as Mr.
George G. Brown, Jr., but in the salutation, would read as Dear Mr. Brown, Jr.

Therefore, for maximum versatility, a name field should be broken up into at least
five separate fields in the file stored on the system: title, first name, middle name
or initial, last name, and subtitle. This arrangement will give you maximum flexi-
bility for using the name in output.

Address Fields
As you design a file, you might put the entire address in one field. However, doing
this prevents you from selecting parts of the address or sorting them into a specific
order based on information in the address field. You might want to sort your file so
that names and addresses appear in order by zip codes. You can do this only if
the zip code is in a field by itself. If you want to select all the records for people
living in Texas, the state must appear in a separate field.

For maximum flexibility, you should use at least one field for the street or postal
address, one field for the city, one field for the state, and one field for the zip or
postal code. You might also consider creating a country field.

Date Fields
The following method of handling dates is an alternative to the AS/400 date
support; this method may be useful in special situations.

When dates are arranged as YYMMDD, the records sort by year, then by month,
then by day. This arrangement should suit most of your needs. However, you
might want to print lists such as a monthly birthday list. To do this with the fields
arranged by month, then by day without regard to the year, your field would be
MMDD or MMDDYY.

To gain the greatest flexibility, separate your data into three fields: year, month,
and day. You still type the year as YY, the month as MM, and the day as DD, but
each part of the date is in a different field. This allows you to sort or select the
fields in any arrangement of year, month, and day for an application using all three
fields, or by only month and day for the birthday list.

Using three fields for each date does require more fields, but it is more useful than
the YYMMDD design. Generally, if you are not sure about all the possible uses of
your file, use one field for dates using the months by name, and one field each for
the numeric representation of the year, month, and day. Furthermore, if you define
the three date fields as containing numeric data, you have the ability to perform
calculations based on these values.

Fields Containing Both Characters and Numbers


Occasionally, inventory numbers, property descriptions, or other items contain both
characters and numbers. You must know how this information will be used. If it is
to be used for printing or viewing only, it can be contained in one field. However,
when the information will be used for sorting or selecting records, you must
examine how the information needs to be sorted or selected. For example, in a
part number such as AD206, AD might refer to a machine type and 206 to the type

A-4 IDDU Use V4R1


of part. The same part for another machine might be ED206. When these are two
separate fields you can create a list by part number (all 206s regardless of the
machine type), or of all parts for machine type AD. Remember that even though
you might have two fields for the part number, it can be printed so that it appears to
be one item.

Combined Fields
If a file will contain a large number of fields, consider a combined field for informa-
tion that you want to track but not necessarily print. In a combined field, you can
use codes for information instead of spelling the information out to compress a
number of fields into one field.

For example, instead of designing one field for sex and one field for age, you might
define one field and use a code for sex (M for male, and F for female, for example)
and a number for age. An entry for a female, age 24, would be F24; a male, age
31, would be entered as M31.

Before you decide to use combined fields in your file, you must consider carefully
how the file is to be used. You can still select records using this method.
However, your flexibility in sorting is limited. In this example, if you sorted
according to the combined sex and age field, the records with females would
always appear before males because F sorts before M. It would not be easy to
sort the records into order based on age.

In addition, because you cannot easily print part of a field, to print a list of names
and ages you would normally have to print the entire field. Instead of printing Jane
Doe, 24, the system would print Jane Doe, F24.

Appendix A. Reviewing File Processing (Preparing for IDDU) A-5


A-6 IDDU Use V4R1
Appendix B. Practice Exercise
The following example shows you how to create the definitions for a name and
address file. The definitions are organized to be used with the work you can do in
the Data/Text Merge task in Getting Started with OfficeVision/400 and the data file
utility task in ADTS/400: Data File Utility.

Assign a file definition name of NAMEADDR and accept the system-assigned


record format definition name of NAMEADDRR. The following table provides the
rest of the values for you to enter into the various input fields on the IDDU displays:

Field Name Field Type Size Text


LASTNAME Character 15 Last name
FIRSTNAME Character 10 First name
ADDRESS1 Character 20 Address line 1
ADDRESS2 Character 20 Address line 2
CITY Character 15 City
STATE Character 2 State
ZIP Character 9 Zip code
AMOUNT Numeric, 2 decimal positions 6 Amount

1. Go to the IDDU menu by choosing the IDDU option from either the Files menu
or the Decision Support menu; or you can type the Start IDDU (STRIDD)
command on any command line.
2. Create a data dictionary, unless one exists in a library you can use. If a data
dictionary exists that you can use, go to step 7.
3. Choose the Work with Data Dictionary option on the IDDU menu.
4. Choose option 1 (Create) on the new display, type the name of the library that
will contain the dictionary, and press the Enter key.
Note: If you attempt to create a data dictionary and the named library does
not exist, you will see the Create a Library display. From this display
you can create the library that will contain the data dictionary. When
you have finished creating a library, you will continue to the Create a
Data Dictionary display.
5. On the Create a Data Dictionary display, the name of the library will appear as
the name of the dictionary. Later in this exercise, we will use a dictionary name
of SYSDIC; you can replace SYSDIC with the name of another dictionary.
6. You can accept the system-supplied values and press the Enter key. You also
can type a brief description in the Text field and choose to enter a long
comment. If you choose option 1 (Select) for the Long comment prompt, you
will be shown the Edit Long Comment display, where you can type detailed
information about the dictionary. The dictionary will be created when you end
your work on that display.
The AS/400 system can take some time to create the dictionary; it will advise
you with a message when the dictionary has been created. After you create
the dictionary, press F12 (Previous) on the Work with Data Dictionary display to
return to the IDDU menu.
7. Choose the Work with data definitions option on the IDDU menu and press the
Enter key.

 Copyright IBM Corp. 1997 B-1


à Interactive Data Definition Utility (IDDU)
ð
Select one of the following:

1. Work with data definitions

8. You will name the file definition first, so select option 3 (File).
We have used SYSDIC as an example of a dictionary name; you can replace
that name if another is appropriate.

à Select Definition Type


ð
Type choices, press Enter.

Definition type . . . . . . . 3 1=Field


2=Record format
3=File

Data dictionary . . . . . . . SYSDIC Name, F4 for list

Then press the Enter key.


9. When you see the Work with File Definitions display, choose option 1 (Create),
and name the new file definition.
We have used NAMEADDR as an example of a file definition name.

à Work with File Definitions


ð
Dictionary . . . . . : SYSDIC

Position to . . . . . . __________ Starting characters

Type options (and File Definition), press Enter.


1=Create 2=Change 3=Copy 4=Delete
6=Print 7=Rename 8=Display where used

File File File File


Opt Definition Opt Definition Opt Definition Opt Definition
1 NAMEADDR

Then press the Enter key.


10. When you see the Create a File Definition display, select option 2 (Create
single format) and accept the system-supplied name (the system uses the file
definition name, but with R as the last letter). You can type brief descriptive
information for the Text prompt, as we have. The Long comment prompt can
be left as it appears, or you can type 1 (Select) to enter a detailed description
of the definition on the Edit Long Comment display.

B-2 IDDU Use V4R1


à Create File Definition
ð
Definition . . . . . : NAMEADDR Dictionary . . . . . : SYSDIC

Type choices, press Enter.

Record formats
option . . . . . . . 2 1=Create and/or select formats
2=Create default format
and select fields

For choice 2=Create default format:


Format . . . . . . NAMEADDR Name

Select key field


sequence . . . . . . N Y=Yes, N=No

Long comment . . . . . _ 1=Select, 4=Remove

Text . . . . . . . . . Practice definition for DFU and QUERY

F3=Exit F12=Cancel

á ñ
Then press the Enter key.
11. You are now ready to begin creating the field definitions that will be used by
the record format definition you just named. Name the first field definition you
will create for the record format definition on the Create and Select Field Defi-
nitions display. Use the system-supplied sequence number on the display.

à Create and Select Field Definitions


ð
Definition. . . . . . : NAMEADDRR Dictionary. . . . . . : SYSDIC

Position to . . . . . . __________ Field, sequence (ð-99999)

Type sequence numbers (ð-99999), (and field), press Enter.


Type field, press F6 to create.

Seq Field End Seq Field End Seq Field End


1ð LASTNAME 15

Then press F6 (Create field definition). You will complete the description of this
first field definition, as well as name and describe the remaining field defi-
nitions, using the next display.
12. Complete the first description with its type, size, and any other characteristics,
and then name and describe the remaining field definitions.

Appendix B. Practice Exercise B-3


à Create Field Definitions
ð
Type information, press Enter to create.
Field type (size) . . : 1=Character (1-32766)
2=Numeric (1-31, decimal positions ð-31)
3=DBCS (4-32766, mixed; 1-16383, graphic)
4=Date/Time (no size)
More options. . . . . : Y=Yes

-------Field--------- Dec More


Name Type Size Pos Opts Text

LASTNAME 1 15 __ __ Last name


FIRSTNAME 1 1ð __ __ First name
ADDRESS1 1 2ð __ __ Address line 1
ADDRESS2 1 2ð __ __ Address line 2
CITY 1 15 __ __ City
STATE 1 2 __ __ State
ZIP 1 9 __ __ Zip code
AMOUNT 2 6 2 __ Amount

For numeric fields, you have to specify the number of decimal positions.
13. When you have completed specifying the field characteristics, press the Enter
key; the fields are created. The Create Field Definitions display is shown
again, which allows you to specify more fields. If you do not want to specify
more fields, press the Enter key without making any changes to the display.

à Create Field Definitions


ð
Type information, press Enter to create.
Field type (size) . . : 1=Character (1-32766)
2=Numeric (1-31, decimal positions ð-31)
3=DBCS (4-32766, mixed; 1-16383, graphic)
4=Date/Time (no size)
More options. . . . . : Y=Yes

-------Field--------- Dec More


Name Type Size Pos Opt Text

__________ _ _____ __ _ _____________________________________________


__________ _ _____ __ _ _____________________________________________
__________ _ _____ __ _ _____________________________________________

14. When you see the Create and Select Field Definitions display, verify that the
field names are arranged in the proper sequence.

à Create and Select Field Definitions


ð
Definition............: NAMEADDRR Dictionary............: SYSDIC

Position to . . . . . . __________ Field, Sequence (ð-99999)

Type sequence numbers (ð-99999), (and field), press Enter.


Press F6 to create.

Seq Field End Seq Field End Seq Field End


1ð LASTNAME 15
1ð FIRSTNAME 25
1ð ADDRESS1 45
1ð ADDRESS2 65
1ð CITY 8ð
1ð STATE 82
1ð ZIP 91
1ð AMOUNT 95

B-4 IDDU Use V4R1


(When sequence numbers are the same, the arrangement of the field names
on the display determines the sequence of use in the record.) If a field is out
of sequence, type the necessary sequence numbers to indicate the correct
arrangement, and press the Enter key. When the fields are in the proper
sequence, press the Enter key without making any changes to the display.
15. You will then see the Work with File Definitions display, where you press F3
(Exit) without making any changes to the display.

à Work with File Definitions


ð
Dictionary . . . . . : SYSDIC

Position to . . . . . . __________ Starting characters

Type options (and File Definition), press Enter.


1=Create 2=Change 3=Copy 4=Delete
6=Print 7=Rename 8=Display where used

File File File File


Opt Definition Opt Definition Opt Definition Opt Definition
_ NAMEADDR
_ XXXXXXXXXX _ XXXXXXXXXX _ XXXXXXXXXX _ XXXXXXXXXX
_ XXXXXXXXXX _ XXXXXXXXXX _ XXXXXXXXXX _ XXXXXXXXXX
_ XXXXXXXXXX _ XXXXXXXXXX _ XXXXXXXXXX _ XXXXXXXXXX
_ XXXXXXXXXX _ XXXXXXXXXX _ XXXXXXXXXX _ XXXXXXXXXX
_ XXXXXXXXXX _ XXXXXXXXXX _ XXXXXXXXXX _ XXXXXXXXXX
_ XXXXXXXXXX _ XXXXXXXXXX _ XXXXXXXXXX _ XXXXXXXXXX
_ XXXXXXXXXX _ XXXXXXXXXX _ XXXXXXXXXX _ XXXXXXXXXX

More ...
F3=Exit F5=Refresh F1ð=Work with database files
F11=Display text F12=Cancel F22=Work with data dictionaries
á ñ
You are finished creating the definitions describing a database file. The
instructions to create the file and to enter data into the file are in Chapter 8,
“Working with Database Files.”

Appendix B. Practice Exercise B-5


B-6 IDDU Use V4R1
Appendix C. Data Descriptions on the AS/400 System
This chapter discusses the ways that database files are described on the AS/400
system.

Describing Data on the AS/400 System


Two methods of describing data on the AS/400 system are the data description
specifications (DDS) and the interactive data definition utility (IDDU). Data
descriptions are created using DDS, and data definitions are created using IDDU.
These methods are summarized in the following paragraphs.

Data Descriptions
You can use DDS to describe how the data is organized. The system saves these
descriptions with the file when it is created (using, for example, the Create Physical
File (CRTPF) command).

DDS CRTPF Data Descriptions

Data

RSLL479-0

DDS allows you to define database files on the AS/400 system. You might have to
use this method to use all of the AS/400 database features. For more information
see DB2 for AS/400 Database Programming.

The descriptions of some DDS-created files can be added to a dictionary. For


information on this, see “Creating Definitions from Files” on page 14-1.

Data Definitions
You can create field, record format, and file definitions with IDDU. The system
stores them in a data dictionary. These data definitions are associated with the file
when the file is created using IDDU.

 Copyright IBM Corp. 1997 C-1


Data Dictionary

Field Definitions
(field characteristics)

Record Format Definitions


(names of field definitions)
IDDU WRKDTADFN WRKDBFIDD
File Definitions
(names of format definitions)

Data File

Data Descriptions
(created using the
data definitions
from the data
dictionary)

Data

RSLL477-0

Dictionary Descriptions
Dictionary descriptions have the definitions of the file, its format, and the fields used
by the format described once in a data dictionary and have these definitions used
by many programs for many purposes. It is necessary to describe all the fields
only once, and then organize those fields in different ways, using different record
formats, for differing file uses.

The definitions in a data dictionary will create either program-described or externally


described files. See “Program-Described Files” and “Externally Described Files” for
a discussion of these methods of database file description. When a file is created
using IDDU and only a single record format definition exists in the file definition, an
externally described file is created and a copy of the dictionary file definition is
stored with the file. A program-described file is created with no copy of the file
definition in the file under the following conditions:
Ÿ When more than one record format definition exists for a file description
Ÿ When a record format contains record ID codes
Ÿ When a file name has an authority level assigned (authority holder)

In all cases, the file and the dictionary definitions are linked during creation. The
following figure illustrates this relationship.

C-2 IDDU Use V4R1


Data Dictionary

Field Definitions
(field characteristics)

Record Format Definitions


(names of field definitions)
Link Link
File Definitions
(names of format definitions)

When more than one format When one format definition


definition is defined in is defined in the file
the file definition, a definition, an externally
program-described file described file is created.
is created.

Data File Data File

Data Data Description


(created using the
data definitions
from the data
dictionary)

Data

RSLL476-1

Database Files on the AS/400 System


A database is a collection of data files in the system. They are described together
in one place using a common method of description that allows them to be used by
more than one program. Individual data files thus described are sometimes also
called database files.

The AS/400 database manager supports both program-described database files


and externally described database files. IDDU can be used to create either
program-described files or externally described files. DDS can also be used to
create externally described files.

Files and Members


Every file on the AS/400 system that contains any data has at least one member,
but a file can contain several members, all having the same record format. For
example, a file might have a separate member for each month in the year. Each
member in a file has the same file, record format, and field definitions.

All files created by IDDU will have one member that has the same name as the file.
If you do not use CL commands to add additional members to the file, then you can
use that file name when you enter data into the file or query the file.

Appendix C. Data Descriptions on the AS/400 System C-3


When you use the Add Data Definition (ADDDTADFN) command to create the defi-
nitions, those definitions are associated with the file and not with individual
members in the file. This means that when you link a definition to a file, all
members of the file will have the same definition.

Program-Described Files
Program-described files are database files that do not have the data descriptions
stored with the file. This means that some programs, such as Query/400, cannot
use these files without a method of determining the format of the file. (IDDU is
such a method.) Application programs written in a “high-level” programming lan-
guage, such as RPG or COBOL, use program statements to describe the files and
data they use. These files are called program-described files. The database file
and its data descriptions are known to the program in which the descriptions are
contained; they cannot be used by any other program on the system. Each
program that refers to a database file must contain its own set of data descriptions.

Considerations limiting the usefulness of program-described files include:


Ÿ Query can not use a program described file as it fits this description. Query
and similar programs can only work with a database file that has data
descriptions either within the file (externally described), or if they are linked to a
file definition in a data dictionary.
Ÿ High-level languages (such as RPG III) supporting externally described files can
not easily support program-described files.
Ÿ Descriptions of program-described files are not saved when the files are saved.

Externally Described Files


Externally described files have their data descriptions stored with the file. This
means that some applications, such as control language (CL) programs or queries,
only name the file they want to use; the system finds the related data descriptions.
These are called externally described files because they are described outside of
the application program. In contrast to program-described files, externally
described files can be used by any application (query, document, CL program) that
accepts data described in that manner. The files described earlier in this appendix
as created from both DDS and IDDU descriptions are externally described.

Refer to the applicable programming language book for information on using


externally described files with that language.

C-4 IDDU Use V4R1


Appendix D. IDDU Commands
This appendix describes the IDDU commands and lists their parameters. Press F4
(Prompt) when you enter these commands to be prompted to enter values for the
parameters. Refer to the CL Reference for detailed information about all AS/400
commands.
Ÿ ADDDTADFN (Add a Data Definition)
Adds definitions for files, record formats, and fields from an externally described
database file to a data dictionary. You are prompted to enter values for these
items:
file name, library name, dictionary name, definition name
The definition name is optional; the file name is used if no other is specified.
The ADDDTADFN command also creates a link between the file and the defi-
nition. If you use the command again with the same file, the first link is
dropped and the file is linked to the new definition.
Note: Matching definitions already in the data dictionary will be used again. If
existing definitions have matching names but the attributes (including
text and long comment) are not identical, a new version of the defi-
nitions will be created and inserted into the data dictionary.
Ÿ CRTDTADCT (Create a Data Dictionary)
Creates a data dictionary. You are prompted to enter values for these items:
dictionary name, authority, text
The dictionary name is required; the other parameters are optional. A library
with the same name as the dictionary must already exist.
Ÿ DLTDTADCT (Delete a Data Dictionary)
Deletes a data dictionary. You are prompted to enter the dictionary name.
Ÿ DSPDTADCT (Display Data Dictionary)
Prints contents of a field, record format, or file definition. You are prompted to
enter values for these items:
dictionary name, definition name, creation date,
definition type, output, level of file information,
level of record format information, level of field information
The dictionary name is required; the other parameters are optional.
Ÿ LNKDTADFN (Link Data Definition)
Links or unlinks file definitions and program-described database files. You are
prompted to enter values for these items:
option, file name, dictionary name, file definition
The option (LINK or UNLINK) and file name parameters are required. Dic-
tionary name and file definition name are required when linking, optional when
unlinking.
Ÿ RSTLIB (Restore Library)

 Copyright IBM Corp. 1997 D-1


Restores to the system all user libraries that were saved by the Save Library
(SAVLIB) command. Required parameters are determined by the task. You
are prompted to enter values for these items:
saved library, device, volume ID, sequence number, label,
end operation, starting library, save file name, option,
member option, save date, save time, allow object differences,
restore library, restore auxiliary storage pool, output
Ÿ SAVLIB (Save Library)
Saves a copy of up to 50 specified libraries. Required parameters are deter-
mined by the task. You are prompted to enter values for these items:
library, device, volume ID, sequence number, label,
expiration date, end operation, starting library,
save file name, update history, target release, clear,
precheck, access paths, save file/data, storage,
data compression, compaction, omit libraries
Ÿ STRIDD (Start Interactive Data Definition)
Shows the IDDU menu display, where you can select to work with data diction-
aries, definitions, or files; and use IDDU commands or office procedures. You
do not have to specify any values for this command.
Ÿ WRKDBFIDD (Work with Database Files using IDDU)
Shows the Work with Database Files display, where you can select either to
create physical files or to enter and update file data. You are prompted to
enter a value for library. This parameter is optional.
Ÿ WRKDTADCT (Work with Data Dictionaries)
Shows the Work with Data Dictionaries display, where you can choose to
create, change, delete, and print the contents of a data dictionary. You do not
have to specify any values for this command.
Ÿ WRKDTADFN (Work with Data Definitions)
Shows the Select Definition Type display, where you can select the definition
type to create, change, copy, delete, print, rename, or display where-used infor-
mation. You are prompted to enter values for these items:
data dictionary, definition type
These parameters are optional.

D-2 IDDU Use V4R1


Appendix E. Differences between IDDU on the AS/400
System and System/36
This appendix describes the differences between IDDU on the AS/400 system and
System/36. The IDDU differences described in this appendix are limited to those
that could cause you some inconvenience if you do not know about them before
working with IDDU. This appendix defines these differences as:
Ÿ Conceptual
Ÿ Operational
Ÿ Command

Conceptual Differences
The following list identifies the concept that is different on the AS/400 system along
with an explanation of the differences as it applies to the listed concept:
Concept Differences
Folders On System/36, a data dictionary was stored in a folder. On
the AS/400 system, a data dictionary is stored in a library.
You can only have one data dictionary specified per library.
Both the data dictionary and the library have the same name.
#USRDCT The data dictionary name #USRDCT was automatically
created and used as a default dictionary on System/36. If
you require a dictionary named #USRDCT on the AS/400
system, you must create it on your AS/400 system.
Communications files
Definitions for communication files are not stored in data dic-
tionaries on the AS/400 system as they were on System/36.
You must use DDS to define intersystem communications
function (ICF) files on the AS/400 system.
Filler fields On System/36, filler fields did not have to be named. On the
AS/400 system, filler fields must be named; they show up
when you define your queries.
Linking files On the AS/400 system, date-differentiated files are stored as
members in the same file. Therefore, all date-differentiated
files must be linked to the same definition.

Operational Differences
The following list identifies the operation that is different on the AS/400 system
along with an explanation of the differences as it applies to the listed operation:
Operation Differences
Changing definitions On the AS/400 system, you cannot change a long comment,
text, and editing comments when the file is linked, as you
could on System/36.
ANK/IGC Either On System/36, you could use either ANK Either or IGC
Either. On the AS/400 system, you can only use ANK Either.

 Copyright IBM Corp. 1997 E-1


Default data type On the AS/400 system, the default numeric data type is
packed. On System/36, the default numeric data type is
zoned.
Link, unlink On the AS/400 system, the link and unlink operations are
only available with the Link Data Definition (LNKDTADFN)
command, Add Data Definition (ADDDTADFN) command, or
the IDDULINK procedure. On System/36, these operations
are also available on an interactive display.

Command Differences
The following table lists the System/36 data dictionary commands and the equiv-
alent AS/400 commands (if appropriate) plus some system commands that work
with data dictionaries:
System/36 AS/400 System
IDDU STRIDD
IDDUDCT WRKDTADCT
IDDUDFN WRKDTADFN
IDDUDISK WRKDBFIDD
IDDULINK LNKDTADFN
IDDUPRT DSPDTADCT
IDDURBLD Not required
IDDUXLAT1 Not supported
DELETE1 DLTDTADCT
SAVEFLDR1 SAVLIB
RESTFLDR1 RSTLIB (or RSTS36FLR2)
RENAME1 RSTLIB to different library
No equivalent ADDDTADFN (new)
No equivalent CRTDTADCT (new)

1 These IDDU commands do not work within the AS/400 System/36 environment.
2 Restores a dictionary saved on a System/36 using the SAVEFLDR command.

E-2 IDDU Use V4R1


Bibliography
You might need to review some or all of the following Ÿ System Operation for New Users, SC41-3200,
manuals before or while you are using this manual. describes using display stations on the AS/400
Except where otherwise indicated, each is an AS/400 system.
system manual.
Ÿ CL Reference, SC41-5722, describes the AS/400
control language commands. National Language
The manuals below are listed with their full title and
Support, SC41-5101
base order number.
Ÿ Query/400 Use, SC41-5210, describes the
Ÿ Backup and Recovery, SC41-5304, describes the
Query/400 utility.
basic backup and recovery features of the AS/400
system. Ÿ Security – Basic, SC41-5301, describes the basic
security features of the AS/400 system.
Ÿ Backup and Recovery, SC41-5304, describes the
advanced backup and recovery features of the Ÿ Security – Reference, SC41-5302, describes the
AS/400 system. integrated security features of the AS/400 system.
Ÿ DDS Reference, SC41-5712, describes the data Ÿ SH21-0732, provides a method for learning to use
description specifications (DDS). the word processing functions of the AS/400
system.
Ÿ Data Management, SC41-5710, describes the data
management tools of the AS/400 system, including Ÿ SH21-0699, describes installing and setting up your
the Copy File (CPYF) command. AS/400 system.
Ÿ DB2 for AS/400 Database Programming, Ÿ SH21-0701, describes the AS/400 word processing
SC41-5701, describes how to set up and use a capabilities.
database system on the AS/400 system.
Ÿ DB2 for AS/400 SQL Programming, SC41-5611,
Ÿ National Language Support, SC41-5101, prepares describes programming and using the AS/400
the AS/400 user for planning and using the national Structured Query Language (SQL).
language support (NLS) and the multilingual support
Ÿ DB2 for AS/400 SQL Reference, SC41-5612,
of the AS/400 system. It also provides an explana-
describes AS/400 Structured Query Language
tion of the database management of multilingual
(SQL) statements.
data and application considerations for a multilin-
gual system.

 Copyright IBM Corp. 1997 H-1


H-2 IDDU Use V4R1
Index
character (continued)
A keyboard shift 9-4
accessing character field
controlling 4-2 additional characteristics 7-9
data dictionary data type 7-9
changing 13-1 Character Field Options display 3-5
dictionary rights 4-2 column heading 7-6
add data definition command 14-1 command
ADDDTADFN (Add Data Definition command) D-1 ADDDTADFN (IDDU) D-1
alias 7-7, 9-4 CRTDTADCT (IDDU) D-1
allocated length 7-10 DLTDTADCT (IDDU) D-1
alphabetic only character shift 9-4 DSPDTADCT (IDDU) D-1
alphanumeric character shift 9-4 LNKDTADFN (IDDU) D-1
alternative name 7-7, 9-4 RSTLIB D-1
analyzing file information A-2 SAVLIB D-2
AS/400 IDDU STRIDD (IDDU) D-2
See IDDU WRKDBFIDD (IDDU) D-2
authority WRKDTADCT (IDDU) D-2
assigning access 4-2 WRKDTADFN (IDDU) D-2
changing access, dictionaries 13-1 comment
Create Data Dictionary prompt 4-2 long
data dictionary 4-2 dictionary 4-3
generic levels 15-1 field definition 7-7
requirements file definition 5-4
for IDDU operations 15-1 record format definition 6-4
non-IDDU dictionary operations 15-2 computer file processing A-2
rights concept
dictionary 4-2 field 1-2
table 15-2 file 1-1, 1-2
file processing 1-3
maintaining data 1-5
B querying data 1-4
binary data 7-8
record 1-2
bracketed-DBCS data
Confirm Copy display 12-5
See double-byte character set (DBCS)
Confirm Delete of ... Definition display
(example) 12-6
C Confirm Delete of Data Dictionary display 13-2
confirming definition
changing
data dictionaries 13-1 copy 12-5
definitions 12-1 delete 12-6
dictionary authority 13-1 consideration
dictionary descriptions 13-1 adding file definitions 14-2
field definition 12-3 address fields A-4
file definitions 12-2 assigning authority to dictionary 4-2
file key attributes 11-2 character and number fields A-4
key field sequence attributes 11-3 combined fields A-5
linked definitions 14-2 describing dictionary 4-2
linked dictionary definitions 14-3 field design A-3
record format definition 12-2 field names A-3
character limited usefulness of program-described files C-4
data type 7-9 linking files 14-1
field A-4 multiple record formats 5-3

 Copyright IBM Corp. 1997 X-1


consideration (continued) data definition (continued)
record format 10-1 delete confirm 12-6
securing dictionary 4-2 description 2-2
sequence of fields in a record 6-3 link and unlink files 14-1
SQL and IDDU 13-4 maintaining 12-1
content printing 12-6
dictionary files 16-1 renaming 12-10
controlling where used 12-10
dictionary access 4-2 work with 12-1
Copy ... Definition display (example) 12-4 data description C-1
copy confirm data dictionary
field definition 12-5 advantages 2-2
file definition 12-5 authority 4-2
record format definition 12-5 changing 13-1
copying contents
data definition 12-4 viewing 13-3
data dictionaries 13-4 copy 13-4
Create a Database File display 8-1 creating 4-1
Create and Select Field Definitions display deleting 13-2
creating field definitions 6-6 describing 4-3
practice exercise B-3 duplicating 13-4
selecting field definitions 5-7 library for 4-1
Create and Select Record Formats display 5-8 maintaining 13-1
Create Data Dictionary display 4-2 printing/displaying contents 13-2
Create Field Definitions display recovering 13-3
create field definitions 7-12 renaming 13-4
practice exercise B-3 restoring 13-3
Create File Definition display saving 13-3
create file definition 5-5 securing 4-2
practice exercise B-2 tasks 4-3
Create Record Format Definition display 6-5 viewing
creating contents 13-3
data definitions 14-1 data type
data dictionary 4-1 character (SBCS) 7-9
database file 8-1 hexadecimal 7-9
field definition 7-12 database files
file definition 5-5 creating 8-1
record format definition 5-7, 6-4 definitions
cross-reference files creating 14-1
dictionary 16-2 supported by IDDU 14-1
file-to-file 16-2 securing 8-2
files 16-2 date format 7-10
CRTDTADCT (Create Data Dictionary date separator 7-11
command) D-1 date/time fields
current file operations A-1 data type 9-8
editing 7-10
date/time/timestamp 7-10
D DBCS
data See double-byte character set (DBCS)
describing C-1 DBCS Field Options display 9-7
queries and documents 2-7 DDS file definition
data definition data description C-1
adding 14-1 specifications C-1
copy confirm 12-5 defining
copying 12-4 sequence of fields 6-3
creating
data 14-1

X-2 IDDU Use V4R1


definition description (continued)
changing long comment 5-4, 6-4, 7-7
file, when linked 14-3 text, dictionary 4-3
record format 12-2 dictionary
created by authority 4-2
IDDU 13-5 changing 13-1
SQL 13-5 considerations
SQL compared to IDDU 13-5 assigning authority 4-2
creating 14-1 securing 4-2
field 7-12 contents
file 5-5 viewing 13-3
record format 5-7, 6-4 controlling access 4-2
data copying 13-4
adding 14-1 creating 4-1
copy confirm 12-5 authority 4-2
copying 12-4 cross-reference files 16-2
database file 14-1 definition
DDS C-1 changing when linked 14-3
deleting 12-6 deleting 13-2
field describing 4-3
changing 12-3 descriptions C-2
creating 7-12 displaying
planning 7-1 contents 13-3
work with 7-14 file contents 16-1
file change 12-2 maintaining 13-1
files name 4-1
linking and unlinking 14-1 printing
linked 14-2 contents 13-2
maintaining 12-1 recovering 13-3
missing database file 14-2 renaming 13-4
name restoring 13-3
field 7-5 rights 4-2
file 5-3 saving 13-3
position to 5-8 sharing SQL and IDDU 13-4
record format 5-3 viewing
printing 12-6 contents 13-3
record format dictionary operation 15-2
changing 12-2 digits only
work with 6-7 character shift 9-4
renaming 12-10 numeric shift 9-6
where used 12-10, 12-11 directory
work with 12-1 dictionary files 16-1
deleting display
data definition 12-6 Character Field Options 3-5
data dictionaries 13-2 Confirm Copy 12-5
SQL definition 13-5 Confirm Delete of ... Definition (example) 12-6
Describe Numeric Field Editing display 7-13 Confirm Delete of Data Dictionary 13-2
describing data C-1 Copy ... Definition (example) 12-4
description Create a Data Dictionary 4-1
data C-2 Create a Database File 8-1
database files C-3 Create and Select Field Definitions B-4
dictionary C-2 Create and Select Record Formats 5-8
dictionary files 16-1 Create Field Definitions 7-12, B-3, B-4
files Create File Definition 5-5, B-2
externally described C-4 Create Record Format Definition 6-5
program linked C-4 Creating Field Definitions 6-6
program-described C-4

Index X-3
display (continued)
Describe Numeric Field Editing 7-13 F
Editing a Long Comment 4-3 field
End ... Definition (example) 12-1 additional characteristics
Field Options 7-13 numeric fields 7-8
IDDU Main (system) Menu B-1 allocated length 7-10
list example 2-5 basic characteristics 7-5
Print Options 12-6, 13-2 column headings 7-6
Select Definition Type 2-5, 5-5, 6-4, 7-12, B-2 concepts 1-2
Selecting Field Definitions 5-7 data type 7-5
Specify Edit Code 9-1 defining key 11-1
Specify Edit Word 9-3 design considerations A-3
Work with ... Definitions (example) 12-1 editing
Work with Data Dictionaries 4-1, 13-1 date/time 7-10
Work with Database Files 8-1 in a record
Work with Field Definitions 7-12 considerations 6-3
Work with File Definitions 3-2, 3-3, 3-4, 5-5, B-2, key 11-1
B-5 name A-3
Work with Record Format Definitions 6-4 null attribute 7-7
displaying size 7-5
data definitions 12-6 field definition
data dictionary contents 12-6 changing 12-3
DLTDTADCT (Delete Data Dictionary character 7-9
command) D-1 column headings 7-6
document copy confirm 12-5
merging data A-1 copying 12-4
double-byte character set (DBCS) creating 7-12
additional characteristics 7-9 DBCS 7-9
data types 7-9 delete confirm 12-6
defining 7-5 deleting 12-6
DSPDTADCT (Display Data Dictionary description 2-3
command) D-1 design considerations
duplicating address fields A-4
data dictionaries 13-4 character and number fields A-4
combined fields A-5
name fields A-3
E field type 7-5
edit code (EDTCDE) grouping 2-4
description 9-1 long comment, text 7-7
parameters 9-1 name 7-5
table 9-2 null attribute 7-7
edit word 9-3 planning 7-1
editing renaming 12-10
fields 9-1 size 7-5
numeric fields 7-8, 9-3 where used 12-11
techniques 9-1 work sheet 7-4
Editing a Long Comment display 4-3 work with 7-14
EDTCDE (edit code) field described files
description 9-1 externally described C-4
parameters 9-1 Field Options display 7-13
table 9-2 file
End ... Definition display example 12-1 concepts 1-1, 1-2
exercise creating the database 8-1
practice example B-1 cross-reference 16-2
externally described files C-4 database C-3
dictionary
cross-reference 16-2

X-4 IDDU Use V4R1


file (continued) function key 3-2
dictionary (continued)
description 16-1
externally described (program linked) C-4 G
field described (program linked) C-4 generic authority level 15-1
file-to-file cross-reference 16-2 getting started 3-1
keyed 11-1 graphic field
limited usefulness of program-described C-4 DBCS field options 9-7
linking, unlinking definitions 14-1 defining 7-5
members C-3 guideline for name field A-3
not dictionary described C-1
program linked (externally described) C-4
program-described 14-2
H
hexadecimal data 7-9
work with database file 8-1
hexadecimal data type 9-4
file definition
change 12-2
copy 12-5
copy confirm 12-5
I
IDDU
copying 12-4 capabilities 2-7
create a record format 5-7 compared to SQL 13-5
creating 5-5, 14-1 definitions used by SQL 13-5
DDS C-1 differences (from System/36) E-1
delete confirm 12-6 features 2-5
deleting 12-6 main (system) menu 3-1, B-1
description 2-3 options
keyed file 11-1 IDDU menu 3-1
long comment, text 5-4 main (system) menu 3-1, B-1
missing database 14-2 SQL 13-4—13-5
name 5-3 support database file definitions 14-1
renaming 12-10 terminology used by SQL 13-4
select new record formats 5-8 unsupported SQL files 13-5
using key fields IDDU operation
changing 11-1 authority requirements 15-1
creating 11-1 interrupted session
where used 12-10, 12-11 recovering 12-11
working with 3-2, 3-3, 5-5, 5-9 resuming 12-11
File Definitions display 3-3, 3-4
file key attribute
changing 11-2 K
duplicate key values 11-2 key
key order 11-2 function 3-2
file operations key field definition 5-4
current A-1 key field sequence
file processing changing 11-1
analyzing file information A-2 changing attributes
computer A-2 order 11-3
concepts 1-3 value 11-3
creating a file definition 5-5 selecting 11-1
field design considerations A-3 keyboard shift
manual A-1 character 9-4
record ID codes 10-1 DBCS 9-7
file-to-file cross-reference 16-2 numeric 9-6
floating point data 7-6, 7-8
format
create record format for a file definition 5-7
select for a file definition 5-8

Index X-5
numeric
L character shift 9-4, 9-6
level of authority keyboard shift 9-6
data dictionary 4-2 numeric shift 9-6
generic 15-2 numeric field
library for data dictionary 4-1 additional characteristics 7-8
link data definition and file 14-1 data type 7-8
linked definition decimal positions 7-6
changing 14-2 edit word 9-3
linked files editing 7-8
externally described C-4
list
using 3-3 O
list display office security, resource 4-2
example 2-5 operation
listing authority requirements
data definitions 12-6 IDDU 15-1
data dictionary contents 12-6 non-IDDU dictionary 15-2
LNKDTADFN (Link Data Definition) command D-1 current file A-1
long comment manual file processing A-1
dictionary 4-3 option
field definition 7-7 choosing 3-2
file definition 5-4 multiple 3-4
record format definition 6-4 IDDU menu 3-1
Main IDDU (system) Menu 3-1, B-1

M
maintaining P
data concepts 1-5 packed data 7-8
data dictionaries 13-1 position to sequence number 5-8
definitions 12-1 practice exercise B-1
manual file processing A-1 print options display 12-6, 13-2
members and file C-3 printing
menu data definitions 12-6
IDDU options 3-1 data dictionary contents 12-6, 13-2
main menu options 3-1, B-1 processing files
missing database file definition 14-2 computer A-2
multiple record format 5-3 design considerations A-3
manually A-1
reports, documents A-1
N processing operation A-1
name program linked files (externally described) C-4
alias 7-7, 9-4 program-described file 14-2, C-4
alternative 7-7, 9-4
dictionary 4-1
field A-3 Q
field definition 7-5 querying data concepts 1-4
file definition 5-3
position to 5-8
record format definition 5-3, 6-3 R
new definition, field 7-12 record concept 1-2
non-IDDU authority requirement 15-2 record format
nondictionary described file C-1 changing 12-2
null attribute 7-7 considerations 10-1
number field A-4 create 5-7
create format for a file definition 5-7
defining 6-1

X-6 IDDU Use V4R1


record format (continued)
definition 12-2 S
displaying 12-6 same dictionary, SQL and IDDU 13-4
name saving
position to 5-8 data dictionaries 13-3
sequencing 5-8 SAVLIB (Save Library) command D-2
naming rules 6-3 SBCS
number See single-byte character set
position to 5-8 securing data dictionaries 4-2
sequencing 5-8 security
printing 12-6 changing data dictionaries 13-1
select for a file definition 5-8 data dictionary 4-2
record format definition resource and office 4-2
considerations for sequence of fields 6-3 select
copy 12-5 new record formats 5-8
copy confirm 12-5 select definition type
copying 12-4 field 7-12
create 6-4 practice exercise B-2
delete confirm 12-6 record format 6-4
deleting 12-6 Select Definition Type display 5-5, 6-4, 7-12, B-2
description 2-3 Select Key Fields display 11-3
long comment, text 6-4 separator
multiple record formats 5-3 date 7-11
name 5-3 options 9-8
naming rules 6-3 time 7-11
planning 6-1 sequence number, position to 5-8
record ID codes 10-1 session, resuming interrupted 12-11
renaming 12-10 sharing a dictionary, SQL and IDDU 13-4
where used 12-11 shift keyboard
work sheet 6-2 character 9-4
work with 6-7 DBCS 9-7
record format name, position to 5-8 numeric 9-6
record ID codes 10-1 signed numeric shift 9-6
recovering single-byte character set (SBCS) 7-5, 9-8
dictionaries 13-3 specify
interrupted session 12-11 character keyboard shift 9-7
removing date/time options 9-8
data definition 12-6 DBCS data type 9-7
data dictionaries 13-2 edit code 9-1
definition 12-6 numeric keyboard shift 9-6
renaming separator options 9-8
data definition 12-10 Specify Edit Word display 9-3
data dictionaries 13-4 SQL
reports A-1 compared to IDDU 13-5
requirement delete definition 13-5
authority not supported by IDDU 13-5
for IDDU operations 15-1 terminology used by IDDU 13-4
for non-IDDU dictionary operations 15-2 use IDDU definitions 13-5
resource and office security 4-2 starting IDDU 3-1
restoring STRIDD (Start IDDU) command D-2
data dictionaries 13-3 System/36-AS/400 differences E-1
rights, controlling dictionary access 4-2
rights/authority table 15-2
RSTLIB (Restore Library) command D-1
T
table authority/right 15-2

Index X-7
task, data dictionary 4-3
text (description)
dictionary 4-3
field definition 7-7
file definition 5-4
record format definition 6-4
time format 7-11
time separator 7-11

U
unlink data definition and file 14-1

V
viewing a data dictionary 13-3

W
Work with ... Definitions (example) 12-1
Work with Data Dictionaries display 4-1, 13-1
Work with Database Files display 8-1
Work with Field Definitions display 7-12
Work with File Definitions display 3-2, 3-3, 3-4, 5-5,
B-2, B-5
Work with Record Format Definitions display 6-4
working with
data dictionary 4-3
database files 8-1
definitions 12-1
dictionary
access rights 4-2
authority 4-2
field definitions 7-14
file definitions 5-9
nondictionary described files C-1
record format definitions 6-7
WRKDBFIDD (Work with Database Files)
command D-2
WRKDTADCT (Work with Data Dictionaries)
command D-2
WRKDTADFN (Work with Data Definitions)
command D-2

Z
zoned data 7-8

X-8 IDDU Use V4R1


Reader Comments—We'd Like to Hear from You!
AS/400 Advanced Series
IDDU Use
Version 4
Publication No. SC41-5704-00

Overall, how would you rate this manual?

Very
Very Dissatis-
Satisfied Dissatis-
Satisfied fied
fied
Overall satisfaction

How satisfied are you that the information in this manual is:

Accurate
Complete
Easy to find
Easy to understand
Well organized
Applicable to your tasks
THANK YOU!

Please tell us how we can improve this manual:

May we contact you to discuss your responses? __ Yes __ No


Phone: (____) ___________ Fax: (____) ___________ Internet: ___________

To return this form:


Ÿ Mail it
Ÿ Fax it
United States and Canada: 800+937-3430
Other countries: (+1)+507+253-5192
Ÿ Hand it to your IBM representative.

Note that IBM may use or distribute the responses to this form without obligation.

Name Address

Company or Organization

Phone No.
Cut or Fold
Reader Comments—We'd Like to Hear from You!

IBM
Along Line
SC41-5704-00

Fold and Tape Please do not staple Fold and Tape

NO POSTAGE
NECESSARY
IF MAILED IN THE
UNITED STATES

BUSINESS REPLY MAIL


FIRST-CLASS MAIL PERMIT NO. 40 ARMONK, NEW YORK

POSTAGE WILL BE PAID BY ADDRESSEE

ATTN DEPT 542 IDCLERK


IBM CORPORATION
3605 HWY 52 N
ROCHESTER MN 55901-9986

Fold and Tape Please do not staple Fold and Tape

Cut or Fold
SC41-5704-00 Along Line
IBM 

Printed in the United States of America


on recycled paper containing 10%
recovered post-consumer fiber.

SC41-57ð4-ðð
Spine information:

IBM AS/400 Advanced Series IDDU Use Version 4

You might also like