Stored Procedures in DB2/400

Help Desk
Why do we need to write stored procedures on the AS/400 when we already have the application program and the dataabse both integrated into the system.

Answer Wiki

Thanks. We'll let you know when a new response is added.

Stored procedures, although useful and resoutceful, aren’t for every scenario just like prototyping ILE isn’t for every scenario. It depends on the circumstances and objectives of the project at hand. Stored procedures are very resourceful especially in client/server type applications, where all the processing will be done on the AS/400; with a simple SQL call to the stored procedure, you can process information, display tables, etc., and get it using the HLL (High Level Language) you want. Just because something is popular, however, doesn’t mean that it is the method of choice for every business requirement.


You create stored procedures because that’s the facility that the SQL uses to call program functions. It’s like asking why you need to code a prototype to call a procedure in C — that’s how the C language is defined. If you can find SQL that can make CALLs to something other than stored procs, share it here.

If you aren’t using SQL to make cross-platform calls, then don’t create stored procs. You won’t be calling them.

Note that DB2 on your AS/400 will allow SQL stored proc calls to programs even if a stored proc definition has not been registered. This can only work if the stored proc doesn’t have output parameters that must be returned to the calling platform. IOW, you don’t always have to “write stored procedures”.


Discuss This Question: 1  Reply

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • Mihirjhaveri
    Hi The stored procedure, is used mostly when backend processing of data , takes place in AS/400. For e.g. Billing Information: This can be viewed in the green screen via the application This can be viewed on the web This can alos be viewed via another interface application. All the above three show the same information. So this case the business uses the stored procedure to make it work faster, use ILE concepts too. But again, the usage of stored procedure , is upto each project manager and his team and this purely depens on the techincal resource of the team memebers. I personally feel, if stored procedures used in rigth way, makes plenty of differcence in client-server enviroment. For e.g. If using stored procedure, the information to view Billing took 14 seconds to appear. After implementing Stored procedure , it takes us now 2 seconds. So it is purely the business requirement & resoirce capabilities. But stored procedures will be used more and more down the line in the coming years.
    0 pointsBadges:

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.


Share this item with your network: