Understanding the Heading and Footing Code Example

Here is an example of the code that is required to add a page heading and footing to a program:

Program ex2a.sqr
begin-program
   print 'Hello, World.' (1,1)
end-program
begin-heading 1
   print 'Tutorial Report' (1) center
end-heading
begin-footing 1
   ! print "Page n of m" in the footing
   page-number (1,1) 'Page '
   last-page   () ' of ' 
end-footing

The output for the ex2a.sqr program is:

Tutorial Report
Hello, World.
Page 1 of 1

Note:

The PRINT command places text in memory, not on paper. SQR for PeopleSoft always prepares a page in memory before printing it to paper, creating the body first and then the HEADING and FOOTING sections. In this example, Hello, World is run first, followed by Tutorial Report and Page 1 of 1.