Support for Scoped Variables in Embedded SQL

Article ID: 57786

If you're using the Embedded SQL Precompiler for ILE RPG on 5.4, you'll be pleased to know that IBM released PTFs to provide support for variable scoping. Without these PTFs, you'll have to run IBM i 6.1 to take advantage of this feature.

What is variable scoping? Well, RPG lets you declare subprocedure variables that have the same name as variables declared at the global level or variables declared in other subprocedures. Even though they have the same name, they're different variables and can have different types and lengths. These variables are considered separate because they're in a different "scope."

Although RPG has supported scoped variables since 3.2, the embedded SQL precompiler didn't understand them and would get confused. This problem was fixed when variable scoping support was added to the SQL precompiler in IBM i 6.1, and with these newly released PTFs, it's also fixed in V5R4.

IBMer Gina Whitney announced this support at the RPG Cafe. You can read her message and get details of the PTFs you'll need.

ProVIP Sponsors

ProVIP Sponsors