currentSchema (EGL system variable)

If you set the useCurrentSchema build descriptor option to YES, EGL adds the sqlLib.currentSchema system variable to specific table names in the SQL code it generates. In this way you can use unqualified table names in EGL record properties and #sql directives, and provide the qualification at runtime.

Use of the sqlLib.currentSchema variable has the following restrictions:

EGL takes the initial value of sqlLib.currentSchema from the vgj.jdbc.schema Java runtime property. The vgj.jdbc.schema property in turn takes its value from the sqlSchema build descriptor option (if the genProperties build descriptor option is set to PROGRAM or GLOBAL).

Include any separator characters in the variable string; see the examples later in this topic.

Use in debug

Host systems typically allow you to use unqualified table names and set the schema in different ways depending on the system. On iSystem, you can find the table by searching the library list for a library (which is the schema ) that contains the named table. On z/OS®, the schema is usually determined at BIND time by including the QUALIFIER option on the BIND statement with the appropriate schema name. You can simulate this in EGL by setting the useCurrentSchema build descriptor option to YES and the sqlSchema build descriptor option to the name of the test schema you use for debugging. This means you can generate COBOL code from the same SQL statements you tested in the EGL debugger.

A second benefit is that developers typically test their code against a schema (or an entire database) that they use exclusively for testing. By using the sqlLib.currentSchema variable, you can avoid accessing your real data until you have completed all your testing. Then you can simply change the value of the sqlSchema build descriptor option and regenerate your code without having to change your SQL.

Example

In the following example, different environments demand different formats for schemas.

if(sysVar.systemType is ZOSCICS)
  // here the variable is a schema
  sqlLib.currentSchema = "TESTSCHEMA.";
else 
  if(sysVar.systemType is ISERIESJ)
    // here it's a user library
    sqlLib.currentSchema = "TESTSCHEMA/";
  end
end

Feedback