Professional Documents
Culture Documents
Logical Files:
Logical File:
A logical file is provide access the data stored in one or more physical files. The features unique to
logical files include the following:
1. Logical files do not contain data.
2. Access one or more physical files in an arrival sequence or in any single or multiple field (key)
value order.
3. A physical file may be processed by any number of logical files.
4. Two or more logical files may share the same access path.
5. Omit and select criteria may be specified in a logical file to process only the required physical
file data.
6. A logical file may include multiple record formats. Each format however must relate to one or
more physical files and include at least one key field.
7. One logical file with multiple record formats may process only the required physical file data.
8. A logical file with multiple record formats may be used to process the data from more than one
physical file. The file record formats accessed may be of different lengths.
9 During processing a physical file’s field attributes may be changed by a logical file. However,
the data stored in the physical file not be modified.
Logical files may be specified as either nonjoin or join. A nonjoin logical file processes each record
individually from one or more physical files. Join logical files however create a single record from the
selected fields from two or more physical files.
The type of logical file (nonjoin or join) specified is determined in the related DDS coding. In the
following text, the processing logic and DDS syntax for nonjoin logical files are introduced first,
followed by the coding requirements associated with join logical files.
Non-join logical files may specify more than one record format. If two or more physical files with
different record formats are to be used by a logical file, separate PFILE keywords must be specified.
When the record formats are the same, only one PFILE keywords is required. A maximum of 32
physical files may be referenced in one PFILE keyword.
When two or more physical files with a logical file accesses different record formats. *NONE may be
specified as a key field substance for any of the following conditions:
1. The related keyfields from the physical files do not have the same attributes.
2. The key fields from the physical files have the same attributes, but they are not to be merged
and sequenced together.
Specify the entries in the following order to define a simple or multiple format logical file:
1. File-level entries (optional)
2. Record-level entries
S R CHOWDARY
WORK WITH LOGICAL-FILE
How to create simple logical file? Create student pf file as discussed above. Like physical file create
logical file as shown below. Press ‘F6’ &
IN NEXT STEP YOU HAVE TO WRITE SOURCE TYPE AS ‘LF’ & SOURCE MEMBER –
Bottom
F3=Exit F4=Prompt F5=Refresh F12=Cancel F13=How to use this display
F24=More keys
S R CHOWDARY
WORK WITH LOGICAL-FILE
AFTER TYPING ‘IPLF’ AS SHOWN ABOVE USER GETS THE FOLLOWING PROMPT
Enter reference file using ‘PFILE(FILE NAME)’ function key as well as record format name
as shown below :
S R CHOWDARY
WORK WITH LOGICAL-FILE
Press F3 and use option 14 to compile the above file and create object in BIZLIB and
Runqry command for above logical file gives following output:
Display Report
Report width . . . . . : 39
Position to line . . . . . Shift to column . . . . . .
Line ....+....1....+....2....+....3....+....
ROLL SNAME CCD CORS ADD CITY
000001 101 sneha vv VB pune pune
000002 102 ramesh hh C mumbai mumbai
000003 103 titu iii AS mumbai pune
000004 104 rahul AS400 VB pune pune
****** ******** End of report ********
Bottom
F3=Exit F12=Cancel F19=Left F20=Right F21=Split
Reference file name and key field gives all field from related physical file. But in logical file user is able
to select particular field as shown below. Just insert the required field name as per above define
sequence:
S R CHOWDARY
WORK WITH LOGICAL-FILE
Bottom
F3=Exit F12=Cancel F19=Left F20=Right F21=Split
Also you are able to define multiformat logical file as shown below:
S R CHOWDARY
WORK WITH LOGICAL-FILE
S R CHOWDARY
WORK WITH LOGICAL-FILE
Display Report
Report width . . . . . : 21
Position to line . . . . . Shift to column . . . . . .
Line ....+....1....+....2.
ROLL NO SNAME CORS
000001 101 sneha vv
000002 102 ramesh hh
000003 103 titu iii
000004 104 rahul AS400
****** ******** End of report ********
Bottom
F3=Exit F12=Cancel F19=Left F20=Right F21=Split
S R CHOWDARY
WORK WITH LOGICAL-FILE
Display Report
Report width . . . . . : 21
Position to line . . . . . Shift to column . . . . . .
Line ....+....1....+....2.
ROLL NO SNAME CORS
000001 103 titu iii
000002 104 rahul AS400
****** ******** End of report ********
Bottom
F3=Exit F12=Cancel F19=Left F20=Right F21=Split
Like that we are able to use range and value keyword with logical file. Now use of
omits keyword with logical file.
S R CHOWDARY
WORK WITH LOGICAL-FILE
Output of above ‘omit’ keyword is as shown below see it using RUNQRY command on
command line.
Display Report
Report width . . . . . : 21
Position to line . . . . . Shift to column . . . . . .
Line ....+....1....+....2.
ROLL NO SNAME CORS
000001 100 ABC AS400
000002 101 sneha vv
****** ******** End of report ********
Bottom
F3=Exit F12=Cancel F19=Left F20=Right F21=Split
You can use this k/w on one field & one file as shown below
S R CHOWDARY
WORK WITH LOGICAL-FILE
Display Report
Report width . . . . . : 21
Position to line . . . . . Shift to column . . . . . .
Line ....+....1....+....2.
ROLL NO SNAME CORS
000001 101 SNEHA VV
000002 103 titu iii
****** ******** End of report ********
Output of this keyword is where roll number having value 102 gets omitted.
S R CHOWDARY
WORK WITH LOGICAL-FILE
Display Report
Report width . . . . . : 21
Position to line . . . . . Shift to column . . . . . .
Line ....+....1....+....2.
ROLL NO SNAME CORS
000001 101 sneha vv
000002 103 titu iii
****** ******** End of report ********
Bottom
F3=Exit F12=Cancel F19=Left F20=Right F21=Split
S R CHOWDARY
WORK WITH LOGICAL-FILE
CUSTM
No. Field Name Length Data Type Key Description
1 CPHONE 10,0 P K Customer Phone No
2 CLNAME 10 A Customer Last Name
3 CFNAME 10 A Customer First
Name
4 CADDR 20 A Customer Address
5 CBILL 6,2 P Customer Billing
Amount
6 COWED 6,2 S Amount Owned
7 CPYDT 6,0 S Payment Date
8 STATUS 1 A Customer Status
CUSTM
CUSTM Field Name Length Data Key Description
No. Type
1 CPHONE 10,0 P K Customer Phone No
2 CAMPD 6,2 P Amount Paid
3 CDTRC 6,0 P Date received
1. Create a logical file CUSTML1 over CUSTM keyed on Payment date and select those records
where address is Pune (Using COMP).
2. Create a logical file CUSTML2 over CUSTM and select the records with bill amount ranging from
1000.00 to 9999.99 (Using RANGE).
3. Create a logical file CUSTM3 over CUSTM and the records with status equal to (‘A’ or ‘I’)
active/inactive (using VALUES).
4. Create a logical file CUSTML4 over CUSTM and rename the field COWED to AMTOD and update
the data using the file.
5. Check all the logical files associated with CUSTM using command DSPDBR.
6. Create a Join logical file over CUSTM and CTRANS joined on CPHONE and arrange the duplicate
records according to Amount Paid.
7. Create a field reference file and use its reference to create a physical file CUSTM1.identical to
CUSTM
8. Add a physical file member to file CUSTM using command ADDPFM. Add data to it.
S R CHOWDARY