Using Embedded SQL in RPGLE or Creating SQL Functions

Richard Schoen <richard-DiTrGpQEJGItADg8e/3/[email protected]> Sat, 21 Mar 2026 14:47:09 +0000
Newsgroups gmane.comp.lang.as400.rpg
Message-ID <[email protected]>
Another interesting philosophy question.

When embedding SQL calls in RPG I have seen two schools of thought.

-Embed your SQL processing into your RPG code.

-Embed you SQL processing into the DB itself: Stored Process/SQL Functions, etc…. and call those from RPG.

Personally I like putting my SQL logic into my RPG code as it’s much more debuggable whereas I don’t think it’s simple to debug SQL stored procedures and functions.

In other words I try to keep the actual access logic as simple as possible and put business logic in re-usable code. I generally call the the business layer.

I do this similarly in other languages.  And generally I haven’t replied a lot on stored procedures in any language or database. I put all my DB and business logic in separate modules.

I’m just curious what other here favor when writing their RPG logic.  Embedded SQL in RPG or using Sprocs/Functions and keep your RPG dumb as a stump/simplified :-)

Regards,
Richard Schoen
Web: http://www.richardschoen.net
Email: [email protected]


-- 
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: [email protected]
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: [email protected]
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact [email protected] for any subscription related questions.