Follow Our FB Page << CircleMedia.in >> for Daily Laughter. We Post Funny, Viral, Comedy Videos, Memes, Vines...


can i use unique key in LF

Answers were Sorted based on User's Feedback



can i use unique key in LF..

Answer / venkat

The format of this keyword is:
UNIQUE[(*INCNULL | *EXCNULL)]The parameter is optional. When specified, it determines whether null key values cause duplicates. *INCNULL is the default and indicates to include null values when determining duplicates. *EXCNULL, when specified, indicates to exclude null values when determining duplicates.
When a logical file based on a physical file has the UNIQUE keyword, the physical file member or members cannot have duplicate key values.

When you specify the UNIQUE keyword for a physical or logical file, you must specify the MAINT(*IMMED) parameter value on the Create Physical File (CRTPF) or Create Logical File (CRTLF) command that creates the file. This means that the access path is maintained immediately when changes are made.

If you do not specify the UNIQUE keyword, records with duplicate key values are sequenced in the order you specify. If you specify the FIFO keyword, they are sequenced in first-in first-out order. If you specify the LIFO keyword, they are sequenced in last-in first-out order. If you specify the FCFO keyword, they are sequenced in first-changed first-out order. If you do not specify FIFO, LIFO or FCFO, the order in which the records are sequenced is not guaranteed.

You cannot specify the UNIQUE keyword with the FIFO, LIFO, FCFO, or REFACCPTH keywords.

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

|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
00010A*
00020A* SAMPLE LOGICAL FILE (CUSMSTL)
00030A*
00040A UNIQUE
00050A R CUSREC PFILE(CUSMSTP)
00060A TEXT('Logical File Master Record')
00070A CUST
00080A NAME
00090A ADDR
00100A K CUST

Is This Answer Correct ?    1 Yes 0 No

can i use unique key in LF..

Answer / ravi kumar

Hi,

Yes. When Pf doesn't contain duplicate records based on key value then we can use UNIQUE keyword in logical file. If pf contain Duplicate values then LF will not compile.


I have tried in this scenario

Is This Answer Correct ?    1 Yes 0 No

can i use unique key in LF..

Answer / sravan

Yes you can use unique key in logical files.

Is This Answer Correct ?    2 Yes 4 No

Post New Answer



More RPG400 Interview Questions

How to change the name of physical members Dynamically?

1 Answers  


How can we override a file during runtime in RPG? Without using OVRDBF or calling a CL program

1 Answers   UST,


1) How to retrieve RRN through RPG ? 2) How to pass parameter by value ? 3) How to trap the error through the RPG/400

10 Answers   IBM, Tech Mahindra,


1.How to load Records of a Physical file(PF) in the reverse order, in CL program?

2 Answers   Cap Gemini,


If record-format name in an externally-described file has already been defined as a file-name.how to solve this?

2 Answers   CTS,






what is file information data structure?

1 Answers   IBM,


suppose i i am changing / updating record of subfile and i want to change the record in reverse order . means i want to change the bottom record first and so on through readc . how i do it please any one explain .

4 Answers   CSC,


how do u find whether a record is locked or not??

4 Answers   CTS,


Suppose i am having 3 programs PgmA,pgmB,pgmC and using source debugger. At debugging time i found that pgmC having some code error..then in debug mode directly how can i debug pgmC

2 Answers  


what are the parameters of jobd?give in detail.&what are the parameters of subsystem...????

1 Answers   CTS,


suppose we have 10 members in physical file and i have to use 4 out of 10 so how can we read this in RPG

3 Answers   TCS,


list down and describe the sub systems vailable

5 Answers   IBM,






Categories