Sie sind auf Seite 1von 18

Physical File

Physical Files:

AIM:

You are able to do:

 Create a Physical file


 Create a Logical file
 Understand the concept of Physical files.
 Understand the part of Logical files.
 Concept of Keyed and Sequential access
 Commands related to files.
 Add records to physical file using STRDFU,UPDDTA.

Create a Physical File with or without a key field

Introduction:
The AS/400 database, DB2/400 is part of the AS/400 operating system. The standard method of
creating files is to define the specifications of the file using DDS(Data Description Specification). Of
course DDS is used for other things on the AS/400 like defining display files and print files.

Defining a physical file using DDS


An externally described file is one in which the record and field descriptions are defined outside of a
program. The two types supported on the AS/400 are physical and logical files. Physical files are
explained in this chapter and logical files in next.

Similar to disk files on non-data based computer system, physical files contain the actual data records.
The attributes of the records may be data based-defined or program-defined. If they are database-
defined, the field definitions are specified outside of a program. For program-defined files, the field
attributes must be included in the program in the traditional RPG II way.

Physical files may be organized as non-keyed or keyed sequence files. The type of organization
determines the access path followed when the file is processed.

A non-keyed file is similar to the standard sequential organization file in which keys are not specified.
Records, which are processed in the order that they were loaded, may be read, written, and updated
using sequential or relative record processing methods. Direct file organization is not supported on the
AS/400. The processing methods unique to that file type, however, may be simulated for arrival of key-
sequenced files.

A keyed sequence file is similar to the traditional indexed sequential file organization in which one or
more fields may be specified as a key. Processing features unique to key sequence file are the
following:

1. Records may be accessed sequentially in key value order or randomly by the value of a key.
2. Records may be accessed in arrival sequence order (ignores key value order).
3. Composite keys may be defined by specifying more than one field within the body of a record.
These fields need not be contiguous.
4. Any field in the body of the record may be specified as a key field after the file is created.
However, a logical file must be used to process the physical file by the new key(s).
5. In addition to standard sequential and random processing, files may be read backward or
accessed by a relative record number.
6. The next record that is lower or higher than the specified key value may be accessed.

S R CHOWDARY
Physical File

The steps for building a physical file are the following:


1. Design a record format based on some applications criteria.
2. Write the code on a Data Description Specifications (DDS) form.
3. Enter the DDS statements via the Source Entry Utility (SEU) and save.
4. Compile, debug, and store the error-free physical file object format.

Creation of physical file:


Notice that the first record has an "R" in position 17. This means that this line is specifying the record
name. The "TEXT" is optional but helps to document the file. Shown in lab session.

After the line naming the record, each line describes a field. The field length and its data type follow
the field name. Once you have entered the DDS source code, you must compile it. You do this by
keying option 14 next to your member name on the PDM screen. Field length should not be greater
than 10 characters.

Data Access:
You now have a database physical file, see Figure 1. This file has built into it the fields and their
attributes. Let's modify this file definition to add key fields. If a physical file has key fields, programs
can randomly access the records or read them sequentially in the order of the key fields.

The records are written to the file in arrival sequence. If you read the data by specifying keyed access,
the records will read as though company number and customer number have sorted them. Also, your
programs can randomly retrieve records.

Figure 1 - DDS for Physical File Without Key


Columns . . . : 1 71 BIZLIB/ QDDSSRC
SEU==> STUDENT
FMT PF .....A..........T.Name++++++RLen++TDpB......Functions++++++++++++++++++
*************** Beginning of data *************************************
0002.00 A R RSTUD
0003.00 A ROLL 3S 0 COLHDG('ROLL NUMBER')
0004.00 A SNAME 5A COLHDG('STUDENT NAME')
0005.00 A CCD 3S 0 COLHDG('COURSE CODE')
0006.00 A CORS 5A COLHDG('COURSE NAME')
0007.00 A ADD 5A COLHDG('ADDRESS')
****************** End of data ****************************************

F3=Exit F4=Prompt F5=Refresh F9=Retrieve F10=Cursor F11=Toggle


F16=Repeat find F17=Repeat change F24=More keys

S R CHOWDARY
Physical File

Figure 2 - DDS for Physical File With Key Fields


Columns . . . : 1 71 Edit BIZLIB/QDDSSRC
SEU==> STUDENT
FMT PF .....A..........T.Name++++++RLen++TDpB......Functions++++++++++++++++++
*************** Beginning of data *************************************
0001.00 UNIQUE
0002.00 A R RSTUD
0003.00 A ROLL 3S 0 COLHDG('ROLL NUMBER')
0004.00 A SNAME 5A COLHDG('STUDENT NAME')
0005.00 A CCD 3S 0 COLHDG('COURSE CODE')
0006.00 A CORS 5A COLHDG('COURSE NAME')
0007.00 A ADD 5A COLHDG('ADDRESS')
0008.00 A K ROLL
****************** End of data ****************************************

F3=Exit F4=Prompt F5=Refresh F9=Retrieve F10=Cursor F11=Toggle


F16=Repeat find F17=Repeat change F24=More keys

Creating Physical File:

To create physical file, press F6 (source entry utility) write source file name, Library name, source
member, source type as ‘PF’ and text description.

Start Source Entry Utility (STRSEU)

Type choices, press Enter.

Source file . . . . . . . . . . > QDDSSRC Name, *PRV


Library . . . . . . . . . . . > BIZLIB Name, *LIBL, *CURLIB, *PRV
Source member . . . . . . . . . STUDENT Name, *PRV, *SELECT
Source type . . . . . . . . . . PF Name, *SAME, BAS, BASP...
Text 'description' . . . . . . . 'STUDENT DETAILS'

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

S R CHOWDARY
Physical File

HIT ENTER
Columns . . . : 1 71 Edit BIZLIB/QDDSSRC
SEU==> STUDENT
FMT PF .....A..........T.Name++++++RLen++TDpB......Functions++++++++++++++++++
IPPF *************** Beginning of data *************************************

PHYSICAL FILE PROMPT

F3=Exit F4=Prompt F5=Refresh F9=Retrieve F10=Cursor F11=Toggle


F16=Repeat find F17=Repeat change F24=More keys

NOTE : ‘IPPF’ IS INPUT PROMP FOR PHYSICAL FILE, USED TO DO FIELD ENTRIES IN PHYSICAL FILE.

Press enter Which gives you following prompt


Columns . . . : 1 71 Edit BIZLIB/QDDSSRC
SEU==> STUD4
FMT PF .....A..........T.Name++++++RLen++TDpB......Functions++++++++++++++++++
*************** Beginning of data *************************************
'''''''
****************** End of data ****************************************

Prompt type . . . PF Sequence number . . . '''''''

Name Data Decimal


Type Name Ref Length Type Positions Use

Functions

F3=Exit F4=Prompt F5=Refresh F11=Previous record


F12=Cancel F23=Select prompt F24=More keys

THIS TABLE DESCRIBES YOU THE DETAILS OF ‘IPPF’ PROMPT.

HEADING DESCRIPTION
Name type Blank : Leave the field blank to indicate a Field
Name.

R : Type R in column 17 to indicate a Record


Format Name.

Name Type a Record Format, Field, or Key Field Name in


this position. The maximum length allowed is 10
characters, beginning in column 19.
Type R in this field to use the reference function
Ref to copy attributes of a previously defined named
field to the field you are now defining.

S R CHOWDARY
Physical File

Length Type a value to indicate the number of bytes in a


Character field or the number of digits in a
Numeric field.
Data Type These are Data types which we use
frequently:

S : Type S to indicate Zoned Decimal data.(For


Numeric value)

F : Type F to indicate Floating Point data.

A : Type A to indicate Character data.

L : Type L to indicate Date data.

P : Type P to indicate Packed Decimal data.

Decimal Position Type a value from 0 to 31 to indicate the number


of decimal positions to the right of the decimal
point within a Packed Decimal, a Zoned Decimal,
a Floating Point, or a Binary field.
USE Type B or leave the field blank to indicate a field
used for both input and output.
Functions Use Keywords like

COM Provides a comparison value (for


reference function only).

RANGE Provides a range of valid values (for


reference function only).

Write your Record format as we discussed the sequence of PF in introduction.

Columns . . . : 1 71 Edit BIZLIB/QDDSSRC


SEU==> STUDENT
FMT PF .....A..........T.Name++++++RLen++TDpB......Functions++++++++++++++++++
*************** Beginning of data *************************************
0001.00 A R RSTUD
****************** End of data ****************************************

Prompt type . . . PF Sequence number . . . 0002.00

Name Data Decimal


Type Name Ref Length Type Positions Use Functions
R RSTUD

Record format Name


Record format definition

F3=Exit F4=Prompt F5=Refresh F11=Previous record


F12=Cancel F23=Select prompt F24=More keys
Note: Record format name is not having attributes like DATA TYPE and DECIMAL POSITION.

Hit enter and again write “IPPF’ to insert Field:

Now in second step you have to define fields having attributes field length, data type and decimal
positions if field is numeric. Insert the define fields using same way.

S R CHOWDARY
Physical File

While entering fields the values, which we provide for LENGTH, and DECIMAL POSITION are numeric
must be RIGTHT align. To make it RIGHT ALIGN use right ‘Enter Key’ from numeric pad.

Columns . . . : 1 71 Edit BIZLIB/QDDSSRC


SEU==> STUDENT
FMT PF .....A..........T.Name++++++RLen++TDpB......Functions++++++++++++++++++
*************** Beginning of data *************************************
0002.00 A R RSTUD
0003.00 A ROLL 3S 0
0004.00 A SNAME 5A
0005.00 A CCD 3S 0
0006.00 A CORS 5A
0007.00 A ADD 5A
0008.00 A K ROLL
****************** End of data ****************************************

Prompt type . . . PF Sequence number . . . 0003.00

Name Data Decimal


Type Name Ref Length Type Positions Use
ROLL 3 S 0
Functions

F3=Exit F4=Prompt F5=Refresh F11=Previous record


F12=Cancel F23=Select prompt F24=More keys

PRESS F3

Exit

Type choices, press Enter.

Change/create member . . . . . . . Y Y=Yes, N=No


Member . . . . . . . . . . . . . STUDENT Name, F4 for list
File . . . . . . . . . . . . . . QDDSSRC Name, F4 for list
Library . . . . . . . . . . . . BIZLIB Name
Text . . . . . . . . . . . . . . PHYSICAL FILE FOR STUDENT

Resequence member . . . . . . . . N Y=Yes, N=No


Start . . . . . . . . . . . . . 0001.00 0000.01-9999.99
Increment . . . . . . . . . . . 01.00 00.01-99.99

Print member . . . . . . . . . . . N Y=Yes, N=No

Return to editing . . . . . . . . . N Y=Yes, N=No

Go to member list . . . . . . . . . N Y=Yes, N=No

Hit Enter

S R CHOWDARY
Physical File

Work with Members Using PDM BGIN01

File . . . . . . QDDSSRC
Library . . . . BIZLIB Position to . . . . .

Type options, press Enter.


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

Opt Member Type Text


STUDENT PF PHYSICAL FILE

Bottom
Parameters or command
===>
F3=Exit F4=Prompt F5=Refresh F6=Create
F9=Retrieve F10=Command entry F23=More options F24=More keys

To compile PF use command CRTPF or opt 14 against PF that create object of PF (as shown below).

Work with Members Using PDM BGIN01

File . . . . . . QDDSSRC
Library . . . . BIZLIB Position to . . . . .

Type options, press Enter.


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

Opt Member Type Text

14 STUDENT PF PHYSICAL FILE

Opt for compile


Bottom
Parameters or command
===>
F3=Exit F4=Prompt F5=Refresh F6=Create
F9=Retrieve F10=Command entry F23=More options F24=More keys

After writing 14 over Opt and press F4 that is same as CRTPF on command line with F4.

S R CHOWDARY
Physical File

Create Physical File (CRTPF)

Type choices, press Enter.

File . . . . . . . . . . . . . . > STUDENT Name


Library . . . . . . . . . . . > BIZLIB Name, *CURLIB
Source file . . . . . . . . . . > QDDSSRC Name
Library . . . . . . . . . . . > BIZLIB Name, *LIBL, *CURLIB
Source member . . . . . . . . . > STUDENT Name, *FILE
Record length, if no DDS . . . . Number
Generation severity level . . . 20 0-30
Flagging severity level . . . . 0 0-30
File type . . . . . . . . . . . *DATA *DATA, *SRC
Member, if desired . . . . . . . *FILE Name, *FILE, *NONE
Text 'description' . . . . . . . *SRCMBRTXT

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

Press enter which creates physical files object. Now to UPDATE pf, write ‘UPDDTA <FILE NAME> ‘
command on command line.

Work with Members Using PDM BGIN01

File . . . . . . QDDSSRC
Library . . . . BIZLIB Position to . . . . .

Type options, press Enter.


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

Opt Member Type Text


STUDENT PF PHYSICAL FILE

Bottom
Parameters or command
===> UPDDTA
F3=Exit F4=Prompt F5=Refresh F6=Create
F9=Retrieve F10=Command entry F23=More options F24=More keys

Press F4 to see Parameter for UPDDTA command.

S R CHOWDARY
Physical File

Update Data with Temp Program (UPDDTA)

Type choices, press Enter.

Data base file . . . . . . . . . STUDENT Name


Library . . . . . . . . . . . BIZLIB Name, *LIBL, *CURLIB
Member . . . . . . . . . . . . . *FIRST Name, *FIRST

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

Hit Enter. Add records to these fields.

WORK WITH DATA IN A FILE Mode . . . . : ENTRY


Format . . . . : RSTUD File . . . . : STUD

ROLL:
SNAME:
CCD:
CORS:
ADD:

F3=Exit F5=Refresh F6=Select format


F9=Insert F10=Entry F11=Change
(C) COPYRIGHT IBM CORP. 1980, 2002.

INSERT DATA AS PER REQUIREMENT. PRESS F3 TO EXIT FROM FILE.

S R CHOWDARY
Physical File

End Data Entry

Number of records processed

Added . . . . . : 3 No of records added


Changed . . . . : 0
Deleted . . . . : 0

Type choice, press Enter.

End data entry . . . . . . . Y Y=Yes, N=No

F3=Exit F12=Cancel

Press enter. After insertion of data do not compile the file which delete your data. Use ‘RUNQRY *N
<FILENAME>’ to run or to see the content of physical file.

Work with Members Using PDM BGIN01

File . . . . . . QDDSSRC
Library . . . . BIZLIB Position to . . . . .

Type options, press Enter.


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

Opt Member Type Text


STUDENT PF STUDENT DETAILS

More...
Parameters or command
===> RUNQRY *N STUDENT

F3=Exit F4=Prompt F5=Refresh F6=Create


F9=Retrieve F10=Command entry F23=More options F24=More keys

Press enter

S R CHOWDARY
Physical File

Display Report
Report width . . . . . : 60
Position to line . . . . . Shift to column . . . . . .
Line ....+....1....+....2....+....3....+....4....+....5....+....6
ROLL NUMBER STUDENT NAME COURSE CODE COURSE NAME ADDRESS
000001 101 RAJU 200 VB PUNE
000002 102 SANJU 201 AS MUM
****** ******** End of report ********

Bottom
F3=Exit F12=Cancel F19=Left F20=Right F21=Split

KEYWORDS:
A) File level keywords:
Following are the File Level Keywords:
UNIQUE
FIFO (First In First Out)
LIFO (Last In First Out)
FCFO (First Change First Out)

1) UNIQUE: The "UNIQUE" record at the beginning of the source is used if you want the AS/400
to insist on having no records with duplicate keys. This is optional. At the end of the source
code, there are two lines with "K" in position 17. These lines define the key fields.
2) FIFO LIFO FCFO: These keywords are used with the duplicate entries to specify the order.

Columns . . .: 1 71 Edit BIZLIB/QDDSSRC


SEU==> STUDENT
FMT PF ...A..........T.Name++++++RLen++TDpB......Functions++++++++++++++++++
*************** Beginning of data *************************************
0000.01 UNIQUE
0001.00 A R RSTUD
0002.00 A ROLL 3S 0
0003.00 A SNAME 5A
0004.00 A CORS 5A
0005.00 A ADD 5A
0006.00 A CITY 5A
0007.00 A K ROLL

****************** End of data ****************************************

F3=Exit F4=Prompt F5=Refresh F9=Retrieve F10=Cursor F11=Toggle


F16=Repeat find F17=Repeat change F24=More keys

S R CHOWDARY
Physical File

LIKE ‘UNIQUE’ KEYWORD USE FIFO, LIFO AND FCFO KEYWORDS.

Record Level Keywords:


FORMAT (Format) keyword for physical and logical files
Use this record-level keyword to specify that this record format is to share the field specifications for a
previously defined record format. The name of the record format you are defining must be the name of
the previously defined record format.

The format of the keyword is:


FORMAT([library-name/]database-file-name)

The database-file-name parameter is required. It is the name of the physical or logical file from which
the previously defined record format is taken.

Create new physical file ‘student1’ and define only record format name with FORMAT keyword having
filename which is to be reffered.

Columns . . .: 1 71 Edit BIZLIB/QDDSSRC


SEU==> STUDENT1
FMT PF ...A..........T.Name++++++RLen++TDpB......Functions++++++++++++++++++
*************** Beginning of data *************************************
0001.00 A R RSTUD FORMAT(STUDENT)
****************** End of data ****************************************

F3=Exit F4=Prompt F5=Refresh F9=Retrieve F10=Cursor F11=Toggle


F16=Repeat find F17=Repeat change F24=More keys

COMPILE THIS FILE AND USE RUNQUERY OPTION TO RUN THE FILE.

The name of this record format (RSTUD) must be the same as the name of the record format in
STUDENT. Like FORMAT ‘TEXT’ is also a record level keyword use as follows:

S R CHOWDARY
Physical File

Columns . . .: 1 71 Edit BIZLIB/QDDSSRC


SEU==> STUDENT
FMT PF ...A..........T.Name++++++RLen++TDpB......Functions++++++++++++++++++
*************** Beginning of data *************************************
0001.00 A R RSTUD TEXT(‘STUDENT DETAILS’)
0002.00 A ROLL 3S 0
0003.00 A SNAME 5A
0004.00 A CORS 5A
0005.00 A ADD 5A
0006.00 A CITY 5A
0007.00 A K ROLL

****************** End of data ****************************************

F3=Exit F4=Prompt F5=Refresh F9=Retrieve F10=Cursor F11=Toggle


F16=Repeat find F17=Repeat change F24=More keys

The name of this record format (RSTUD) must be the same as the name of the record format in
STUDENT.

Field Level Keywords:

ALIAS (Alternative Name) keyword for physical and logical files

Use this field-level keyword to specify an alternative name for a field. When the program is compiled,
the alternative name is brought into the program instead of the DDS field name.

The format of the keyword is:


ALIAS (alternative-name)

The alternative name must be different from all other alternative names and from all DDS field names
in the record format. If a duplicate is found, an error message appears on the field name or alternative
name. When you refer to a field that has the ALIAS keyword, the ALIAS keyword is copied in unless the
ALIAS keyword is explicitly specified on the referencing field.

Example:

The following example shows how to specify the ALIAS keyword.


|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
00010A FIELDA 25A ALIAS(STUDENT NAME)

In the example, the alternative name for FIELDA is STUDENT NAME.

COLHDG (Column Heading) keyword for physical and logical files:


Use this field-level keyword to specify column headings used as a label for this field by text
management, the query utility, the data file utility (DFU), and the screen design aid (SDA).

S R CHOWDARY
Physical File

The format of the keyword is:


COLHDG (’line-1’ [’line-2’ [’line-3’]])

A maximum of three lines of 20 characters each is allowed. Each line of the column heading must be
enclosed in apostrophes. Use double apostrophes (’ ’) to specify apostrophes within column headings.
Use one or more blanks to separate the first column heading line from the second and the second from
the third.

For example, COLHDG (’Order’ ’Date’) is equivalent to TEXT (’Order Date’).

Example:
The following example shows how to specify the COLHDG keyword for a physical file.

|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
00150A ROLL 50 COLHDG(’ROLL’ ’NUMBER’)
00160A SNAME 20 COLHDG(’Student’s Name’)

TEXT : This is record level as well as field level keyword which describes your field.

Example:
The following example shows how to specify the COLHDG keyword for a physical file.

|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
00150A ROLL 50 TEXT(’ROLL NUMBER’)
00160A SNAME 20 TEXT(‘Student’s Name’)

CHECK
Use this field-level keyword to specify validity checking in display files.

The rules for specifying this keyword in a physical or logical file are similar to those for a display file.
However, only the following codes are allowed in physical or logical files:

Code Meaning
AB Allow blank
ME Mandatory enter
MF Mandatory fill
M10 IBM* Modulus 10 self-check algorithm
M10F IBM® Modulus 10 self-check algorithm
M11 IBM Modulus 11 self-check algorithm
M11F IBM Modulus 11 self-check algorithm
VN Validate name
VNE Validate name extended

|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
00150A ROLL 50 CHECK(AB)
00160A SNAME 20 CHECK(MF)

Above example shows that roll number may be blank and student name is mandatory.

You cannot specify the CHECK(AB), CHECK(VN), CHECK(VNE), CHECK(M10), CHECK(M11),


CHECK(M10F), or CHECK(M11F) keywords on a floating-point field (F in position 35). You cannot
specify the CHECK keyword on a hexadecimal field (H in position 35). Do not specify the CHECK
keyword on a date, time, or timestamp field (L, T, or Z in position 35).

S R CHOWDARY
Physical File

DESCEND (Descend) keyword for physical


Use this key field-level keyword to specify that the values of this character, hexadecimal, or numeric
key field are retrieved in descending sequence. The default is ascending sequence. See “SIGNED
(Signed) keyword for physical and logical files” on page 69 for an example of data sorted using the
DESCEND keyword.

This keyword has no parameters.

Example:
The following example shows how to specify the DESCEND keyword for a logical file.

|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
00010A KITEM
00020A KBALDUE DESCEND

COMP (Comparison) keyword for physical and logical files


Use this field-level keyword to specify validity checking for the field you are defining when it is referred
to later during display file creation. COMP is equivalent to CMP.

The format of the keyword is:


COMP (relational-operator value) At the select/omit-field level, the format of the keyword is:

COMP (relational-operator field-name)


Valid relational operators are:
Relational Operator
Meaning
EQ Equal to
NE Not equal to
LT Less than
NL Not less than
GT Greater than
NG Not greater than
LE Less than or equal to
GE Greater than or equal to

Specify the value parameter at either the field level or the select/omit field level. Specify the field name
parameter only at the select/omit field level.

The RANGE Keyword


The RANGE keyword validates that the data in a field value is equal or greater than the lower value
and less than or equal to the higher value specified in the RANGE key word.

The format of the keyword is:


Range (low-value high –value)

When the related field is defined as character , the low and high values must both be enclosed in single
quotes. The quotes are omitted for numeric fields. Figure details two examples of the RANGE
keyword.

The VALUES Keyword


The VALUES keywords validates that a field value is equal to one of the values included in the
specified list. It is similar to the COMP keyword in that a relational test is made. However the VALUES
keyword only performs an equal test on a list of values, whereas the COMP keyword may include any
of the relational tests, but only for one value.

The format of the keyword is


VALUES (value-1[value-2….[value-1001])

S R CHOWDARY
Physical File

One hundred values may be specified, each separated by at least one blank. A VALUES keyword
specified with character fields must have each value in the list enclosed in single quotes. Numeric
values are specified without quotes Identical to any relational comparison function, the value list must
be the same type as the related field. Figure shows two coding examples of the VALUES keyword.

PHYSICAL FILE MAINTENANCE COMMANDS

Command Description Usage


CHGPF Change physical file
Supports changes in the attributes of a
physical file without requiring its recreation
with the CRTPF command. The data in the
physical file is not lost when CHGPF is
executed.
CLRPFM Clear physical file member Clears a physical file member of all data records
with-out deleting the file’s structure.

CPYF Copy file Copies the data stored in a physical file to an output
device or another physical file. Either all of the
records or only selected records may be copied. A
variety of selection criteria may be specified such as
a key or a relative record number range. When
output is to a printer, either character or
hexadecimal format may be specified. For
readability, however, hexadecimal format is
necessary if packed numeric values are stored in one
or more fields of the record format.
DLTF Deletes the physical file’s object and any data stored
Delete File in the file. A file cannot be deleted if a logical file has
been created over it or if the file is in use.

DSPPFM Display Physical File Member Displays the field values in the records stored in a
physical file. Records are displayed in arrival
sequence even if the file was created as keyed. A
character or hexadecimal display of the record values
may be specified. Other than printing the current
display with the values may be specified. Other than
printing the current display with the Print key, printer
output is not supported.
RMVM Remove Member Removes the specified member from the physical file
and deletes all of the data stores in the member.

DSPFD Display Physical file Description Displays the file description like total no. of files,
fields, records etc.
ADDPFM Add Physical file member Adds the member in created physical file.

Entering the command on the command line of an AS/400 display and pressing F4 may execute any of
these CL commands. One or more prompt screens will display enabling the programmers to enter
command specific data.

How to add members in Physical file:

Step1:

Write command CHGPF on command line and press F4 to change the option of physical file-

S R CHOWDARY
Physical File

Change Physical File (CHGPF)

Type choices, press Enter.

Physical file . . . . . . . . . STUDENT Name


Library . . . . . . . . . . . BIZLIB Name, *LIBL, *CURLIB
System . . . . . . . . . . . . . *LCL *LCL, *RMT, *FILETYPE
Source file . . . . . . . . . . STUDENT Name, *NONE
Library . . . . . . . . . . . BIZLIB Name, *LIBL, *CURLIB

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

Press enter and change option ‘Maximum members’ to 3 (change according to your requirement)

Change Physical File (CHGPF)

Type choices, press Enter.

Physical file . . . . . . . . . STUDENT Name


Library . . . . . . . . . . . BIZLIB Name, *LIBL, *CURLIB
System . . . . . . . . . . . . . *LCL *LCL, *RMT, *FILETYPE
Source file . . . . . . . . . . QDDSSRC Name, *NONE
Library . . . . . . . . . . . BIZLIB Name, *LIBL, *CURLIB
Source member . . . . . . . . . *FILE Name, *FILE
Source listing options . . . . . *SRC, *NOSRC, *SOURCE...
+ for more values
Generation severity level . . . 20 0-30
Flagging severity level . . . . 0 0-30
Delete dependent logical file . *NO *NO, *YES
Remove constraint . . . . . . . *RESTRICT *RESTRICT, *REMOVE
Expiration date for member . . . *NONE Date, *SAME, *NONE
Maximum members . . . . . . . . 3 Number, *SAME, *NOMAX
Access path size . . . . . . . . *SAME *SAME, *MAX4GB, *MAX1TB
Access path maintenance . . . . *SAME *SAME, *IMMED, *REBLD, *DLY
More...
F3=Exit F4=Prompt F5=Refresh F10=Additional parameters F12=Cancel
F13=How to use this display F24=More keys

Hit enter which shows you message on message area that File STUDENT in library PB01U01O
changed.

Step2 : Now in second step add 3 members with your created Physical file. You can add ‘<=3’
members but not Greater than 3 as you define max members 3.

Write command ADDPFM on command line and press F4

S R CHOWDARY
Physical File

Add Physical File Member (ADDPFM)

Type choices, press Enter.

Physical file . . . . . . . . . STUDENT Name


Library . . . . . . . . . . . BIZLIB Name, *LIBL, *CURLIB
Member . . . . . . . . . . . . . PF1 Name
Text 'description' . . . . . . . 'THIS IS MY FIRST MEMBER'

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

Hit enter and see message on command line that MEMBER PF1 is added in Physical file STUDENT.
Add more member using above procedure. And you can see the content of member using RUNQRY
command and press F4 on command line

Run Query (RUNQRY)

Type choices, press Enter.

Query . . . . . . . . . . . . . Name, *NONE


Library . . . . . . . . . . . *LIBL Name, *LIBL, *CURLIB
Query file:
File . . . . . . . . . . . . . > STUDENT Name, *SAME
Library . . . . . . . . . . > BIZLIB Name, *RUNOPT, *LIBL, *CURLIB
Member . . . . . . . . . . . . > PF1 Name, *RUNOPT, *FIRST, *LAST
+ for more values
Report output type . . . . . . . *RUNOPT *RUNOPT, *DISPLAY...
Output form . . . . . . . . . . *RUNOPT *RUNOPT, *DETAIL, *SUMMARY
Record selection . . . . . . . . *NO *NO, *YES

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

Hit enter which shows you the content of above member.

S R CHOWDARY

Das könnte Ihnen auch gefallen