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

are there any useful c runtime apis that I can call from rpg iv?

0 Answers   IBM,


am 2010 passed out . can any one tell me which course is good to put 2+fake .guide me

1 Answers  


give an eg of ACQ-(ACQUIRE),BIT OFF,BIT ON,DEALLOC,DUMP,FEOD,FORCE,MHHZO,MHLZO,MHLLZO,MLHZO,REL,RESET,TESTZ,TESTB,TESTN----GIVE SMALL EXAMPLE TO THE OPCODES...TO UNDERSTAND FUNCTIONING...........

0 Answers   CTS,


Can we trigger an rpg program which has user interaction with display file when updating a file using the command ADDPFTRG?

2 Answers  


CAN WE READ RECORDS WITHOUT USING SETLL,READ,CHAIN IN RPG?

6 Answers   Satyam,






How to index LF by relative record no (RRN)

1 Answers  


Maximum how many files declare in rpgle

3 Answers   TCS,


steps for debugging two rpg programs????

4 Answers  


I have 1000 records in a file. I would like to generate 10 identical reports from this record with same format (structure of records) how do I do this?

1 Answers   IBM,


1. If my rpg program has a date field, What extra care I have to take while compiling that RPG program? 2. If the file is keyed and I have declared the file as well as Key list properly in my program. Still am getting an error message like "Chain/reade operation is not allowed" What may be the case?

6 Answers   Virtusa,


can anyone say,what is the use of operation extended H/N/P?

2 Answers  


1.Are there any errors in the following statement?If so then list them.DTAARA is a data area having a field EMP # and EMPNO is a field in the file EMPPF.Which has one record. READ EMPPF IF %FOUND(EMPPF) IN DTAARA EVAL EMP#=EMPNO OUT DTAARA ENDIF

5 Answers  


Categories