+ All Categories
Home > Documents > Dds Lab Pf Exercise-20120716

Dds Lab Pf Exercise-20120716

Date post: 07-Nov-2014
Category:
Upload: gavallapalli
View: 23 times
Download: 3 times
Share this document with a friend
Description:
Lab Exercise
Popular Tags:
18
DDS Programming Exercise Physical File INDEX Exercise Number Description Page Number 1 Create a physical file EMPMST with key field EMPCDE 3 2 Create a physical file DEPTMST with key field DEPID, MGRID 4 3 Create a field description file FLDREF 5 4 Create a physical file EMPMST1 referring FLDREF 6 5 Create a physical file EMPMST1.A referring file FLDREF 7 6 Create a physical file EMPMST2 using the FORMAT keyword 8 7 Create a physical file using file level keywords (UNIQUE, FIFO, LIFO,FCFO) 9 8 Create a physical file 10 1
Transcript
Page 1: Dds Lab Pf Exercise-20120716

DDS Programming Exercise

Physical File

INDEX

Exercise Number Description Page Number

1 Create a physical file EMPMST with key field EMPCDE

3

2 Create a physical file DEPTMST with key field DEPID, MGRID

4

3 Create a field description file FLDREF

5

4 Create a physical file EMPMST1 referring FLDREF

6

5 Create a physical file EMPMST1.A referring file FLDREF

7

6 Create a physical file EMPMST2 using the FORMAT keyword

8

7 Create a physical file using file level keywords (UNIQUE, FIFO,

LIFO,FCFO)

9

8 Create a physical file using key field level keywords (ABSVAL,

DESCEND)

10

9 Create a physical file using field level

keywords(CHECK(AB,ME,MF,LC)

11

10 Create a physical file using field level keywords (RANGE, COMP,

VALUES, CHKMSGID)

12

11 Create a physical file using field level keywords(EDTCDE,

EDTWRD)

13

12 Create a physical file using field 14

1

Page 2: Dds Lab Pf Exercise-20120716

level keywords(DATFMT, DATSEP, TIMFMT, TIMSEP)

13 Create a physical file using field level keywords(ALWNULL,

ALIAS, DFT, VARLEN)

15

14 Create a physical file INVHDR, with INVNO has key field.

16

15 Create a physical INVDTL with INVNO and INVLNO has key field.

1. Create a physical file EMPMST with the following fields and key field empcde. Exercise instructions_____1. In this exercise you are going to write a PF EMPMST in your library that includes all the

fields Specify below.

Field name Length Data type

EMPCDE 5, 0 Zoned

EMPNAM 30 Alphanumeric

EMPDOB - Date(L)

EMPDEP 2 Alphanumeric

EMPSAL 11, 2 Packed

EMPAD1 25 Alphanumeric

EMPAD2 25 Alphanumeric

EMPAD3 25 Alphanumeric

EMPHN 14, 0 Zoned

EMTRDT - Date (L)

EMTRTM - Time(T)

EMTUSR 10 Alphanumeric

_____2. Create a DDS for the EMPMST with the following record formats specifications of the record formats name is EMPREC.

_____3. Define employee code as the key field.

_____4. Compile EMPMST and check for no compilation errors.

2

Page 3: Dds Lab Pf Exercise-20120716

2. Create a physical file DEPMST with the following fields and key field DEPID & MGRID.

Exercise instructions_____1. In this exercise you are going to write a PF DEPMST in your library that includes all the

fields Specify below.

Field name Length Data type

DEPID 2 Alphanumeric

DEPNM 20 Alphanumeric

MGRID 5, 0 Zoned

_____2. Create a DDS for the DEPMST with the above fields.

_____3. Define DEPID and MGRID as the key fields.

_____4. Compile DEPMST and check for no compilation errors.

Most Common Error: Not specifying Record format

3

Page 4: Dds Lab Pf Exercise-20120716

3. Create a field reference file FLDREF in your library and include all the fields which are defined in EMPMST.

Exercise instructions

_____1. In this exercise you are going to write a PF FLDREF in your library that includes all the fields which one defined in EMPMST.

_____2. Create a DDS for the FLDREF with the following fields.

Field name Length Data type

EMPCDE 5, 0 Zoned

EMPNAM 30 Alphanumeric

EMPDOB - Date(L)

EMPDEP 2 Alphanumeric

EMPSAL 11, 2 Packed

EMPAD1 25 Alphanumeric

EMPAD2 25 Alphanumeric

EMPAD3 25 Alphanumeric

EMPHN 14, 0 Zoned

EMTRDT - Date (L)

EMTRTM - Time(T)

EMTUSR 10 Alphanumeric

_____3. Compile FLDREF and check for no compilation errors.

Most Common Error: Not specifying Record format

4

Page 5: Dds Lab Pf Exercise-20120716

4. Create a PF EMPMST1 by referring all the fields from fields reference file FLDREF.

Exercise instructions

_____1. In this exercise you are going to write a PF EMPMST1 in your library by referring all fields from FLDREF.

_____2. Create a DDS for the PF EMPMST1 by referring all fields in the field reference file FLDREF.

_____3. Define employee Code as the key field.

_____4. Compile the PF EMPMST1 and check for no compilation errors.

Most Common Error: Not specifying Record format

5

Page 6: Dds Lab Pf Exercise-20120716

5. Create a PF EMPMST1.A by referring the fields using REFFLD

Exercise instructions

_____1. In this exercise you are going to write a PF EMPMST1.A in your library by referring all fields from FLDREF.

_____2. Create a DDS for the PF EMPMST1.A by referring all the fields from FLDREF other than EMPDEP and using REFFLD refer to EMPDEP from DEPMST.

_____3. Define employee code as the key field.

_____4. Specify COLHDG for all fields in EMPMST1.A

_____5. Compile the PF EMPMST1.A and check for no compilation errors.

Errors: * CPD5248 30 1 Message . . . . : File specified on REF or REFFLD keyword not found. * CPD5252 30 1 Message . . . . : Field not found in file specified on REF or REFFLD.Mismatch in File Specified and Field Name specified in EMPMST1.A

Reference: REFFLD & REF:http://pic.dhe.ibm.com/infocenter/iseries/v7r1m0/index.jsp?topic=%2Fdds%2Fspecref.htmCOLHDG:http://publib.boulder.ibm.com/html/as400/v4r5/ic2979/info/db2/rbafpmst58.htm

Question: While recompiling it says “Object L_EMPMST1A in PMS243 type *FILE deleted”. What is the reason?

6

Page 7: Dds Lab Pf Exercise-20120716

6. To create a PF EMPMST2 with the similar format of EMPMST and define EMPNAM as the key.

Exercise instructions

_____1. In this exercise you are going to write a PF EMPMST2 in your library that includes all the fields of EMPMST and define EMPNAM as the key.

_____2. Create a DDS for the EMPMST2. Define employee name as the key field.

_____3. Compile EMPMST2 and check for no compilation errors.

Errors: CPD5246 30 1 Message . . . . : Not allowed to use indicated object.CPD7901 30 1 Message . . . . : Record name not found in file specified on FORMAT keywordCause: The record name must be the same as a record name in the file specified on the FORMAT keyword.Recovery: Either change the file name specified on the FORMAT keyword, or changes the record name in the file. Then try the request again.

Reference: http://publib.boulder.ibm.com/infocenter/iadthelp/v7r0/index.jsp?topic=/com.ibm.etools.iseries.langref2.doc/rzakb/rzakbmstlfkeyw.htm

Note: Used FORMAT Keyword to copy the field level details from EMPMST to EMPMST2

Question: Is UNIQUE Keyword Mandatory when using FORMAT Keyword?

7

Page 8: Dds Lab Pf Exercise-20120716

7. Create PF’s ( EMPMST3, EMPMST4, EMPMST5, EMPMST6 ) with file level keywords UNIQUE, FIFO, LIFO, FCFO

Exercise instructions

_____1. In this exercise you are going to include file level keywords UNIQUE, FIFO,LIFO,FCFO

UNIQUE – Select records of unique key value.FIFO – See whether records are arranged in first in first out order when duplicate key values are specifiedLIFO – See whether records are arranged in last in first out order when duplicate key values are specifiedFCFO – See whether records are arranged in first changed first out order when duplicate key values are specifiedCreate a DDS for the file EMPMST3, EMPMST4, EMPMST5, EMPMST6 with file level keywords UNIQUE, FIFO, LIFO, (FCFO Test level is not work properly) with similar format of EMPMST.

_____2. Compile EMPMST3, EMPMST4, EMPMST5, EMPMST6 and check for no compilation errors.

Note: Have a KEYFIELD in all the above files to check if the KEYWORDS are working properly

Reference: UNIQUE:http://publib.boulder.ibm.com/html/as400/v4r4/ic2924/info/db2/rbafpmst137.htmFCFO:http://publib.boulder.ibm.com/infocenter/iseries/v5r3/index.jsp?topic=%2Frzakb%2Frzakbmsttdfcfo.htm

Note: FCFO not working……

8

Page 9: Dds Lab Pf Exercise-20120716

8. Create a PF EMPMST7 include key field keywords ABSVAL, DESCEND

Exercise instructions

_____1. In this exercise you are going to include key field keywords ABSVAL, DESCEND.

_____2. Create a DDS for the file EMPMST7 which is based on EMPMST3 with the following record formats specifications. In EMPMST7, define employee id as the key field.

_____3. In EMPMST7, specify EMPSAL as key field and use DESCEND. When you specify DESCEND keyword check whether employee salary are listed in descending order.

_____4. Specify ABSVAL for the EMPSAL field in PF. When you specify ABSVAL, check whether absolute value is obtained. Specify DESCEND and ABSVAL and see whether records are arranged with ABSVAL and descending order.

_____5. Compile EMPMST7 and check for no compilation errors.

9. Create a PF EMPMST8 with field level keywords CHECK(MF), CHECK(ME), ``CHECK(AB), CHECK(LC) .

9

Page 10: Dds Lab Pf Exercise-20120716

Exercise instructions

_____1. In this exercise you are going to include field level keywords CHECK(AB), CHECK(MF) , CHECK(ME).

_____2. Create a DDS for the file EMPMST8 with the fields referring from EMPMST. Specify the following keywords.

_____3. Check for EMPDEP field for CHECK(ME) – Field must be entered mandatorily CHECK(MF) – Mandatory fill of the particular field. CHECK(AB) – Allow blanks.

[_____4.] Check for EMPNAM field for CHECK(LC) This field level is function in display file with dds level.– For changing to lower case letters.

_____4.[_____5.] Compile EMPMST8 and check for no compilation errors.

10. Create a PF EMPMST9 with field level (Validation) keywords (RANGE, COMP, VALUES, CHKMSGID).

10

Page 11: Dds Lab Pf Exercise-20120716

Exercise instructions

_____1. In this exercise you are going to include field level keywords RANGE, COMP, VALUES, CHKMSGID.

_____2. Create a DDS for the file EMPMST9 with the fields referring from EMPMST. Specify the following keywords.

[_____3.] Specify RANGE of values ( 2000 5000) Depends on the empsal with datatype it will work accurately. to EMPSAL and select. Specify VALUES keyword for EMPDEP field as ’IT’,’AD’,’HR’,’QA’,’QC’.

_____3.[_____4.] Specify COMP keyword for the field EMPCDE to the employee records having EMPCDE greater than 0.

_____4.[_____5.] Specify CHKMSGID for the field EMPDEP. Specify the first message level text ‘Enter valid department.’ Check whether the error message works.

_____5.[_____6.] Compile EMPMST9 and check for no compilation errors.

11. Create a PF EMPMST10 with field level (Formatting) keywords (EDTCDE, EDTWRD).

11

Page 12: Dds Lab Pf Exercise-20120716

Exercise instructions

_____1. In this exercise you are going to include field level keywords EDTCDE, EDTWRD.

_____2. Create a DDS for the file EMPMST10 referring fields from EMPMST. Specify the following keywords.

_____3. Specify EDTCDE for EMPSAL field. Specify edit code J for suppressing zeros.

_____4. Specify EDTWRD for EMPPHN field (‘bbbb-bb-bbbbbbbb‘). (Country code-Area number-Phone number).

_____5. Compile EMPMST10 and check for no compilation errors.

12. Create a PF EMPMST11 with field level keywords (DATFMT, DATSEP, TIMFMT, TIMSEP).

12

Page 13: Dds Lab Pf Exercise-20120716

Exercise instructions

_____1. In this exercise you are going to include field level keywords DATFMT, DATSEP, TIMFMT, TIMSEP.

_____2. Create a DDS for the file EMPMST11 referring field from EMPMST. Specify the following keywords.

_____3. Specify DATFMT for the field EMPDOB as *DMY and DATSEP as ‘-’ and TIMFMT for the field EMTRTM as *HMS and TIMSEP as ‘.’.

_____4. Compile EMPMST11 and check for no compilation errors.

13. Create a PF EMPMST12 with field level keywords (ALIAS, DFT, VARLEN).

13

Page 14: Dds Lab Pf Exercise-20120716

Exercise instructions

[_____1.] In this exercise you are going to include field level keywords ALWNULL It is not work output level., ALIAS, DFT, VARLEN.

_____1.[_____2.] Create a DDS for the file EMPMST12 referring fields from EMPMST. Specify the following keywords.

_____2.[_____3.] Set ALWNULL for EMPSAL. When you specify ALWNULL, allows null value in the field.

_____3.[_____4.] Specify ALIAS name ie EMP_NAM to field EMPNAM..

_____4.[_____5.] Specify DFT values for EMPDEP as ‘IT’.

_____5.[_____6.] Specify VARLEN for EMPNAM field. Length must be 10.

_____6.[_____7.] Compile EMPMST12 and check for no compilation errors.

14. Create a physical file INVHDR with the following fields and key field INVNO.

Exercise instructions

_____1. In this exercise you are going to create a PF INVHDR in your library that includes all the fields given below.

14

Page 15: Dds Lab Pf Exercise-20120716

_____2. Create a DDS code for the file INVHDR with the following specifications. Specify INVNO as keyfield.

Field name Length Data type

INVNO 7,0 Zoned

INVDT - Date(L)

CUSCDE 5,0 Zoned

INVAMT 13,2 Packed

_____3.Compile INVHDR and check for no compilation errors.

15. Create a physical file INVDTL with the following fields and key field INVNO, INVLNO.

Exercise instructions:

_____1.In this exercise you are going to create a PF INVDTL in your library that includes all the fields given below.

_____2.Create a DDS code for the file INVHDR with the following specifications. Specify INVNO, INVLNO as key field.

15

Page 16: Dds Lab Pf Exercise-20120716

Field name Length Data type

INVNO 7,0 Zoned

INVLNO 3,0 Zoned

INVITMNO 5,0 Packed

INVQTY 3,0 Packed

INVRAT 11,2 Packed

INVAMNT 13,2 Packed

_____3.Compile INVDTL and check for no compilation errors.

16


Recommended