Scope of Objects and Variables

The scope of an object is determined when it is typed (i.e., declared). The object name should not be N[ewed] as this function is managed by the PSL compiler.

Example 1

Unacceptable:

new crcd
type RecordCRCD crcd = Db.getRecord("CRCD","CO=:CO,CRCD=:XCRCD")

Acceptable:

type RecordCRCD crcd =
Db.getRecord("CRCD","CO=:CO,CRCD=:XCRCD")

Example 2

Unacceptable:

new rs
type ResultSet rs = Db.select("TSEQ","HIST","CID<:CID")

Acceptable:

type ResultSet rs = Db.select("TSEQ","HIST","CID<:CID")

 

For additional guidelines concerning the scope of objects and variables, refer to the following sections:

Object Names

Object Scope in PSL

Non-Object Reference Variable Scope in PSL

Variable Scope in PSL

Literal Scope Variables

Methods Supported for Literal Scope Variables

When Standard is Enforced: Profile v7.0