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 |
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 ?
what is kids-rpg?
Can anybody tell me that why we use option(*nodebugio)in H- Spec?
what is estimation? and what is the level identifier parameter in PF?
How can we override a file during runtime in rpg?
3 members in databasefile .how to read records from all the members??
What will happen if we r using seton lr after return or vice versa.
can any body correct the following code? Following a procedure which returns the maximum of two numbers.Correct the following code. P GETMAX B D GETMAX PI D NUM1 35 0 D NUM2 45 0 C IF NUM1 > NUM2 C RETURN NUM1 C ELSE C RETURN NUM2 C ENDIF P GETMAX E
1..Write an sql query to find the employee name who is having 2 phone numebr? 2.Write an sql query to the the second highest salary of the employee?
HOW TO DEBUG A BATCH JOB WHEN IT IS IN MESSAGEWAIT(MSWG) STATUS.I KNOW THE STEPS FOR BATCH DEBUGGING,BUT IM CONFUSING WITH WHEN WE SUBMIT ANY JOB FOR BATCH DEBUG WE PUT IN HELD STATE.SO HERE ALSO DO SAME THING OR ANY OTHER WAY,PLEASE HELP ME....
Thanks gagan for your answer,i'm new to as400,i don't know embedded sql in rpg.can you send me the coding for the below mentioned question in embedded sql rpg. how to retrieve particular field records from a physical file,say i have a physical file called 'employee' in it i have to retrieve the records of a field 'admin' present in pf 'employee' using rpg,but i should not use logical file or openquery file.
Write a program to display prime numbers between 1 to 100 using RPGLE.