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 can we make use of SETLL operation in CL?

11 Answers  


1. Which Built-In-Function will you use to achieve the following functionality? CLONO1NO2NO3 Factorl÷÷+OpcdeFactor2++÷ResultLenDHHiLoEq C QTY IFLT *ZERO C QTY MULT -1 QTY C ENDIF a) %ABS b) %TRIM c) %TRIMS d) %UNS

3 Answers   IBM,


during execution, an rpg/400 program automatically follows a sequence of operations for each record that is processed. The built-in program cycle includes the following logical steps.

0 Answers   IBM,


2. Which of the following statement(s) explains the difference(s) between the /INCLUDE and ICOPY directives? a.) No difference, they function the same b.) ACOPY cannot be used as a conditional directive c.) IINCLUDE files cannot contain embedded SQL d.) Nesting /TNCLUDE directives is not allowed

2 Answers   IBM,


i 'm new to as/400.in an interview i was asked this question.give a practical example for passing information or data through local data area. I know only that data area is an object used to store tiny bits of data or it can store one value at a time and it is used to store frequently changing values or datas.thats all i know about data area can any one tell me how local data area and user defined data area are used to pass data between jobs with a example or coding.thanks in advance.

2 Answers   CTS,






Explain mdt?

0 Answers  


what is the equivalent keyword for CHAIN opcode ??

7 Answers   TCS,


I have to change a program. This program is calling a subroutine mor than 100times within it. so will it have any performance issue? if yes than what changes i can make. Thanx for ur valuable answer.

2 Answers  


Whether a module can consists of many procedures or it can consist of subprocedures having a main procedure?If it is possible that it can contain many individual procedures than can we have different name for complete module and how do we call this module in main modul?

3 Answers   Steria,


What is Multi Occurrence Data Structure(MODS)?

1 Answers   CTS,


how can we can we the data decimal error?how can we open such file in support

1 Answers  


I am Submitting one job in batch that job calls three progams(PGMA, PGMB, PGMC). PGMB should be called after sucessfully completion of PGMA as like for PGMC also. So Can you please tell me how can we do that (without using data area)

2 Answers   CTS,


Categories