Using IBM i? Need to create Excel, CSV, HTML, JSON, PDF, SPOOL reports? Learn more about the fastest and least expensive tool for the job: SQL iQuery.
I get an error while running a SQLRPGLE program that uses SQL statements on files that are not journaled. i don't want to journal the files. Is there a way to use these files in SQLRPGLE without journalling.
Add the following as the first sql statement in your program (I put it right after the d- or i-specs and before the Main Processing c-specs:
exec sql set option DatFmt = *iso,
Commit = *none,
CloSqlCsr = *endmod;
The DatFmt makes sure that all sql workfields can contain a 4-digit year, the default is 2-digit year, which limits the allowable date range to 1940-01-01 thru 2039-12-31. Commit gets around your issue of "needing" to have files journalled. And the last closes open cursors when the module closes (usually end of program).
I use this. I prefer the *ENDACTGRP so the any ODP's have a chance of being reused (so runs faster) on the 3rd call.
Exec SQL
Set Option
Commit = *NONE,
Naming = *SYS,
DLYPRP = *YES,
CLOSQLCSR = *ENDACTGRP, // Reuse ODP !
DATFMT = *ISO,
TIMFMT = *HMS,
USRPRF = *OWNER,
DYNUSRPRF = *OWNER ;
Chris Ringer
Yeah, we've not hit this with our site standards yet. The ones I've included so far are the ones that have caused me grief (grief = helpdesk calls). I might take your list and throw that against the wall for site standards and see what sticks.
The key line in both of those was the Commit = *NONE, which can also be done on the CRT* command.
The other possibility is to do it on the individual statements with an isolation clause, as in UPDATE blah blah WITH NC.