1) How to define keyed file in CL pgm.
2) How can i read particular records in CL pgm from
database file.

Answers were Sorted based on User's Feedback



1) How to define keyed file in CL pgm. 2) How can i read particular records in CL pgm from databa..

Answer / prabhas

1. Using DCLF command
2. OVRDBF with Position parameter
DCLF FILE(&FILENAME)

OVRDBF FILE(&FILENAME) POSITION(*KEY 1 FMT2 X'123F')

The system searches for a record from the record format
FMT2.
A single key field is used in the search (even though the
key value may have more key fields).
The record contains the hexadecimal value 123F (the
hexadecimal equivalent of packed decimal value 123.0). You
get this record when it is found.

Is This Answer Correct ?    22 Yes 0 No

1) How to define keyed file in CL pgm. 2) How can i read particular records in CL pgm from databa..

Answer / svankipu

See
1. In DCLF command u can declare a keyed-PF or an LF(having
desired keys)

2. In OVRDBF command u have an attribute called KEYFLD,
wherein u can mention the key-field of the above file.

Then you can use POSDBF command to position the PF or LF &
read it using RCVF command.
That's it!

Is This Answer Correct ?    5 Yes 4 No

Post New Answer

More RPG400 Interview Questions

What is the purpose of PUTOVR keyword?

2 Answers  


How can a screen field that has changed since the last output operation be detected?

4 Answers   IBM,


How would display prime numbers using CL program?

0 Answers   Hexaware,


1.I Have a physical file , i want to read the data from the each and every member of the File in the CL Program.How do you achieve this. 2.How do you do the same in RPG?. do think is it possible to read data from all the members in the RPG?

2 Answers   Cap Gemini,


What is the difference between iter and do?

0 Answers  






i have 1000 records in pf.what are all the ways to read a particular name records in rpg?? ie.. in pf i have a name called demo appeared around 52 times hw will we read this particular records in rpg/400?.

11 Answers   IBM,


WHERE DO WE USE COMIT KEYWORD IN AN RPG PROGRAM? YOU MADE SOME CHANGES TO DATABASE BUT YOU DON'T WANT TO SAVE THOSE CHANGES NOW? HOW DO YOU HANDLE THIS ONE?

2 Answers  


What is the OPEN and CLOSE accesspath?

3 Answers   CTS,


program to find the number of objects used in a given program through a display.

2 Answers   IBM,


1.If *HIVAL SETGT is used what opcode is used to read a record? A:READ B:READPE C:CHAIN D:READP 2.How to pass numeric parameter to the rpg pgm from the command line? 3.What keyword is used on the rpg 4 definition specification to rename a subfile in an externally definition data structure? A:RENAME B;LIKE C:EXTNAME D:EXTFLD

4 Answers   Manhattan,


Maximum how many files declare in rpgle

3 Answers   TCS,


What are the types of identifiers?

0 Answers  


Categories