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
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 |
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 |
RPG/400 faqs?
1.Coding in cl to send an message? 2..What is turnover and use? What are the different levels?
What is the difference between iter and do?
what is program status data structure?
in rpg could u please tell me errors types and meanings like 3030 that ....
I have one cl program which calls two rpg programs named a & b. I am loading a run time array in Pgm A and the control comes back to cl pgm. i call pgmb and I want to read the runtime array in pgmb which was loaded in pgma. How it can be acheived. I should not use any intermediate file or dataarea to store the loaded values.
Anybody know the difference of primary file and full procedural file
Suppose in CL we reach at end of file and again we have to reach from 1 record
what is use of sflnxtchg and use of MDT(modify data tag).both r same r not and can we use these on dspf and subfile.
How can you determine the number of characters in a variable?
In case if I want to know whether a record exists in a file, which one do you prefer CHAIN or a SETLL and why ?
We have a Physical file, after reading 5 records,it has to read LF of that same Physical file,Will it start reading from Ist record or will start reading from 5th record?