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?.
Answers were Sorted based on User's Feedback
Answer / deepak daswani
You can use READE opcode in dow while loop to read aal the
records of PF which is 'demo'.
Because everytime cursor reads the next value in the file.
Is This Answer Correct ? | 13 Yes | 1 No |
What u can do is u can create a non join LF over the PF and
give the Select clause for that field like this:
S FLD1 COMP(EQ 'demo')
And now u can use this LF in your program.
Is This Answer Correct ? | 11 Yes | 1 No |
Answer / swetha p rao
If the particular field value is demo , then you can do
onething to avoid reading the file unnecesarily
1. Declare a temporary file in user open mode and specify
as external mbr in F spec.
2. In CPYF there is an option to include records (INCREL )
based on selection, just copy all the records where the
field value is 'demo' in a temporary file with a create
file option. (using QCMDEXC)
3.Now the temporary file will have only demo records.Open
the file and read the records.
(or)
Using SQLRPGLE, write a query to select the records which
has field value 'demo'
Correct me if iam wrong
Is This Answer Correct ? | 4 Yes | 0 No |
Answer / sudhir
to escape from creating a new object of LF(if its not a
permanent requirement) you can use OPNQRYF to select
whichever records you want like:
OPNQRYF FILE((FILENAME)) QRYSLT('(FIELDNAME *EQ "demo")')
hope you got your answer
Is This Answer Correct ? | 5 Yes | 2 No |
Answer / swetha
that wud again create an object, What if the requirement
changes evrytume.then the LF wud not be useful
Is This Answer Correct ? | 1 Yes | 1 No |
Answer / prasanna
In the RPG code, Move the value demo to the field and do a
reade on the file
Is This Answer Correct ? | 2 Yes | 2 No |
Answer / jeganath
Go for ReadE i.e Read Equals,
give 'Demo' in Factor 1
'Demo' ReadE
it will fetch records equals 'Demo' string in the file, and
also it avoid unnecessary reading of other records, very
effective,
Note: it works only when that field is declared as key in
PF file
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / rajgoaj
Can it be done by using group function on a SQLRPG?
Is This Answer Correct ? | 0 Yes | 2 No |
Answer / rajkalyanam
Say Physical file name is PF001 and Field name is NAME
and i want to select all records having their name as DEMO
then i will use SQLRPG,please correct me if i'm wrong
Select * from PF001 where name = 'DEMO'
Is This Answer Correct ? | 0 Yes | 2 No |
HOW TO DELETE THE RECORD FROM MASTER FILE WHICH IS LINK BY ANOTHER TRASATION FILE WITH REFERTIAL INTYGRITY?
Mr.Yallamanda Reddy P thanks for your answer sir,can we use test(D) opcode in RPG/400,if yes please help me by eloborating on that answer by writing a sample code for that sir
how can we can we the data decimal error?how can we open such file in support
how to change the length of the field in a physicalfile?
1.what are the ARITHMETIC EXPRESSIONS IN CL PGM? 2.How to PASSING PARAMETER TO CL PGM?
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?
What hapens when we use CPYF command to copy a LF? On which PF will it be dependent???
suppose i i am changing / updating record of subfile and i want to change the record in reverse order . means i want to change the bottom record first and so on through readc . how i do it please any one explain .
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.
what are the types of identifers
Can somebody tell me that, Is it possible to read all the member of PF without OVRDBF?
How to declare the more than one file in cl/400.