Using Procedures

The code example in this section shows a procedure that spells out a number. The sample program for printing checks uses this procedure. When printing checks, you normally need to spell out the dollar amount.

In the spell.inc code example, the assumption is that the checks are preprinted and that the program has to print only items such as the date, name, and amount.

SQR procedures that contain variables that are visible throughout the program are called global procedures. These procedures can also directly reference any program variable.

In contrast, procedures that take arguments, such as the spell_number procedure in the check printing sample program in this section, are local procedures. In SQR for PeopleSoft, any procedure that takes arguments is automatically considered local.

Variables that are introduced in a local procedure are readable only inside the spell.inc procedure. This useful feature avoids name collisions. The spell_number procedure is in an include file because you may want to use it for other reports.