Вы находитесь на странице: 1из 61

AS400 Introduction

In AS400, AS stands for "Application System.

It is multiuser, multitasking and very secure system and hence is used for the industry
which requires sensitive data to be stored and processed simultaneously.

It has integrated the DB2 database management system, menu-driven interfaces, multiuser support, security, communications, clientserver and web-based applications.

It is best suited for mid-level industry and hence is used in pharmaceutical industry,
banking, malls, hospital administration, manufacturing, distribution industry, financial
organization, e-commerce etc.

The AS/400 (Application System/400) was first introduced by IBM on June 21st, 1988
and later renamed to as eServer iSeries in 2000, then in 2006, it was renamed
as System i . In 2008 System igot unified with System p to become Power system.

The operating system for AS400 also got renamed with the rebranding. Initially, it
was OS/400 theni5/OS and then iBM i (Power system).

OS/400

Version

4,

introduced

feature LPAR (Logical PARtitioning)

which facilitates running multiple operating systems simultaneously on one IBM


System i unit ensuring that one OS doesntinterfere others system resources/memory.

Programming

languages

available

for

the

AS/400

include RPG, assembly

language, C, C++, Pascal,Java, Perl, Smalltalk, COBOL, SQL, BASIC, PHP, Python.

AS400 is based on Layered machine architecture. It enables user to move to new


hardware technology at any time, without disrupting their application programs.

It has Object orientation i.e. everything that can be stored or retrieved on the system is
known as anobjects. AS400 can recognize only the object types that have been
defined for it. It cannot identify any unknown objects that dont seem to be known. It
adds extra security to the system.

It provides contiguous memory between main storage and disk storage. It provides
authority to add any disk space so that use.

Another feature of AS400 is that it is very secure system making it to store sensitive
data. It incorporates security at various levels. Any user can be limited to access/process
only particular information on the system.

Library

When we execute a command or call a program, the AS/400 must know where to find
the command or program and the answer is library.

A Library is a collection of objects.

QSYS is the only library that contains other library.

A library contain the object name, type, and the address

QSYS is the root library where the entire user defined/ system defined library is
created.

System library is the library that contains the objects that was created at the time
OS400 was installed.

System supplied libraries begin with the letter "Q" or "#".

When you logon the first library to be load is QSYS. The system library is loaded at
the first time.

Library list types:

System library: All IBM supplied library e.g. QSYS, QHLPSYS, QUSRSYS

Product Library: Whenever Ibm product is used it is added to the library


automatically and is removed itself when

the job completes.

Current Library: Current library is the working library i.e. all the work done by you
is stored in current library. If you want that all the things done by you should be stored
in your personal library AMINEM , then just change the current library as your
personal library.
To

change

AMINEM: CHGCURLIB

current

library

to

your

AMINEM

User Library: Non-IBM supplied i.e. created by the user.

personal

library

Related commands:

I.

Display Library List (DSPLIBL)

To display all types of libraries, we can use the command:


In the below snapshot we can see different types of library in the library list
e.g. SYS(system), CUR(current), USR(user) library.
Display Library List
System:

Type options, press Enter.


5=Display objects in library

ASP
Opt

Library

Type

Device

Text

USALID09

QSYS

SYS

System Library

QSYS2

SYS

System Library for CPI's

QHLPSYS

SYS

QUSRSYS

SYS

AMINEM

CUR

QGPL

USR

QTEMP

USR

LOAD

USR

System Library for Users

General Purpose Library

Future Three - LOAD Procedure & Update


More...

F3=Exit

II.

F12=Cancel

F17=Top

F18=Bottom

Create Library (CRTLIB)

To create library the command is: CRTLIB

IROBO1 Press F4

Type choices, press Enter.


Library . . . . . . . . . . . . IROBO1 Name
Library type . . . . . . . . . . *TEST (*PROD, *TEST)
Text 'description' . . . . . . . THIS IS IROBO'S TEST LIBRARY

Bottom

F3=Exit F4=Prompt F5=Refresh F10=Additional parameters F12=Cancel


F13=How to use this display F24=More keys

Library type (TYPE)

*PROD
Database files in production libraries cannot be opened for updating if a user
is in debug mode and he requested that production libraries be protected.
A user can protect all database files in
production libraries from updates by specifying *NO for the Update production
files (UPDPROD) parameter on the Start Debug (STRDBG) command to begin
testing. However, this protection does not prevent the program from deleting
database files or from changing other objects (such as data areas) in the
library.

*TEST
This is a test library. All objects in a test library can be updated during testing,
even if special protection is requested for production libraries.

III.

Display library (DSPLIB)

DSPLIB IROBO1

It gives you the information of all objects that resides in the library with
its
size.

Display Library

Library

. . . . . . :

IROBO1

Number of objects

. :

Type . . . . . . . . :

PROD

Library ASP number . :

Create authority . . :

*EXCLUDE

Library ASP device . :

*SYSBAS

Type options, press Enter.


5=Display full attributes

Opt

8=Display service attributes

Object

Type

Attribute

PRINT1PGM

*PGM

RPGLE

ACCOUNT

*FILE

PF

PRINT1

*FILE

QCLSRC

Size

Text

131072

rpgle program for pri

49152

ACCOUNT RELATED INFOR

PRTF

4096

PRINTER DDS RLU GENER

*FILE

PF

8192

Sources CL-Programs

QDDSSRC

*FILE

PF

8192

DDS-Sourcen

QRPGLESRC

*FILE

PF

69632

QRPGLESRC2

*FILE

PF

65536

QRPGSRC

*FILE

PF

8192

SOURCE PHYSICAL FILE

Bottom
F3=Exit

F12=Cancel

F17=Top

F18=Bottom

IV.

Edit Library List (EDTLIBL)

You can add your personal library to any position just update the sequence
no. 0 with the required where you want your library to be and the
corresponding library name.

Edit Library List


System:

PUB1

Type new/changed information, press Enter.

Sequence
Number

Sequence
Library

Number

Sequence
Library

Number

150

300

10

GAMES400

160

310

20

QGPL

170

320

30

QTEMP

180

330

40

190

340

50

200

350

60

210

360

70

220

370

80

230

380

90

240

390

Library

V.

Add Library List Entry (ADDLIBLE)

ADDLIBLE LIB(IROBO1) POSITION(*First)

It adds your personal library at the first position in the library list.

VI.

Work With Libraries Using PDM (WRKLIBPDM)

Sourcephysical file

Source physical file is a filewhich contains the sources of different types


of objects.

Command used is CRTSRCPF.

CRTSRCPFFILE(IROBO1/QRPGSRC) RCDLEN(112) TEXT('SOURCE PHYSICAL


FILE)

There can be up to 32767 members.

Source physical file is anobject. But the source member is not an object.
When we compile the member, theobject is created for that source.

To see all thesource members of a source physical file, the command used
is WRKMBRPDM.
Work with MembersUsing
PDM

PUB1

File

.. . . . .

QRPGLESR

to

Library . . . .
. . . . .

IROBO1

Position

Type options, press


Enter.
2=Edit
5=Display

6=Print

3=Copy 4=Delete
7=Rename

8=Display description

9=Save 13=Change text

14=Compile

15=Create

module...

Opt Member

Type

Text

ACCOUNT

PF

ACCOUNT RELATED

PRINT1

PRTF

PRINTER DDS RLU

PRINT1PGM

RPGLE

rpgle program for

INFORMATION

GENERATED

print1

Bot
tom
Parameters or
command
===>
_________________________________________________________________________
___________________________________________________________________________
____

F3=Exit

F4=Prompt

F5=Refresh

F6=Create

F9=Retrieve

F10=Command entry

F23=More options

F24=More

keys

To add source ofany type of object in a source physical file we use the
command WRKMBRPDMand then F6.

Structure of the source physical file:


12

80
12

Serial no./Date

Source of the member

Comment

If you want tocheck the structure do the runqry to check it:


RUNQRY QRYFILE ((QRPGLESRC *LAST))

Display
Report

Position to
line

. . . . .

Line

Shift to column

....

+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8....+....9....+...1

SRCSEQ

SRCDAT

SRCDTA

000001

1.00

121,019

FPRINT1

PRINTEROFLIND(*IN90)

000002

2.00

121,019

FACCOUNT

IF

000003

3.00

121,019

000004

4.00

121,019

000005

5.00

121,019

WRITE

HEADER2

000006

6.00

121,019

READ

REC1

000007

7.00

121,019

DOW

*IN80=*OFF

000008

8.00

121,019

WRITE

DETAIL

000009

9.00

121,019

000010

10.00

121,019

EVAL

000011

11.00

121,019

READ

000012

12.00

121,019

ENDDO

000013

13.00

121,019

EVAL

TOTAL=COUNT

000014

14.00

121,019

WRITE

FOOTER

000015

15.00

121,019

DISK

Z-ADD

*ZEROS

2 0

WRITE

HEADER1

80

90

90

WRITE

HEADER2

COUNT=COUNT+1

REC1

80

LR

****** ********
report ********

End of

SETON

COUNT

System defaultlength of Source physical file92


Recommendedlength of Source physical file112
**Note: If we are copying thesource code from one source file of length 112, we
must assure that the targetsource file must be of length 112, else the source
code will be truncated.

Other than WRKMBRPDM, we can get the detail of Source physical fileby
command DSPFD.

Related commands

I.

Display FileDescription (DSPFD)

DSPFD

IROBO1/QRPGLESRC

The command given information:

It is a source physical file in library IROBO1.


Its creation date.
Detail of each and every member(ACCOUNT,PRINT1,PRINTPGM) as in
abovesnapshot.
File Level Identifier: It is actually the timestamp that relate to creation date/time
ofsource file.

Member Level Identifier: It is actually the timestamp that relate to creation date/time
ofMembers.
File/Member Level Identifiers are used by operations
such as RSTOBJ tohelp avoid restoring files that are the wrong versions.
Record FormatLevel Identifiers: are hashes ofattributes of all of the fields in the
format. Attributes such as lengths andbuffer positions are hashed in order to generate
a nearly unique value.
A difference betweenFormat Level Identifiers in a
program and in a file will result in a "levelcheck" exception when the program
attempts to open the file.
Initial no. of records: Initially what is the no. of records(Here it is 10000)
Increment no. of record: Indicates, what should be the number of times the
increment willhappen.(Here it is 1000)
Maximum no. of increment: Indicates, what should be the increment factor by which
the record will increase.(Here it is 499)
Record capacity: Hence, on the basis of above three, themaximum no. of record
could be 10000+499*1000=509000 i.e. given as recordcapacity below.
Current number of records: Current no.of record for each member.
No. of format=01
Total record length : 112
In the bottom summary of all members.

Display Spooled File


File

.. . . . :

QPDSPFD

Control . . . . .
Find

.. . . . .

*...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+.
12/31/12

Display File Description

DSPFD Command Input


File . . . . . . . . . . . . . . . . . . . : FILE
Library . . . . . . . . . . . . . . . . .:

QRPGLESRC
*LIBL

File Description Header


File . . . . . . . . . . . . . . . . . . . : FILE

QRPGLESRC

Library . . . . . . . . . . . . . . . . . .:

IROBO1

Type of file

. . . . . . . . . . . . . . . :

Physical

File type . . . . . . . . . . . . . . . . .: FILETYPE

*SRC

Auxiliary storage pool ID . . . . . . . . .:

00001

Data Base File Attributes


Externally described file . . . . . . . . .:

Yes

File level identifier . . . . . . . . . . .:

1121019191538

Creation date . . . . . . . . . . . . . . .:

10/19/12

Maximum members . . . . . . . . . . . . . .: MAXMBRS

*NOMAX

Number of constraints . . . . . . . . . . .:
Number of triggers

. . . . . . . . . . . . :

Number of members . . . . . . . . . . . . .:

0
3

Member size

SIZE

Initial number of records . . . . . . . .:


Increment number of records . . . . . . .:
Maximum number of increments

. . . . . . :

Record capacity . . . . . . . . . . . . . .:
Coded character set identifier

. . . . . . : CCSID

Initial number of records . . . . . . .:


Increment number of records . . . . . .:
Maximum number of increments
Current number of increments

. . . . . :

10000
1000
499
509000
273
10000
1000
499

. . . . . . :

Record capacity . . . . . . . . . . . . .:

509000

Current number of records . . . . . . . .:

Number of deleted records . . . . . . . .:

Starting journal receiver for


apply . . .:

Member . . . . . . . . . . . . . . . . . . :
MBR

PRINT1
Member level

identifier . . . . . . . . .:

1121019191550

Member creation
date

. . . . . . . . . . :
Text 'description'

10/19/12
. . . . . . . . . . . : TEXT

GENERATED
Expiration date for member
EXPDATE

. . . . . . . :

*NONE
Member

size

SIZE

PRINTER DDS RLU

Initial number of
records . . . . . . .:

10000

Increment number of
records . . . . . .:

1000

Maximum number of
increments

. . . . . :

499

Current number of increments

. . . . . . :

Record capacity . . . . . . . . . . . . .:

509000

Current number of records . . . . . . . .:

66

Number of deleted records . . . . . . . .:

Record Format
List
Record

Format

Level
Format

Fields

QRPGLESRC

Length

112

Identifier

2A4BA13FFF687

Text . . . . . . . . . . . . . . . . . . .
:
Total number of
formats

. . . . . . . . . . :

Total number of
fields . . . . . . . . . . .:

Total record
length

. . . . . . . . . . . . :

112

Member
List
SourceCreation
Change

Deleted

Last

Member

Size

Type Date

Date

Time

ds
ACCOUNT

8192 PF

19:15:50

10/19/12 10/19/12

Text: ACCOUNT RELATED


INFORMATION
PRINT1
19:17:53

16384 PRTF
66

10/19/12 10/19/12

Text: PRINTER DDS RLU GENERATED


PRINT1PGM
19:15:50

8192 RPGLE

15

10/19/12 10/19/12

Text: rpgle program for


print1
Total number of
members

. . . . . . . . . :

Total number of members not


available

. . :

Total
records

. . . . . . . . . . . . . . :

89

Total deleted
records

. . . . . . . . . . :

Total of member
sizes

. . . . . . . . . . :

32768

Note: The information can be filtered based on the TYPE


attribute:

*MBR,*ACCPTH,*MBRLIST,*RCDFMT,*MBR.

Records

Recor

DSPFD FILE(IROBO1/QRPGLESRC) TYPE(*MBRLIST)

Display Spooled
File
File

. . . . . :

QPDSPF

D
Control . .. .
.
Find

. . . . .

.
*...
+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8....+.
12/31/12

DisplayFile

Description
DSPFDCommand
Input
File
FILE

. . . . . . . . . . . . . .. . . . . :

QRPGLESRC
Library . . . . . . . . . . . . . . . . . :

1
Type ofinformation . . . . . . . . . . . . :
TYPE

*MBRLIST
Fileattributes . . . . . . . . . . . . . . :

FILEATR

*ALL
System

SYSTEM

. . . . . . . . . . . . .. . . . . :

*LCL
FileDescription

Header
File
FILE

. . . . . . . . . . . . . .. . . . . :

QRPGLESRC

IROBO

Library. . . . . . . . . . . . . . . . . . :

IROBO

1
Type
offile

. . . . . . . . . . . . . . .:

Physical

Filetype . . . . . . . . . . . . . . . . . :
FILETYPE

*SRC
Auxiliary storage pool

ID . . . . . . . . . :

00001

MemberList

SourceCreation
Change

Last

Deleted
Member

Size

Type Date

Date

Time

Records

cords
ACCOUNT
19:15:50

8
Text:

8192PF

10/19/12 10/19/12

16384PRTF

10/19/12 10/19/12

ACCOUNT

RELATEDINFORMATION
PRINT1
19:17:53

66
Text:

PRINTER DDS

RLUGENERATED
PRINT1PGM
19:15:50

8192RPGLE
15

Text:

10/19/12 10/19/12

rpgle program

forprint1
Totalnumber of
members

. . . . . . . . .:

Totalnumber of members not


available

. .:

Totalrecords

0
. . . . . . . . . . . . . .:

9
Totaldeleted
records

. . . . . . . . . .:

Re

Total ofmember
sizes

. . . . . . . . . . :

32768

Physical file

It is a file which. Contains the data in predefined structured format.

Its type PF. By using CRTPF command to create PF.

Maximum number of fields included in a PF is 8000.

Maximum no of key fields included is 120.

The structure of the PF is given below:


PHYSICAL FILE INTERNAL STRUCTURE

TYPE SPECIFIC ATTRITIBUTE

TYPE INDEPENDENT ATTRIBUTE

RECORD FORMAT

KEYED ACCESS PATH

RECORDS

TYPE SPECIFIC ATTRIBUTE: Specific to its type

TYPE INDEPENDENT ATTRIBUTE: Creation date, author, size, expiration detail


KEYED ACCESS PATH: An area within a physical file obj where key field data is
stored in the order along with their RRN

Levels of entries in physical file


Columns . . . :
EM/DDSSRC

71

Browse

AMIN

SEU==>
ACCOUNT
FMT PF .....A..........T.Name++++++RLen++TDpB......Functions++++++++++
++++++++
*************** Beginning of data *****************************

0001.00
LEVEL
0002.00
FORMAT LEVEL

UNIQUE

R ACCOUNT

>>>>> FILE

>>>>> RECORD

0003.00

ACLEVELID

2P 0

0004.00
LEVEL

ACORGCOD

3P 0

0005.00

ACCOUNTNUM

12P 0

0006.00

ACCURRENCY

3A

0007.00

ACNAME

0009.00

K ACLEVELID

0010.00
LEVEL

K ACORGCOD

0011.00

K ACCOUNTNUM

>>>>> FIELD

20A

>>>>> KEYFIELD

0012.00

K ACCURRENCY

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

I.

File level entries (optional): File level entries give the system
information of the entire file. UNIQUE, LIFO, FIFO, FCFO, REF are the keywords
used at file level.
UNIQUE: A record cannot be entered or copied into a file if its key value is
same as the key value of a record already existing in the file.
FIFO: The duplicate key records will retrieved in first in first out order.
LIFO: The duplicate key records will retrieved in last in first out order.
FCFO: The duplicate key records will retrieved in first changed first out
order.
REF: This keyword is used to specify the name of the file from which
the fields are taking definition.

II.

Record format level entries: For a PF the record format name is


specified along with an optional text description. The record level entries can
be FORMAT, TEXT.
FORMAT:
This record-level keyword specifies that the record format being define is
to share the field specifications of a previously defined record format. The
name of the record format being defined must be the name of the
previously defined record format.
The format of this keyword is:
FORMAT (LIB-NAME / FILE-NAME)

TEXT:
This record level keyword is used to supply a text description of the record
format and it is used for

documentation purposes only.

The format of this keyword is:

TEXT (description)

III.

Field level entries: The field names and field lengths are specified along
with and optional text description for each field. (ALIAS, ALWNULL, CCSID, CHECK,
CHKMSGID, CMP, COLHDG, COMP, DATFMT, DATSEP, DFT, EDTCDE, EDTWRD,
REFFLD, REFSHIFT, TEXT, TIMEFMT, TIMESEP, VALUES, VARLEN)

IV.

Key field level entries: The field names used as key fields are
specified. (DESCEND, SIGNED, ABSVAL, UNSIGNED, ZONE, NOALTSEQ, DIGIT)

File level keywords FIFO, LIFO, FCFO

FIFO: The duplicate key records will retrieved in first in first out order.
LIFO: The duplicate key records will retrieved in last in first out order.
FCFO: The duplicate key records will retrieved in first changed first out order.
When the FIFO, FCFO, or LIFO keyword is not specified, no guaranteed
order is specified for retrieving records with duplicate keys.
No specific order for duplicate key fields allows more access path sharing,
which can improve performance.

Arranging duplicate keys:


If you do not specify the Unique (UNIQUE) keyword in data description specifications
(DDS), you can specify how the system stores records with duplicate key values.
You specify that records with duplicate key values are stored in the access path in one of
the following ways:
Last-in-first-out (LIFO): When the LIFO keyword is specified, records with duplicate key
values are retrieved in LIFO order by the physical sequence of the records. Here is an
example of DDS using the LIFO keyword.

LIFO

R REC2

K EMPNO

Assume that a physical file has the FIFO keyword specified (records with duplicate keys are
in FIFO order), and that the following table shows the order in which records were added to
the file.
Order in which records
were added to file

Key value

The sequence of the access path is FIFO, with ascending key values.

Records 3 and 4, which have duplicate key values, are in FIFO order. That is, because record
3 was added to the file before record 4, it is read before record 4.

This would become apparent if the records were


read in descending order. This can be done by creating a logical file based on this physical
file, with the DESCEND keyword specified in the logical file.
The sequence of the access path is FIFO, with descending key values.
Record number

Key value
access order

If the key value of physical record 1 is changed to C, the sequence of the access path for the
physical file is FIFO, with ascending key values.
Record number

Key value
access order

Finally, changing to descending order, the new sequence of the access path for the logical file
is FIFO, with descending key values.
Record number

Key value
access order

After the change, record 1 does not appear after record 4, even though the contents of the key
field were updated after record 4 was added.
The FCFO order of records with duplicate key values is determined by the sequence of
updates made to the contents of the key fields. In the preceding example, after record 1 is
changed such that the key value is C, the sequence of the access path is FCFO, with
ascending key values only.
Record number

Key value
access order

File level keywords REF


USE OF REFERENCE

Columns . . . :

71

Browse

AMINE

M/DDSSRC
SEU==>
REFER
FMT PF .....A..........T.Name++++++RLen++TDpB......Functions++++++++++
++++++++
*************** Beginning of data
*************************************
0002.00

0003.00

RAC1

2P 0

COLHDG('LEVEL ID')

0004.00

RAC2

3P 0

COLHDG('ORG CODE')

0005.00

RAC3

12P 0

NUM')

R REF

COLHDG('ACCOUNT

0006.00

RAC4

3A

COLHDG('ACCOUNT

RPOSTCODE

2P 0

COLHDG('POST

RCOUNTRY

3P 0

COLHDG('COUNTRY

0009.00

RNAME

0010.00

RDATE

CURRENCY')
0007.00
CODE')
0008.00
CODE')
20A

COLHDG('NAME')

3P 0

COLHDG('DATE')

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


****************************************

Now we can refer the file REFER to take the field definition in the new
file.

Columns . . . :

71

Browse

AMINEM/DDSSRC

SEU==>

USEREF

FMT PF .....A..........T.Name++++++RLen++TDpB......Functions+++++++++++++++++
+
*************** Beginning of data *************************************
0002.00

0003.00

R USEREF

0004.00

ACCLVL

REFER) >>>>>>

REF(REFER)

REFFLD(RAC1

field name and

0005.00

ALIAS(ACC_LVL_ID)

d file name

0007.00

ACCORG

REFFLD(RAC2

REFER)
0008.00
0009.00
0010.00

ALIAS(ACC_ORG_CODE)
A

ACCNUM

REFFLD(RAC3 REFER)
ALIAS(ACC_NUM)

referre

0011.00

ACCCUR

0012.00
0013.00

REFFLD(RAC4 REFER)
ALIAS(ACC_CUR)

ACCNAME

0014.00

REFFLD(RNAME REFER)
ALIAS(ACC_NAME)

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

Both(COLHDG & ALIAS) are used to identify fields. COLHDG & ALIAS is the
Description of fields. The difference is that in ALIAS we can access data based on
that ALIAS name, while COLHDG is not allowed. Suppose in PF field name as
DES78, give ALIAS as Description78, then user can access data from using
Description78.

Related Command
Create Physical File (CRTPF)
CRTPF FILE(AMITNEM/OBJ) SRCFILE(AMINEM/QDDSSRC) SRCMBR(OBJ_SRC)

The above command is similar to taking option-14 against the source member in member
PDM(WRKMBRPDM).

If there is any data in the physical file and you are using CRTPF/option-14, then all the
data in the physical file will be lost.

Change Physical File (CHGPF)

CHGPF FILE(AMITNEM/OBJ) SRCFILE(AMINEM/QDDSSRC) SRCMBR(OBJ_SRC)

If you dont want to lose the data, but you want to compile the source member, then you
can achieve this by CHGPF command.

We generally use CHGPF to change the attribute which are highlighted below.

Change Physical File


(CHGPF)

Type choices, press


Enter.

Physical
file

. . . . . . . . .
Library

Name

. . . . . . . . . . .

*LIBL

Name, *LIBL,

*CURLIB
System . . . . . . . . . . . . .

*LCL

*LCL, *RMT,

*NONE

Name,

*FILETYPE
Source file

. . . . . . . . . .

*NONE
Library

. . . . . . . . . . .

Name, *LIBL,

*CURLIB
Expiration date for member . . .

*SAME

Date, *SAME,

Maximum members

. . . . . . . .

*SAME

Number, *SAME,

Access path size . . . . . . . .

*SAME

*SAME, *MAX4GB,

*SAME

*SAME, *IMMED,

*NONE

*NOMAX

*MAX1TB
Access path maintenance
*REBLD, *DLY

. . . .

Access path recovery . . . . . .

*SAME

*SAME, *NO, *AFTIPL,

Force keyed access path

*SAME

*SAME, *NO,

*SAME

1-2147483646,

*SAME

0-32767,

Maximum increments . . . . . .

*SAME

0-32767,

30

Number, *SAME,

60

Number, *SAME,

Share open data path . . . . . .

*SAME

*SAME, *NO,

Max % deleted records allowed

*NONE

1-100, *NONE,

. . . . .

*YES

*SAME, *YES,

. . . . . . . . .

*HEX

Name, *SAME, *SRC,

*IPL
. . . .

*YES
Member
size:
Initial number of records

. .

*NOMAX, *SAME
Increment number of records
*SAME

*SAME

Maximum file wait time . . . . .


*IMMED, *CLS
Maximum record wait time . . . .
*IMMED, *NOMAX

*YES
.

*SAME
Reuse deleted records
*NO
Sort sequence
*JOB...

Bottom
F3=Exit
display
F24=More
keys

F4=Prompt

F5=Refresh

F12=Cancel

F13=How to use this

Can LEVEL CHECK ERROR occur if we do CHGPF?

It depends on the value that we have set for LVLCHK (Record format level check)
attribute.

If its value is *YES then the record format level identifier is checked when the file
is opened and if it doesnt match it throws the error.

If its value is *NO, then the record format level identifier is not checked, hence no
error.

CHGPFM

Change Physical File Member


(CHGPFM)

Type choices, press


Enter.

Physical file
MASTER

. . . . . . . . . >

Name
Library

. . . . . . . . . . . >

AMINEM

Name, *LIBL,

*CURLIB
Member . . . . . . . . . . . . . > *FIRST

Name,

*FIRST
Source type
*NONE

. . . . . . . . . .

*NONE

Name, *SAME,

Expiration date for member . . .

*NONE

Date, *SAME,

Share open data path . . . . . .

*NO

*SAME, *YES,

Text 'description' . . . . . . .

'ACCOUNT RELATED

*NONE

*NO

INFORMATION
'

Bottom
F3=Exit

F4=Prompt

F5=Refresh

F12=Cancel

F13=How to use this

display
F24=More
keys

Display file description(DSPFD)


It is used to display the details about the file.

Display file field description(DSPFFD)


It is used for listing details about individual fields.

Reorganize physical file member(RGZPFM)


We generally use RGZPFM to reuse the deleted records of a file for future insert
operation. The data in a file in inserted sequentially. If we delete some in between
records, then those freed spaces wont be used for inserting new record. Like this, the
toll of space accumulated by deleted records goes on and we cannot use them until
and unless we run RGZPFM command to reorganize the space.

Once we delete the records the relative record number of the records gets changed due
to reorganization of file.
Suppose a file is used in most of the programs based on its key value. If we want to
change the access path of this file from sequential to keyed or from one key value to
another key value, then we can go for RGZPFM.
Example:
Below records are according to arrival sequence.
ACCOUNT
000001
000002
000003
000004
000005
000006
000007
000008
000009
000010
000011
000012
000013
000014
000015
000016
000017
000018
000019

ORG
190
191
192
192
190
190
192
191
191
195
193
192
190
191
192
192
192
191
190

ACC
A00000000001
A00000000002
A00000000003
A00000000004
A00000000005
A00000000006
A00000000007
A00000000008
A00000000009
A00000000010
A00000000011
A00000000012
A00000000013
P00000000014
A00000000015
A00000000016
A00000000017
A00000000018
P00000000019

CCY
CCY
EUR
USD
TRY
INR
TRY
INR
GBP
USD
EUR
TRY
EUR
EUR
USD
INR
GBP
AZK
EUR
EUR

PARTY
P00000000001
P00000000002
P00000000003
P00000000004
P00000000005
P00000000006
P00000000007
P00000000002
P00000000001
P00000000003
P00000000005
P00000000002
P00000000009
P00000000004
P00000000010
P00000000011
P00000000017
P00000000014
P00000000015

Now we want to arrange the records according to the key value(ORG/ACC/CCY) of file
ACCOUNT. For this we set the KEYFILE = *FILE.
If we want to arrange the records based on some other key value then we can give the logical
file name containing that key value.
Reorganize Physical File Mbr (RGZPFM)
Type choices, press Enter.
Data base file . . . .
Library . . . . . .
Member . . . . . . . .
Key file:
Logical
file
.
*FILE >>>>>>>>>>>
Library . . . . .
Member . . . . . . .
Rebuild access paths .
Allow cancel . . . . .

. . . . . FILE
. . . . .
. . . . . MBR
KEYFILE
.
.
.
.
.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
. RBDACCPTH
. ALWCANCEL

> ACCOUNT
>
QGPL
> ACCOUNT
.

*YES
> *NO

Additional Parameters
Source update options

. . . . . SRCOPT

*SAME

>

After reorganizing, the records in ACCOUNT get arranged as per the key value of
ACCOUNT.
000001
000002
000003
000004
000005
000006
000007
000008
000009
000010
000011
000012
000013
000014
000015
000016
000017
000018
000019

ORG
190
190
190
190
190
191
191
191
191
191
192
192
192
192
192
192
192
193
195

ACC
A00000000001
A00000000005
A00000000006
A00000000013
P00000000019
A00000000002
A00000000008
A00000000009
A00000000018
P00000000014
A00000000003
A00000000004
A00000000007
A00000000012
A00000000015
A00000000016
A00000000017
A00000000011
A00000000010

CCY
CCY
INR
TRY
EUR
EUR
EUR
GBP
USD
EUR
USD
USD
TRY
INR
EUR
INR
GBP
AZK
TRY
EUR

PARTY
P00000000001
P00000000005
P00000000006
P00000000009
P00000000015
P00000000002
P00000000002
P00000000001
P00000000014
P00000000004
P00000000003
P00000000004
P00000000007
P00000000002
P00000000010
P00000000011
P00000000017
P00000000005
P00000000003

TO CHECK THE MEMBER OF A PHYSICAL FILE:

We give the source physical file name as the physical file for which we want to see the
member.
Work with Members Using
PDM

SYSTEM09
File

T
to

. . . . . .

ACCOUN

Library . . . .
. . . . .

AMINEM

Type options, press


Enter.
3=Copy
4=Delete
description
9=Save
13=Change text
string ...
Opt

Member

ACCOUNT
physical file

Bottom

Date
05/21/12

Position

5=Display

7=Rename

18=Change using DFU

8=Display
25=Find

Text
>>>> ACCOUNT member inside ACCOUNT

Parameters or
command
===>
_________________________________________________________________________
_______________________________________________________________________
________

keys

F3=Exit

F4=Prompt

F5=Refresh

F6=Create

F9=Retrieve

F10=Command entry

F23=More options

F24=More

Below if the data in the ACCOUNT member of file ACCOUNT.


ACCOUNT/ACCOUNT
ACLEVELID

ACORGCOD

ACCOUNTNUM

ACCURRENCY

ACNAME

000001

190

100,000,000,001

EUR

SURESH

000002

190

100,000,000,002

EUR

SHRI

000003

190

100,000,000,003

EUR

UPI

000004

190

100,000,000,004

EUR

ABHI

000005

190

100,000,000,005

EUR

AMI

000006

190

200,000,000,002

EUR

JAPY

000007

190

200,000,000,003

USD

KAPIL

000008

190

200,000,000,004

USD

TQNGO

TO ADD A NEW MEMBER TO THE FILE USING ADDPFM

PRESS F6
Add Physical File Member
(ADDPFM)
Type choices, press
Enter.
Physical file . . . . . . . . . >
ACCOUNT
Name
Library . . . . . . . . . . . >
*CURLIB

AMINEM

Name, *LIBL,

Member . . . . . . . . . . . . .

Text
'description' . . . . . . .

________

Nam

*BLANK

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

F10=Additional
F24=More

ADDPFM FILE(AMINEM/ACCOUNT) MBR(MBR2)


Member MBR2 added to file ACCOUNT in AMINEM.
STRDFU => SELECT member as MBR2 to add record in the new member.

Work with Members Using


PDM

SYSTEM09
File

T
to

. . . . . .

ACCOUN

Library . . . .
. . . . .

AMINEM

Type options, press


Enter.
3=Copy
4=Delete
description
9=Save
13=Change text
string ...
Opt

Member
ACCOUNT

MBR2
file ACCOUNT

Date

Position

5=Display

7=Rename

18=Change using DFU

8=Display
25=Find

Text

05/21/12
07/23/12

>>>>>>> New member MBR2 added to the

Bottom
Parameters or
command
===>
___________________________________________________________________________
_
_______________________________________________________________________
___________
F3=Exit

F4=Prompt

F5=Refresh

F6=Create

F9=Retrieve

F10=Command entry

F23=More options

F24=More

keys

ACCOUNT/MBR2
000001
000002
000003
000004

ACLEVELID
7
7
7
7

ACORGCOD
190
190
190
190

ACCOUNTNUM
200,000,000,001
200,000,000,002
200,000,000,004
200,000,000,005

ACCURRENCY
EUR
USD
USD
CHF

ACNAME
HIMESH
SUKIN
SANKY
PAINK

TO ADD A NEW MEMBER TO THE FILE USING CPYF

CPYF FROMFILE(AMINEM/ACCOUNT) TOFILE(AMINEM/ACCOUNT) FROMMBR(ACCOUNT) TOMBR


(MBR3) MBROPT(*ADD) CRTFILE(*NO) FROMRCD(1) NBRRCDS(3)
Member MBR3 added to file ACCOUNT in AMINEM.
3 records copied from member ACCOUNT.
MEMBER WILL BE CREATED AND RECORD WILL BE ADDED TO THIS MBR.

Work with Members Using


PDM

SYSTEM09
File

T
to

. . . . . .

Library . . . .
. . . . .

ACCOUN
AMINEM

Type options, press


Enter.
3=Copy
4=Delete
description
9=Save
13=Change text
string ...

Position

5=Display

7=Rename

18=Change using DFU

8=Display
25=Find

Opt

Member

Date

Text

ACCOUNT

05/21/12

MBR2
MBR3

07/23/12
07/23/12

>>>>>>> New member MBR2 added to the file

ACCOUNT

Bottom
Parameters or
command
===>
F3=Exit

F4=Prompt

F5=Refresh

F6=Create

F9=Retrieve

F10=Command entry

F23=More options

F24=More

keys

Copy member
PDM

1
to

NLAAB441
File

Library
. . . . .

.
.

Work

with

.
.

.
.

.
AMINEM

Type
options,
Enter.
2=Edit
3=Copy 4=Delete
5=Display
6=Print
7=Rename
8=Display description 9=Save 13=Change
module...
Opt

Member

_3_ MASTER
INFORMATION
MENUC
MENU

Members

Type

Text

PF

ACCOUNT

CLP

TO

Using

PRJ

Position

press

text

14=Compile

15=Create

RELATED
CALL

1
2
3
4

MNU0

MNUDDS

MNU0QQ

MNUCMD

OPT1_PGM

RPG

entry

pgm

to

be

called

for

option-

OPT2_PGM

RPG

entry

pgm

to

be

called

for

option-

OPT3_PGM

RPGLE

entry

pgm

to

be

called

for

option-

OPT4_PGM

SQLRPGLE

entry

pgm

to

be

called

for

option-

More...
Parameters
command
===>

keys

or

F3=Exit

F4=Prompt

F5=Refresh

F9=Retrieve

F10=Command

entry

F23=More

F6=Create
options

F24=More

Copy
Members
From
file . . . . . . . :
From
library . . . . :
Type
members.

the

To
list
library

AMINEM

file

file

name

To
. . . . .

To
Enter.

Name

PRJ1

rename

and

library

name

to

receive

PRJ1

the

Name,

copied

F4

for

AMINEM
copied

Member

New

MASTER

MASTER

member,

type

New

Name,

press

Bottom
F3=Exit

F4=Prompt

F5=Refresh

F12=Cancel

F19=Submit
batch

to

Logical file

Logical file does not occupy any memory.

One or more logical file can be derived from a single physical file.

It simply contains the record selection definition and when accessed


retrieves the records from the physical file to which it refers.

A logical file can contain up to 32 record formats.

It selects records dynamically. It cannot exist without a physical file.

We can filter the data with criteria by using select and omit command.

A logical file does not contain any data but provides the VIEWS of the
data to satisfy end-users needs.

Types of Logical file


There are two types:

1) Non-join logical file


2) Join logical file

1)

Non-join logical file


Non-join logical files can either be a simple logical file, which contains only one
record format or a multiple record format logical file, which contains more than
one Record format.
Logical files can be derived from 1 to 32 physical files and so a logical file can
have a maximum of 32 record formats.

Single record format Non-join logical file:


If a logical file is derived from single physical file it is called simple logical file.

Columns . . . :

71

Browse

AMINEM/DDSS

RC
SEU==>

MULTIFR

MT
FMT LF .....A..........T.Name++++++.Len++TDpB......Functions++++++++++++++++
++
*************** Beginning of data
*************************************
0002.00

ACCOUNT
0003.00

R
PFILE(AMINEM/ACCOUNT)

K ACCURRENCY

ACCOUNTNUM
0005.00

Multiple record format Non-join logical file:

Multiple record non-join logical files will select records from 2 or more physical files
by referring to only one logical file.
Each record format is always associated with one or more physical file.

The same PF can be used in more than one record format.

Columns . . . :
INEM/DDSSRC

71

Browse

AM

SEU==>
MULTIFRMT
FMT LF .....A..........T.Name++++++.Len++TDpB......Functions++++++++
++++++++++
*************** Beginning of data
*************************************
0002.00
ACCOUNT

R
PFILE(AMINEM/ACCOUNT)

0003.00

K ACCOUNTNUM

0005.00

K ACCURRENCY

0006.00
TRANS

0007.00

K TACCOUNT

0008.00

K TCURRENCY

R
PFILE(AMINEM/TRANS)

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


****************************************

Levels of entries in Logical file


Columns . . . :
/DDSSRC

71

Browse

AMINEM

SEU==>
FILTER
FMT LF .....A..........T.Name++++++.Len++TDpB....Functions+++++++++++
+++++++
*************** Beginning of data
*************************************
0001.0

DYNSLT

>>>>>>>>>>>>

>> File Level

0002.00
Record Level

R LOG1

FILE(AMINEM/ACCOUNT)>>>

0005.00

ACCOUNTNUM

0006.00

ACCURRENCY

0009.00

K ACCOUNTNUM

0010.00

K ACCURRENCY

S ACCOUNTNUM

CMP(GT

O ACCOUNTNUM

CMP(GT

>>>>>>>>>>>>>>>>>>>

Field Level

0011.00
100000000001)
0017.00
100000000003)

>> Selection/

A
Omission Level

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


******************************************

1. File-level entries (optional): (REFACCPTH, DYNSLT)


REFACCPTH: The access path information for this logical file is to be copied
from another PF or LF.
Format of the keyword is:

REFACCPTH (LIB name / DATABASE name)

DYNSLT: Use this file-level keyword to indicate that the selection and omission tests
specified in the file (using select/omit specifications) are done at processing time. This
keyword specifies dynamic select/omit rather than access path select/omit.
Only a Physical file contains data. Logical files just contain pointers for
processing the data in a specific sequence and/or subset of data.
When a record is added/changed/deleted in a physical file, the system has
to put a lock on it and then go out to check and update any logical files
before it can release the lock. While the amount of time to do this is hardly
measurable, it can be significant if massive batch updates are done to a
file.
If you are using the Select/Omit option in your DDS and using DYNSLT, the
above process does not need to be done at record update time.
Where this is beneficial is when your selection process includes almost all
the records in the file. Now when you process using DYNSLT, it will read all

the records in the file, but do the selection of which records to process at
that time rather than having done all the maintenance ahead of time.

Difference between access path and Dynamic select


Dynamic select occurs whenever the program reads file. But access path occurs
before the file is read (but not necessarily).

2. Record level entries (PFILE)


PFILE: The physical files containing the data to be accessed through the
Record formats being defined.
Format of the keyword is: PFILE (LIB name / PF name)

3. Field-level entries (optional)


4. Key field level entries (optional)
5. Selection/Omission level entries (optional)

SELECT / OMIT Keyword

Columns
71

.
AMINEM/EXAMPLE

Edit

SEU==> SELOMIT
FMT PF.
*************** Beginning of data *******************
0001.00

R RECSEL

0002.00

EMPNO

0003.00

EMPNAME

0004.00

5P 0
20A

K EMPNO
****************** End of data ************************

EMPNO

EMPNAME

000001 1001

SHRI

000002 1002

ABHI

000003 1003

SHRI

000004 1004

UPI

000005 1005

ABHI

000006 1006

SHRI

000007 1007

ABHI

000008 1008

UPI

000009 1009

SHRI

000010 1010

UPI

****** ******** End of report

Columns

********

71

.
AMINEM/EXAMPLE

Edit

SEU==> SELOMILF
FMT LF...
*************** Beginning of data *********************
0001.00

R RECSEL

PFILE (SELOMIT)

0002.00

K EMPNO

0003.00

S EMPNO

CMP (GT 10003)

0004.00

O EMPNAME

CMP (EQ 'SHRI')

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

EMPNO
000001 1002

EMPNAME
ABHI

000002 1004

UPI

000003 1005

ABHI

000004 1006

SHRI

000005 1007

ABHI

000006 1008

UPI

000007 1009

SHRI

000008 1010

UPI

****** ******** End of report

Columns

********

71

.
AMINEM/EXAMPLE

Edit

SEU==> SELOMIT
FMT PF.
*************** Beginning of data *******************
0001.00

R RECSEL

0002.00

EMPNO

0003.00

EMPNAME

0004.00

5P 0
20A

K EMPNO
****************** End of data ************************

EMPNO

EMPNAME

000001

20

SHRI

000002

30

RAM

000003

40

JYOTI

000004

50

AMI

000005

60

SHRI

000006

70

SHRI

000007

80

JYOTI

000008

90

JYOTI

000009

100

SHAMNT

****** ******** End of report

Columns
71

.
Edit

SEU==> SELOMILF1
FMT LF

********

.
AMINEM/EXAMPLE

*************** Beginning of data ************************


0001.00

R RECSEL

PFILE (SELOMIT1)

0002.00

K EMPNO

0003.00

S EMPNO

CMP (GT 50)

0004.00

S EMPNAME

VALUES ('SHRI')

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

EMPNO

EMPNAME

000001

20

SHRI

000002

60

SHRI

000003

70

SHRI

000004

80

JYOTI

000005

90

JYOTI

000006

100

SHAMNT

****** ******** End of report

2)

********

Join logical file

A join-logical file is a logical file that combines two or more PF. i.e. master +
transactional record.

A PF cannot be changed through a JLF.

DFU cannot be used to display a JLF.

Only one record format can be specified in a JLF.

Commitment control cannot be used with a JLF.

Key fields must be fields defined in the join record format and must be
fields from the PRIMARY FILE.

Entries in join logical file:


1. File-level entries (optional): (JDFTVAL)
2. Record-level entries: (JFILE)
3. join-level entries (JOIN, JFLD, JDUPSEQ)
4. fieldlevel entries (optional): (JREF, ALL, CONCAT, DYNSLT, RENAME, SST,
TRNTBL)
5. Key field level entries (optional)
6. Select and Omit field level entries. (Optional)

JFILE: It is similar to indicate that this is a join logical field and it must have more than 2
physical files.

JOIN: It is similar that this file level entries to be represent the position of the files .There
must one primary file and can have more than I secondary files.

JFLD: Which feels we are going to join.

JREF: Represents the primary file reference field

JDUPSEQ: This joinlevel keyword is used to specify the order in which records with
duplicate join fields are presented when the JLF is read.
The format for this keyword is:
JDUPSEQ (Sequencing field-name [*DESCEND])

This keyword has no effect on the ordering of records with unique keys.
If *DESCEND is not specified then the default is sequencing in ascending
order.

Example: JDUPSEQ (Sequencing Duplicate Objects)


Columns

71

.
AMINEM/EXAMPLE

Edit

SEU==>

1
SEQ

1
FMT PF.
*************** Beginning of data ***********************
0001.00

R SEQREC1

0002.00

EMPNO

0003.00

EMPNAME1

20A

0004.00

ADDRESS

20A

0005.00

5P 0

K EMPNO
****************** End of data **************************

EMPNO

EMPNAME1

ADDRESS

000001 10,001

BOB

23,OLD MADIWALA

000002 10,002

DANNY

50,LONG ISLAND

000003 10,003

PRINC

90,ATTUR

****** ******** End of report

Columns
71

.
Edit

SEU==>
2
FMT PF

********

.
AMINEM/EXAMPLE

1
SEQ

*************** Beginning of data****************


0001.00

R SEQREC2

0002.00

EMPNO

0003.00

EMPNAME

20A

0004.00

TEL

10P 0

5P 0

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

EMPNO

EMPNAME

TEL

000001 10,001

BOB

825,777

000002 10,001

BOB

825,999

000003 10,001

BOB

825,888

000004 10,002

DANNY

4,222,600

****** ******** End of report

Columns
71

********

.
AMINEM/EXAMPLE

Edit

SEU==>

JDFTSEQ

FMT LF
*************** Beginning of data ******************
0001.00
SEQ2)

0002.00

RECSEQ

JFILE

(SEQ1

JOIN (1 2)

0003.00
EMPNAME)

JFLD

0004.00

(EMPNAME1

JDUPSEQ (TEL)

0005.00

EMPNO

0006.00

EMPNAME1

0007.00

ADDRESS

0008.00

TEL

JREF (2)

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

EMPNO

EMPNAME1

ADDRESS

TE

L
000001
MADIWALA

10,001

BOB

23,OLD

10,001

BOB

23,OLD

10,001

BOB

23,OLD

825,777

000002
MADIWALA

825,888

000003
MADIWALA

825,999

000004
10,002

DANNY

50,LONG ISLAND

****** ******** End of report

4,222,600

********

Join DESCEND
Columns
71

.
AMINEM/EXAMPLE

Edit

SEU==>

JDFTSE

Q
FMT LF
*************** Beginning of data ***********************
0001.00
SEQ2)

0002.00

RECSEQ

JFILE

(SEQ1

JOIN (1 2)

0003.00
EMPNAME)

JFLD

0004.00
*DESCEND)

JDUPSEQ

0005.00

EMPNO

0006.00

EMPNAME1

0007.00

ADDRESS

0008.00

TEL

(EMPNAME1

JREF (2)

(TEL

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

EMPNO

EMPNAME1

ADDRESS

000001
MADIWALA

TEL

10,001

BOB

23,OLD

10,001

BOB

23,OLD

10,001

BOB

23,OLD

825,999

000002
MADIWALA

825,888

000003
MADIWALA

825,777

000004
10,002

DANNY

50,LONG ISLAND

****** ******** End of report

4,222,600

********

JDFTVAL

When this file-level keyword is used the system provides default values
for all for fields when a join to a secondary file does not produce any
records.

If this keyword is not specified a record in the primary file for which there
is no corresponding record in the secondary file is skipped.

JOIN OPEREATION FOR COMPOSITE KEY FIELD

Columns . . . :
M/QDDSSRC
SEU==>
LOGICAL
FMT

71

Browse

AMINE

*************** Beginning of data


*************************************
0003.00

A*

0004.00

DYNSLT

0005.00

JDFTVAL

0006.00

0007.00
FILE2)

R LOG1

JFILE(FILE1

0008.00
FILE2)

JOIN(FILE1

0009.00
LVLIDN2)

JFLD(LVLIDN1

0010.00
ORGCOD2)

JFLD(ORGCOD1

0011.00
ACNTNO2)

JFLD(ACNTNO1

0012.00
RECSTS2)

JFLD(RECSTS1

0013.00

LVLIDN

JREF(1)

0014.00

ORGCOD

JREF(1)

0015.00

ACNTNO

JREF(1)

0016.00

SUBCOD

JREF(1)

0017.00

MKTCOD

JREF(1)

0018.00

RECSTS

JREF(1)

0019.00

ORGCODP

0020.00

PRTYNO

0021.00
LVLIDN1

0022.00
ORGCOD1

0023.00
ACNTNO1

0024.00

K SUBCOD1

JOIN OPEREATION FOR MORE THAN 2 FILE

Columns . . . :
MINEM/PRJ1

71

Edit

SEU==>
LOGIC1
FMT LF .....A..........T.Name++++++.Len++TDpB......Functions+++++++
+++++++++++
***************
Beginning
*************************************

of

data

0001.00
0002.00
PARTYD TRANSA

LOG1

0003.00
PARTYD)

0004.00

0005.00
TRANSACT)

0006.00
ACCOUNT_NO)

0007.00

ORG

0008.00

ACC

0009.00

CCY

0010.00

PNUM

0011.00

PNAME

JFILE(
JOIN(

MASTER
MASTER

JFLD( PARTY

PNU

M)
J

JOIN(

MASTER

JFLD(

ACC

0012.00

PADDR

0013.00

TRAN_NO

0014.00

TRAN_TYPE

0015.00

TRAN_AMT

0016.00

TRAN_YEAR

0017.00

TRAN_MONTH

0018.00

TRAN_DAY

0019.00

0020.00

0021.00

ORG
ACC
CCY
******************
****************************************

End

of

data

Inner join or natural join


Inner join means the matching records in between the joining file will be selected.
Columns
71

.
.
AMINEM/EXAMPLE

Edit
SEU==>

1
JPF

01
FMT PF
***************
****************************

Beginning

0001.00

R JP1REC

0002.00

EMPNO

0003.00

EMPNAME

0004.00

K EMPNO

5S 0
20A

of

data

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

EMPNO

EMPNAME

000001 1001

SHRI

000002 1002

UPI

000003 1003

AMI

****** ******** End of report

Columns
71

********

.
.
AMINEM/EXAMPLE

Edit
SEU==>

1
JPF

02
FMT PF.
***************
***************************

Beginning

0001.00

R JP2REC

0002.00

EMPNO

5S 0

0003.00

EMPSAL

10P 2

0004.00

of

data

K EMPNO

******************
********************************

End

of

data

Display Report
EMPNO

EMPSAL

000001 1001

100.00

000002 1002

20.00

000003 1004

300.00

****** ******** End of report

Columns
71

.
Edit

********

.
AMINEM/EXAMPLE

SEU==>

JOF

ILE
FMT LF.
*************** Beginning of data ************************
0001.00
JPF02)

0002.00

JREC1

JFILE
JOIN (1 2)

0003.00
EMPNO)

JFLD

0004.00

EMPNO

0005.00

EMPNAME

0006.00

EMPSAL

0007.00

(JPF01

(EMPNO

JREF (JPF01)

K EMPNO
****************** End of data*********************

EMPNO

EMPNAME

EMPSAL

000001 1001

SHRI

100.00

000002 1002

UPI

20.00

****** ******** End of report

********

Left outer join


Left outer join all the records from primary file and matching records from the secondary
file will be selected.
Columns
71

.
Edit

.
.
AMINEM/EXAMPLE

SEU==>
UT
FMT LF.
*************** Beginning of data*********************

1
JOO

0001.00

JDFTVAL

0002.00
JPF02)

0003.00

JREC1

JFILE
JOIN (1 2)

0004.00
EMPNO)

JFLD

0005.00

EMPNO

0006.00

EMPNAME

0007.00

EMPSAL

0008.00

(JPF01

(EMPNO

JREF (JPF01)

K EMPNO
****************** End of data********************

EMPNO

EMPNAME

EMPSAL

000001 1001

SHRI

100.00

000002 1002

UPI

20.00

000003 1003

AMI

.00

****** ******** End of report

*******************

Self-join
A physical file can be joined to itself to read records that are formed by
combining two or more records from the PF itself.

Columns
71

.
AMINEM/EXAMPLE

Edit
SEU==>

1
SEJOIN

FMT PF
*************** Beginning of data ********************
0001.00

R EMP

0002.00

EMPID

0003.00

EMPNAME

5P 0
20A

0004.00

MGRID

0005.00

K EMPID

5P 0

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

EMPID

EMPNAME

MGRID

000001 10,001

SEBI JOSEPH C.

000002 10,002

PURUSHOTTAM

000003 10,003

SAMEER DIGHE

50,003

000004 10,004

SHARATA

50,004

000005 10,005

PAUL

000006 50,001

SHIVARAM

000007 50,002

GAURAV

000008 50,003

KING

90,003

000009 50,004

SAM

90,004

000010 50,005

ANIL

90,005

50,002

50,005
90,001
90,002

****** ******** End of report

Columns
71

50,001

********

.
AMINEM/EXAMPLE

Edit

SEU==> SELJOIN
FMT LF
*************** Beginning of data **************************
0001.00
SEJOIN)

0002.00

EMP

JFILE

(SEJOIN

JOIN (1 2)

0003.00
EMPID)

JFLD

(MGRID

0004.00

EMPID

JREF (1)

0005.00

EMPNAME

JREF (1)

0006.00

MANAGER

RENAME (EMPNAME) JREF

(2)
0007.00

COLHDG ('MANAGER')

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

EMPID

EMPNAME

MANAGER

000001 10,001

SEBI JOSEPH C.

SHIVARAM

000002 10,002

PURUSHOTTAM

GAURAV

000003 10,003

SAMEER DIGHE

KING

000004 10,004

SHARATA

SAM

000005 10,005

PAUL

ANIL

****** ******** End of report

********

Difference between non-join logical files and join logical


files

Non join logical file

Join logical file

We can able to insert or delete or

Insertion, updating or deletion of

update records using non-logical

records is not possible in join

file.

logical files.

DFU can be used to display non-

DFU is not available

join logical file.


1-32 record format is specified

Only one record format can be


specified

Commitment control is used

Commitment
used.

Related Command

control

cannot

be

I.
II.
III.
IV.

Add Logical File Member (ADDLFM)


Change Logical File (CHGLF)
Create Duplicate Object (CRTDUPOBJ)
Display Database Relation (DSPDBR)

Difference between physical file and logical file

Physical file

Logical file

1. Occupies the portion of memory. Its

Does not occupy any memory space.

containing data.

Does not contain any data.

2. A physical file contains one record

A logical file can contain up to 32 record

format

formats.

3.Can be exist even without LF

Cant exist without PF

4. If you delete a LF, the PF cant be

If you delete a LF, the PF cant be

deleted

deleted

5.CRTPF command is used to create

CRTLF command is used to create such

such object

type object

Вам также может понравиться