Using Embedded SQL on Very Large Files
From: Bruce Duty To: All
We are trying to use embedded SQL in an RPG program to update a multimillion record file. When I execute an SQL update statement in an RPG program, I get the message CPF5079 ("commitment control resource limit exceeded") and my database is not updated.
I've tried coding a WHENEVER SQLERROR CONTINUE statement with COMMIT HOLD after the UPDATE statement and looping until SQLCOD = 0, but apparently this particular error is not being recognized as an SQLERROR.
How can I limit the number of updates performed so I don't exceed the resource limit (or otherwise get around the 30,000 record limit)? I tried using WHERE COUNT(*) <=30000 in the update statement, but I got a syntax error.
From: James Coolbaugh To: Bruce Duty
Is there a reason you must use commitment control on your file update program? If not, you can compile the program with COMMIT(*NONE). This will allow your program to run without having commitment control active. Your file will still be journaled.
If you need commitment control, you will have to set up your program to read the file. The basic steps would be:
DEFINE CURSOR OPEN CURSOR FETCH (this gets the next record) UPDATE WHERE CURRENT OF... Count your records, at some point issue a COMMIT. Continue reading until end of file.
This is the general idea of how to read a file via SQL. The UPDATE WHERE CURRENT OF is how you can update the record just read. You might also specify on your SELECT statement the FOR UPDATE OF clause to indicate which fields are going to be updated.
Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.
IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn:
LATEST COMMENTS
MC Press Online