The SQR Language

This section provides an overview of the SQR language and discusses:

  • SQR program structure.

  • SQR syntax conventions.

  • Rules for entering SQR commands.

SQR is a specialized programming language for accessing, manipulating, and reporting enterprise data. With SQR, you build complex procedures that perform multiple calls to multiple data sources and implement nested, hierarchical, or object-oriented program logic.

SQR provides several important benefits:

  • Flexibility and scalability.

  • Comprehensive facilities for combined report and data processing.

  • Multiple platform availability.

  • Multiple data source compatibility.

With SQR, you design reports by defining the page size, headers, footings, and layout. SQR enables you to generate a variety of output types, such as complex tabular reports, multiple page reports, and form letters. You can display data in columns; produce special formats, such as mailing labels; and create HTML, PDF, or configured output for laser printers and phototypesetters.

The high-level programming capabilities of SQR enable you to add procedural logic and to control data source calls. You can use SQR to write other types of applications, such as those for database manipulation and maintenance, table loading and unloading, and interactive querying and displaying.

SQR for PeopleSoft processes source code from a standard text file and generates a report. The text file containing source code comprises a set of sections that you delimit with BEGIN-section and END-section commands. The following examples show the general structure of SQR:

  • The SETUP section describes overall characteristics of the report.

     {setup commands}...
  • The HEADING and FOOTING sections specify what information is printed in the header and footing on each page of the report.

    BEGIN-HEADING {heading_lines}
     {heading commands}...
    BEGIN-FOOTING {footing_lines}
     {footing commands}...
  • The PROGRAM section runs the procedures in the report.

  • The PROCEDURE section performs the tasks to produce the report.

    BEGIN-PROCEDURE {procedure_name}
     {procedure commands}...

The following table describes the SQR syntax conventions:

Syntax Convention


{ }

Braces enclose required items.

[ ]

Square brackets enclose optional items.


Ellipses indicate that the preceding parameter can be repeated.


A vertical bar separates alternatives inside brackets, braces, or parentheses.


An exclamation point begins a single-line comment that extends to the end of the line. Each comment line must begin with an exclamation point.


A single quote starts and ends a literal text constant or any argument with more than one word.

Important! If you are copying code directly from the sample programs, change the slanted quotes to regular quotes as shown here, otherwise you will receive an error message.


A comma separates multiple arguments.

( )

Parentheses must enclose an argument or element.


SQR commands and arguments are uppercase within the text, but lowercase in the sample programs. (Note that these commands are not case-sensitive.)


Information and values that you must supply appear in variable style.

hyphen versus underscore

Many SQR commands, such as BEGIN-PROGRAM, contain a hyphen, whereas procedure and variable names contain an underscore. Procedure and variable names can contain either hyphens or underscores, but you should use underscores in procedure and variable names to distinguish them from SQR commands.

This practice also prevents confusion when you mix variable names and numbers in an expression in which hyphens could be mistaken for minus signs.

Use these command rules as you develop SQR programs:

  • You can enter SQR commands in either uppercase or lowercase; they are not case-sensitive.

    Many SQR programmers use uppercase for SQR commands, but SQR ignores case as it compiles source code.

  • You must separate command names and arguments by at least one space or tab character.

  • You must begin each command on a new line; however, you can develop commands that extend beyond one line.

  • You can break a line in any position between words except inside a quoted string.

  • You can use a hyphen (-) at the end of a line to indicate that it continues on the next line; however, SQR ignores hyphens and carriage returns in commands.

  • You must begin each comment line with an exclamation point (!).

Note: To display the exclamation point (!) or single quote (') symbols in a report, type the symbol twice to indicate that it is text. For example, DON'T is typed DON''T. This rule does not apply in the document paragraph of form-letter reports.