65 pts.
 RPGIV Coding Approach for 1 billion records
I have 1billion records in a PF.Key filed  is Date.I want to generate a report based on Key field.Which approach will be best for me (I mean shall i go with OVRDBF or any other approach)Please suggest.(RPGIV-Free Format-V5R4)

Software/Hardware used:
ASKED: October 5, 2011  7:21 AM
UPDATED: March 31, 2012  12:38 AM

Answer Wiki:
I would use SQL. If you need to do it within an RPG program, imbed the SQL to do the record select.
Last Wiki Answer Submitted:  October 5, 2011  12:47 pm  by  CharlieBrowne   33,695 pts.
All Answer Wiki Contributors:  CharlieBrowne   33,695 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

Thanks allot for your suggestion.But We can’t use SQL in this so need a help in RPGIV coding.

 65 pts.

 

Is this a job that will be run more than once?
Is there already a logical file with the key defined?

If not you may consider creating one. This may take a long time due to the file size.
Either that or try using an OPNQRYF to select only the records you need.

 4,115 pts.

 

You can imbed and run SQL code in an RPG program.
Source type is SQLRPGLE
Here is a sample

c/exec sql                                                            
c+ insert into STMTIDXDB                                              
c+ (CUNUM, SYSTEM, PRN, AGENT,  ACCOUNT#, STMTTYPE,                   
c+                    STATEMENT_DATE, STATEMENT_DATA)                 
c+ values (:prCuNum, :prSys, :prPrn, :prAgt, :prAccount, :vStmtType,  
c+                    :statementDate, :vPdfFile)                      
c/end-exec
 33,695 pts.

 

Are you asking how to print a report containing a billion rows ordered by key values? Or are you asking about how to select a set of rows for a report based on a set of key values?

I’m not clear on what difference the number of rows makes nor the difference keys make. Why mention them at all unless they have significance?

Tom

 110,135 pts.

 

Tom asks…
I’m not clear on what difference the number of rows makes nor the difference keys make. Why mention them at all unless they have significance?

and I suggest “because that’s what the teacher/instructor put in the question, so that’s what’s echoed here. ”

Perhaps the student is supposed to explore and discuss the relative merits of database access algorithms apart from the practcalities of issuing a SETLL. The choice of database product could make quite a difference for high volume applications.

Good job they chose DB2 then.

 5,505 pts.

 

Thanks allot & highly appreciated to everyone-CharileBrown,ToddN200,TomLiotta & Yark.

Now Client are ready for embedded SQL so we used this & it got solve.
I try OPNQRY its also working.

 65 pts.