Report generation: Difference between revisions

From m204wiki
Jump to navigation Jump to search
(Automatically generated page update)
 
m (→‎Directing output to a journal/audit trail: use syntax template and mixed case)
 
(40 intermediate revisions by 5 users not shown)
Line 1: Line 1:
===Overview===
<div class="toclimit-3">
<p><var class="product">Model&nbsp;204</var> provides several report generation capabilities, including:    </p>
 
==Overview==
<p>
<var class="product">Model&nbsp;204</var> provides several report generation capabilities, including:    </p>
<ul>
<ul>
<li>Sorting output</li>
<li>Sorting output</li>
Line 6: Line 9:
<li>Directing output</li>
<li>Directing output</li>
</ul>
</ul>
====Sorted output====
<p>User Language provides the following features that allow output to be produced in sorted order: </p>
===Sorted output===
<p>
User Language provides the following features that allow output to be produced in sorted order: </p>
<ul>
<ul>
<li>IN ORDER clause--This clause can be specified on FOR EACH RECORD and FOR EACH VALUE statements in order to produce output in sorted order. See [[Record Loops#Processing records in order|Processing records in order]] for a discussion of the IN ORDER clause for the FOR EACH RECORD statement. See [[Value Loops#FOR EACH VALUE statement|FOR EACH VALUE statement]] for a discussion of the IN ORDER clause for the FOR EACH VALUE statement.</li>
<li>IN ORDER clause &mdash; This clause can be specified on FOR EACH RECORD and FOR EACH VALUE statements in order to produce output in sorted order. See [[Record loops#Processing records in order|Processing records in order]] for a discussion of the IN ORDER clause for the FOR EACH RECORD statement. See [[Value loops#FOR EACH VALUE statement|FOR EACH VALUE statement]] for a discussion of the IN ORDER clause for the FOR EACH VALUE statement.</li>
</li>
</li>
<li>SORT RECORDS and SORT RECORD KEYS statements--These statements can be used when the IN ORDER clause cannot be used to provide the order you desire. [[Sorting#Sorting|Sorting]] includes a detailed discussion of sort statements. </li>
<li>SORT RECORDS and SORT RECORD KEYS statements &mdash; These statements can be used when the IN ORDER clause cannot be used to provide the order you desire. [[Sorting#Sorting|Sorting]] includes a detailed discussion of sort statements. </li>
</li>
</li>
</ul>
</ul>
====Formatting capabilities====
<p><var class="product">Model&nbsp;204</var> provides User Language statements, commands, and parameters to allow you to control the following report formatting elements:</p>
===Formatting capabilities===
<p>
<var class="product">Model&nbsp;204</var> provides User Language statements, commands, and parameters to allow you to control the following report formatting elements:</p>
<ul>
<ul>
<li>Headings or comments</li>
<li>Headings or comments</li>
Line 30: Line 37:
</li>
</li>
</ul>
</ul>
====The PRINT statement====
<p>You use variations of the PRINT statement to perform most of the formatting capabilities described above. The PRINT statement is described in more detail throughout this chapter.</p>
===The PRINT statement===
====For additional information about formatting====
<p>
<p>[[Basic User Language Statements and Commands#Basic User Language Statements and Commands|Basic User Language Statements and Commands]] provides a discussion of these statements, which control report formatting:</p>
You use variations of the PRINT statement to perform most of the formatting capabilities described above. The PRINT statement is described in more detail throughout this topic.</p>
===For additional information about formatting===
<p>
[[Basic SOUL statements and commands]] provides a discussion of these statements, which control report formatting:</p>
<ul>
<ul>
<li>FIND AND PRINT COUNT</li>
<li>FIND AND PRINT COUNT</li>
Line 44: Line 55:
</li>
</li>
</ul>
</ul>
====Example of formatting output====
<p>The complete syntax of the PRINT statement provides several options that permit you to design quite complex formats for reports. Some of these are illustrated in this request:            </p>
===Example of formatting output===
<p>
The complete syntax of the PRINT statement provides several options that permit you to design quite complex formats for reports. Some of these are illustrated in this request:            </p>
<p class="code">BEGIN
<p class="code">BEGIN
DRIVERS:  FIND ALL RECORDS FOR WHICH
DRIVERS:  FIND ALL RECORDS FOR WHICH
Line 51: Line 64:
           STATE = MASSACHUSETTS
           STATE = MASSACHUSETTS
   END FIND
   END FIND
   PRINT ''MASSACHUSETTS DRIVERS' AT COLUMN 12
   PRINT &apos;&apos;MASSACHUSETTS DRIVERS' AT COLUMN 12
   SKIP 1 LINE
   SKIP 1 LINE
   PRINT 'POLICY NO' WITH 'NAME' AT COLUMN 15 -
   PRINT 'POLICY NO' WITH 'NAME' AT COLUMN 15 -
Line 60: Line 73:
           WITH DRIVER ID TO COLUMN 45
           WITH DRIVER ID TO COLUMN 45
   END FOR
   END FOR
END  
END
</p>
</p>
<p>The output from this request appears as:</p>
<p>
The output from this request appears as:</p>
<p class="code">          MASSACHUSETTS DRIVERS
<p class="code">          MASSACHUSETTS DRIVERS
 
POLICY NO  NAME                  DRIVER ID
POLICY NO  NAME                  DRIVER ID
 
100095      ALTON, BARBARA W      100223
100095      ALTON, BARBARA W      100223
100095      ALTON, CARRIE Y        100225
100095      ALTON, CARRIE Y        100225
Line 72: Line 86:
100095      ALTON, THOMAS V        100222
100095      ALTON, THOMAS V        100222
100095      ALTON, TIMOTHY X      100224
100095      ALTON, TIMOTHY X      100224
100096      ANCH,  EDITH X        100228    
100096      ANCH,  EDITH X        100228
</p>
</p>
====Directed output====
 
<p>The features described at the end of this chapter allow you to direct output from a User Language request. </p>
===Directed output===
<p>
The features described at the end of this page allow you to direct output from a User Language request. </p>
<table>
<table>
<tr class="head">
<tr class="head">
<th>Use <var class="product">Model&nbsp;204</var> feature...</th>
<th>Use Model&nbsp;204 feature...</th>
<th>To direct output to...</th>
<th>To direct output to...</th>
</tr>
</tr>
Line 94: Line 110:
</tr>
</tr>
</table>
</table>
===PRINT statement===
<p>The PRINT statement controls most report formatting.</p>
==PRINT statement==
<p>This section provides an overview of the PRINT statement. Specific uses of the PRINT statement are described in later sections. See also:</p>
<p>
The PRINT statement controls most report formatting.</p>
<p>
This section provides an overview of the PRINT statement. Specific uses of the PRINT statement are described in later sections. See also:</p>
<ul>
<ul>
<li>[[Basic User Language Statements and Commands#FIND AND PRINT COUNT statement|FIND AND PRINT COUNT statement]] </li>
<li><var>[[Basic SOUL statements and commands#FIND AND PRINT COUNT statement|Find And Print Count]]</var> statement</li>
<li>[[Basic User Language Statements and Commands#PRINT ALL INFORMATION (or PAI) statement|PRINT ALL INFORMATION (or PAI) statement]].</li>
<li><var>[[Basic SOUL statements and commands#PRINT ALL INFORMATION (or PAI) statement|Print All Information]]</var> (or <var>PAI</var>) statement.</li>
</ul>
</ul>
<b>Syntax</b>
<p>The basic form of the PRINT statement is provided here, followed by a discussion of the statements used in the example and several additional output features.</p>
====Syntax====
<p class="code">PRINT [[fieldname | %variable | 'string'  
<p>
The basic form of the PRINT statement is provided here, followed by a discussion of the statements used in the example and several additional output features.</p>
<p class="syntax">PRINT [[<span class="term">fieldname</span> | <span class="term">%variable</span> | '<span class="term">string</span>' | VALUE IN <span class="term">label</span> | COUNT IN <span class="term">label</span>]
[AT [COLUMN] <span class="term">n</span>] [AND | TAB | WITH] ...
[TO [COLUMN] <span class="term">n</span>] [AND | TAB | WITH] ...] ... [...]
</p>


| VALUE IN label | COUNT IN label]
===List of terms===
 
<p>
[AT [COLUMN] n] [AND | TAB | WITH] ...
A list of terms specifying what is to be printed and the placement of the printing on the line follows the statement name PRINT. Terms can be specified in any order. </p>
<p>
Each PRINT statement normally specifies one line of output. Alternatively, see [[#Continuing the PRINT statement|Continuing the PRINT statement]].</p>
===Use of keyword FIELD===
<p>
The keyword <var>FIELD</var> is required in order to print a field whose name begins with the word IMAGE, MENU, or SCREEN if the field name appears at the beginning of the PRINT statement. For example:</p>
<p class="code">PRINT FIELD SCREEN SIZE
</p>
<p>
prints the field named <code>SCREEN SIZE</code>.</p>
<p>
The keyword <var>FIELD</var> is recognized only when it is the first word after <var>PRINT</var>. <var>FIELD</var> should not be used with field names that appear elsewhere in a <var>PRINT</var> statement.   </p>


[TO [COLUMN] n] [AND | TAB | WITH] ...] ... [...]
===TO and AT column options===
</p>
<p>
====List of terms====
When using the PRINT statement in conjunction with the AT or TO column options, you cannot specify negative numbers or numbers greater than 32767 for the column. </p>
<p>A list of terms specifying what is to be printed and the placement of the printing on the line follows the statement name PRINT. Terms can be specified in any order. </p>
<p>
<p>Each PRINT statement normally specifies one line of output. Alternatively, see [[#Continuing the PRINT statement|Continuing the PRINT statement]].</p>
Procedures containing PRINT statements with negative numbers or numbers greater than 32767 fails at compile time with this counting error message:</p>
====Use of keyword FIELD====
<p>The keyword FIELD is required in order to print a field whose name begins with the word IMAGE, MENU, or SCREEN if the field name appears at the beginning of the PRINT statement. For example:</p>
<p class="code">PRINT FIELD SCREEN SIZE
</p>
<p>prints the field named SCREEN SIZE.</p>
<p>The keyword FIELD is recognized only when it is the first word after PRINT. FIELD should not be used with field names that appear elsewhere in a PRINT statement.  </p>
====TO and AT column options====
<p>When using the PRINT statement in conjunction with the AT or TO column options, you cannot specify negative numbers or numbers greater than 32767 for the column. </p>
<p>Procedures containing PRINT statements with negative numbers or numbers greater than 32767 fails at compile time with this counting error message:</p>
<p class="code">M204.0263: AT/TO MUST BE BETWEEN 1 AND 32767
<p class="code">M204.0263: AT/TO MUST BE BETWEEN 1 AND 32767
</p>
</p>  
====Continuing the PRINT statement====
<p>Normally, each PRINT statement formats one line of output. However, if a PRINT statement ends with an ellipsis (...), the next PRINT statement continues on the same output line. In this way an unlimited number of PRINT statements can apply to a single line of output.    </p>
===Continuing the PRINT statement===
<p>The first PRINT statement that does not end with an ellipsis, or SKIP or NEW PAGE statement, ends the output line. The END statement ends the output line if the last PRINT statement ends with an ellipsis.  </p>
<p>
<p>For example, the following request prints each vehicle identification number for blue Mustangs, with three spaces between each number:</p>
Normally, each PRINT statement formats one line of output. However, if a PRINT statement ends with an ellipsis (<tt>...</tt>), the next PRINT statement continues on the same output line. In this way an unlimited number of PRINT statements can apply to a single line of output.    </p>
<p>
The first PRINT statement that does not end with an ellipsis, or SKIP or NEW PAGE statement, ends the output line. The END statement ends the output line if the last PRINT statement ends with an ellipsis.  </p>
<p>
For example, the following request prints each vehicle identification number for blue Mustangs, with three spaces between each number:</p>
<p class="code">BEGIN
<p class="code">BEGIN
FIND.RECS: FIND ALL RECORDS FOR WHICH
FIND.RECS: FIND ALL RECORDS FOR WHICH
Line 138: Line 169:
END
END
</p>
</p>
<p>The output looks like:</p>
<p>
<p class="code">FOR2100547  FOR2101155      
The output looks like:</p>
<p class="code">FOR2100547  FOR2101155
</p>
</p>
===Formatting/printing headers or comments===
===Version 7.4 limitation===
====Use the PRINT statement====
<p>In Model 204 version 7.4, there is a limit of 127 on the number of fields that can be added in a PRINT statement using a subscripted variable. If you are currently adding more than this number, the following message will be issued:</p>
<p>To print out headings or comments, the PRINT statement is used with the desired phrase, which is enclosed in single quotation marks. </p>
<p class="code">M204.2840: STATEMENT HAS TOO MANY INTERMEDIATE RESULTS</p>
<p>For example:    </p>
<p>The issue has been resolved in SirMods 8.1. Therefore, the best solution for Model 204 version 7.4 is to rerun the job with a load module that includes SirMods 8.1 linked in. As of Model 204 version 7.5, SirMods is totally integrated into the Model 204 nucleus, so no special linking is required.</p>
 
==Formatting/printing headers or comments==
===Use the PRINT statement===
<p>
To print out headings or comments, the PRINT statement is used with the desired phrase, which is enclosed in single quotation marks. </p>
<p>
For example:    </p>
<p class="code">PRINT 'FIRST REPORT'
<p class="code">PRINT 'FIRST REPORT'
</p>
</p>
<p>causes <var class="product">Model&nbsp;204</var> to print:</p>
<p>
<p class="code">FIRST REPORT  
causes <var class="product">Model&nbsp;204</var> to print:</p>
<p class="code">FIRST REPORT
</p>
</p>
====Use of quotation marks====
<p>The pair of single quotation marks delineates the quoted string. Any character that appears within the quotation marks (including space) is considered part of the text to be printed. A pair of consecutive single quotation marks (<var>''</var>) embedded in quoted text reproduces a single quotation mark in the output. Thus:                 </p>
===Use of quotation marks===
<p class="code">PRINT 'WHY JOHNNY CAN''T READ'  
<p>
The pair of single quotation marks delineates the quoted string. Any character that appears within the quotation marks (including space) is considered part of the text to be printed. A pair of consecutive single quotation marks (<tt>&apos;&apos;</tt>) embedded in quoted text reproduces a single quotation mark in the output. Thus:   </p>
<p class="code">PRINT 'WHY JOHNNY CAN&apos;&apos;T READ'
</p>
</p>
<p>yields:</p>
<p>
<p class="code">WHY JOHNNY CAN'T READ  
yields:</p>
<p class="code">WHY JOHNNY CAN'T READ
</p>
</p>
<p>Quoted phrases are stored and utilized by <var class="product">Model&nbsp;204</var> with quotation marks dropped. [[Request Composition Rules#Quotation marks|Quotation marks]] provides additional information about the use of quotation marks.              </p>
<p>
===Controlling spacing on an output line===
Quoted phrases are stored and utilized by <var class="product">Model&nbsp;204</var> with quotation marks dropped. [[Request composition rules#Quotation marks|Quotation marks]] provides additional information about the use of quotation marks.              </p>
<p>The spacing of printed output can be controlled by using the connectives AND, WITH, and TAB with the PRINT statement, as described below.      </p>
 
====Connectives required for multiple outputs on one line====
==Controlling spacing on an output line==
<p>When several pieces of output are to be printed on a single line, a connective or placement phrase must follow each field name except the last. The following statements are legal:</p>
<p>
The spacing of printed output can be controlled by using the connectives AND, WITH, and TAB with the PRINT statement, as described below.      </p>
===Connectives required for multiple outputs on one line===
<p>
When several pieces of output are to be printed on a single line, a connective or placement phrase must follow each field name except the last. The following statements are legal:</p>
<p class="code">PRINT CITY WITH ', ' WITH STATE
<p class="code">PRINT CITY WITH ', ' WITH STATE
PRINT CITY AND STATE
PRINT CITY AND STATE
</p>
</p>
<p>but the statements below are not:</p>
<p>
but the statements below are not:</p>
<p class="code">PRINT CITY STATE
<p class="code">PRINT CITY STATE
PRINT '('TOTAL PREMIUM')'
PRINT '('TOTAL PREMIUM')'
</p>
</p>
====Skipping one space (AND)====
<p>When AND is used, one space is skipped before further printing. For example, if <var class="product">Model&nbsp;204</var> has retrieved a record with the field:    </p>
===Skipping one space (AND)===
<p class="code">TOTAL PREMIUM = 15,000  
<p>
When AND is used, one space is skipped before further printing. For example, if <var class="product">Model&nbsp;204</var> has retrieved a record with the field:    </p>
<p class="code">TOTAL PREMIUM = 15,000
</p>
</p>
<p>then:</p>
<p>
<p class="code">PRINT 'PREMIUM IS $' TOTAL PREMIUM AND 'PER YEAR'  
then:</p>
<p class="code">PRINT 'PREMIUM IS $' TOTAL PREMIUM AND 'PER YEAR'
</p>
</p>
<p>yields the printout:</p>
<p>
<p class="code">PREMIUM IS $15,000 PER YEAR  
yields the printout:</p>
<p class="code">PREMIUM IS $15,000 PER YEAR
</p>
</p>
<p>This statement:</p>
<p>
<p class="code">PRINT AND AND COUNT IN CT  
This statement:</p>
<p class="code">PRINT AND AND COUNT IN CT
</p>
</p>
<p>skips two spaces before printing the count.                  </p>
<p>
====Skipping no spaces (WITH)====
skips two spaces before printing the count.                  </p>
<p>When WITH is used, no spaces are skipped. For example, the statement:  </p>
<p class="code">PRINT '($' WITH TOTAL PREMIUM WITH ')'  
===Skipping no spaces (WITH)===
<p>
When WITH is used, no spaces are skipped. For example, the statement:  </p>
<p class="code">PRINT '($' WITH TOTAL PREMIUM WITH ')'
</p>
</p>
<p>yields:</p>
<p>
<p class="code">($15,000)  
yields:</p>
<p class="code">($15,000)
</p>
</p>
====WITH more efficient than AND====
<p>WITH is more efficient than AND. When a quoted string is used, WITH can replace AND by including an extra space in the string as illustrated below:</p>
===WITH more efficient than AND===
<p class="code">PRINT 'PREMIUM IS $' TOTAL PREMIUM AND 'PER YEAR'  
<p>
WITH is more efficient than AND. When a quoted string is used, WITH can replace AND by including an extra space in the string as illustrated below:</p>
<p class="code">PRINT 'PREMIUM IS $' TOTAL PREMIUM AND 'PER YEAR'
</p>
</p>
<p>can be changed to:  </p>
<p>
<p class="code">PRINT 'PREMIUM IS $' TOTAL PREMIUM WITH ' PER YEAR'  
can be changed to:  </p>
<p class="code">PRINT 'PREMIUM IS $' TOTAL PREMIUM WITH ' PER YEAR'
</p>
</p>
====Using tab stops====
<p>When TAB is used, further printing begins at the next tab stop. Tab stops normally are set to 1, 11, 21, and so on. For example, the statement:    </p>
===Using tab stops===
<p class="code">PRINT COUNT IN CT TAB PREMIUM TAB TAB MODEL  
<p>
When TAB is used, further printing begins at the next tab stop. Tab stops normally are set to 1, 11, 21, and so on. For example, the statement:    </p>
<p class="code">PRINT COUNT IN CT TAB PREMIUM TAB TAB MODEL
</p>
</p>
<p>would result in output such as:</p>
<p>
would result in output such as:</p>
<p class="code">8        392                PINTO
<p class="code">8        392                PINTO
</p>
</p>
<p>The standard spacing between successive tab stops can be changed by resetting the TABSP parameter, as described in the Rocket <var class="product">Model&nbsp;204</var> Parameter and Command Reference Manual.</p>
<p>
<p>When a TAB is specified, at least two spaces are left after the last character printed. If the last character printed ends at the next tab stop or there is only one space remaining before the next tab stop, <var class="product">Model&nbsp;204</var> automatically inserts an extra TAB. </p>
The standard spacing between successive tab stops can be changed by resetting the <var>[[TABSP parameter|TABSP]]</var> parameter.
===Specifying columns for output===
</p>
<p>The phrases AT COLUMN n and TO COLUMN n, used with the PRINT statement, provide for the left- or right-justification of output. </p>
<p>
When a TAB is specified, at least two spaces are left after the last character printed. If the last character printed ends at the next tab stop or there is only one space remaining before the next tab stop, <var class="product">Model&nbsp;204</var> automatically inserts an extra TAB. </p>
==Specifying columns for output==
<p>
The phrases AT COLUMN n and TO COLUMN n, used with the PRINT statement, provide for the left- or right-justification of output. </p>
<ul>
<ul>
<li>AT COLUMN n means that printing begins in column n.</li>
<li>AT COLUMN n means that printing begins in column n.</li>
<li>TO COLUMN n specifies that output is positioned to end in column n.</li>
<li>TO COLUMN n specifies that output is positioned to end in column n.</li>
</ul>
</ul>
<p class="note"><b>Note:</b> A placement phrase applies only to the single piece of output that precedes it in the PRINT statement and not to the entire output line. </p>
<p class="note"><b>Note:</b> A placement phrase applies only to the single piece of output that precedes it in the PRINT statement and not to the entire output line. </p>  
<b>Example</b>
<p>This request illustrates the use of placement phrases:              </p>
====Example====
<p>
This request illustrates the use of placement phrases:              </p>
<p class="code">BEGIN
<p class="code">BEGIN
FIND.RECS: FIND ALL RECORDS FOR WHICH
FIND.RECS: FIND ALL RECORDS FOR WHICH
Line 229: Line 301:
               SKIP 1 LINE
               SKIP 1 LINE
           END FOR
           END FOR
END  
END
</p>
</p>
<p>These statements produce output such as:</p>
<p>
These statements produce output such as:</p>
<p class="code">INCIDENT TYPE:        T2
<p class="code">INCIDENT TYPE:        T2
DATE OF INCIDENT:    19900222
DATE OF INCIDENT:    19900222
POLICYHOLDER:        ABBOTT, FRANKLIN G
POLICYHOLDER:        ABBOTT, FRANKLIN G  
</p>
</p>
====Using AT COLUMN n and TO COLUMN n together====
 
<p>AT COLUMN n can be immediately followed by TO COLUMN n. For example:</p>
===Using AT COLUMN n and TO COLUMN n together===
<p class="code">PRINT FULLNAME AT COLUMN 30 TO COLUMN 40  
<p>
AT COLUMN n can be immediately followed by TO COLUMN n. For example:</p>
<p class="code">PRINT FULLNAME AT COLUMN 30 TO COLUMN 40
</p>
</p>
<p>If the value of FULLNAME in this example is less than 11 characters long, trailing blanks are added. If the value is more than 11 characters, only the first 11 are printed. See the next section for more information about exceptional conditions relating to the placement of output.     </p>
<p>
===Placement of output: Exceptional conditions===
If the value of FULLNAME in this example is less than 11 characters long, trailing blanks are added. If the value is more than 11 characters, only the first 11 are printed. See the next section for more information about exceptional conditions relating to the placement of output.   </p>
<p>These conditions can affect the placement of output:</p>
 
==Placement of output: Exceptional conditions==
<p>
These conditions can affect the placement of output:</p>
<ul>
<ul>
<li>Line too long</li>
<li>Line too long</li>
Line 250: Line 327:
<li>Overlapping placement</li>
<li>Overlapping placement</li>
</ul>
</ul>
====Impact of the OUTCCC parameter setting====
<p>The rules for handling the four exceptional conditions described below do not apply if the user parameter OUTCCC is set to 0. This causes output to be truncated to one line. (Refer to the Rocket <var class="product">Model&nbsp;204</var> Parameter and Command Reference Manual for more information on the OUTCCC parameter.)</p>
===Impact of the OUTCCC parameter setting===
====Line too long====
<p>
<p>When output does not fit on a designated line, <var class="product">Model&nbsp;204</var> prints a hyphen at the end of the line and continues printing in column 1 on the next line.</p>
The rules for handling the four exceptional conditions described below do not apply if the user parameter <var>[[OUTCCC parameter|OUTCCC]]</var> is set to 0. This causes output to be truncated to one line. </p>
====Overlapping TAB====
 
<p>If a TAB spaces beyond the end of a line, the output is continued beginning at the first tab on the next line. For example, if the end of the line is column 130 (the output device line width is 130 columns) and the last tab occurs at column 121, the statement:</p>
===Line too long===
<p class="code">PRINT 'AGE' AT COLUMN 120 TAB AGE  
<p>
When output does not fit on a designated line, <var class="product">Model&nbsp;204</var> prints a hyphen at the end of the line and continues printing in column 1 on the next line.</p>
===Overlapping TAB===
<p>
If a TAB spaces beyond the end of a line, the output is continued beginning at the first tab on the next line. For example, if the end of the line is column 130 (the output device line width is 130 columns) and the last tab occurs at column 121, the statement:</p>
<p class="code">PRINT 'AGE' AT COLUMN 120 TAB AGE
</p>
</p>
<p>prints AGE in columns 120-122, places a hyphen in column 130, and continues output on the next line beginning at the first tab, as follows:</p>
<p>
<p class="code">                                        AGE      -  
prints AGE in columns 120-122, places a hyphen in column 130, and continues output on the next line beginning at the first tab, as follows:</p>
<p class="code">                                        AGE      -
54
54
</p>
</p>
====Overlapping TO COLUMN n====
<p>If output positioned by the phrase TO COLUMN n is too large to fit on one line and still end at the specified column, it is printed on two lines so as to end on the second line at the specified column. <var class="product">Model&nbsp;204</var> prints a hyphen at the end of the first line. </p>
===Overlapping TO COLUMN n===
<p>Therefore, the result of:</p>
<p>
<p class="code">PRINT 'MASSACHUSETTS' TO COLUMN 10  
If output positioned by the phrase TO COLUMN n is too large to fit on one line and still end at the specified column, it is printed on two lines so as to end on the second line at the specified column. <var class="product">Model&nbsp;204</var> prints a hyphen at the end of the first line. </p>
<p>
Therefore, the result of:</p>
<p class="code">PRINT 'MASSACHUSETTS' TO COLUMN 10
</p>
</p>
<p>is:</p>
<p>
is:</p>
<p class="code">          MAS    -
<p class="code">          MAS    -
SACHUSETTS  
SACHUSETTS
</p>
</p>
====Overlapping placement====
<p>If the column number given in an AT COLUMN n or TO COLUMN n phrase is less than a previously specified column number, output is placed on the next line. So the result of:</p>
===Overlapping placement===
<p class="code">PRINT NAME AT COLUMN 20 AND AGE AT COLUMN 1  
<p>
If the column number given in an AT COLUMN n or TO COLUMN n phrase is less than a previously specified column number, output is placed on the next line. So the result of:</p>
<p class="code">PRINT NAME AT COLUMN 20 AND AGE AT COLUMN 1
</p>
</p>
<p>is:</p>
<p>
is:</p>
<p class="code">                  JOSEPH MARTIN              -
<p class="code">                  JOSEPH MARTIN              -
29  
29
</p>
</p>
<p>Similarly, if the value to be printed overlays the next AT COLUMN n or TO COLUMN n, output is printed on the next line. If the PRINT is in this form:</p>
<p>
<p class="code">PRINT NAME AND ADDRESS AT COLUMN 20  
Similarly, if the value to be printed overlays the next AT COLUMN n or TO COLUMN n, output is printed on the next line. If the PRINT is in this form:</p>
<p class="code">PRINT NAME AND ADDRESS AT COLUMN 20
</p>
</p>
<p>and the name to be printed consists of more than 19 characters, the address prints in column 20 on the next line:</p>
<p>
and the name to be printed consists of more than 19 characters, the address prints in column 20 on the next line:</p>
<p class="code">COMPUTER CORPORATION OF AMERICA
<p class="code">COMPUTER CORPORATION OF AMERICA
                   500 OLD CONNECTICUT PATH              
                   500 OLD CONNECTICUT PATH
</p>
</p>
===Printing the record number and record ID===
====Printing the record number====
==Printing the record number and record ID==
<p>This statement prints the internal <var class="product">Model&nbsp;204</var> record number of the current record:    </p>
<p class="code">PRINT *RECORD  
===Printing the record number===
<p>
This statement prints the internal <var class="product">Model&nbsp;204</var> record number of the current record:    </p>
<p class="code">PRINT *RECORD
</p>
</p>
<p class="note"><b>Note:</b> The internal record number can also be obtained by using the $CURREC function; see [[$CURREC#$CURREC|$CURREC]].  </p>
<p class="note"><b>Note:</b> The internal record number can also be obtained by using the $CURREC function; see [[$CURREC#$CURREC|$CURREC]].  </p>
====Printing the record ID====
<p>For a sorted file, if the current record is an overflow record, this statement prints the ID of the preferred master area for the record:    </p>
===Printing the record ID===
<p class="code">PRINT *ID  
<p>
For a sorted file, if the current record is an overflow record, this statement prints the ID of the preferred master area for the record:    </p>
<p class="code">PRINT *ID
</p>
<p>
If the current record is a master record, the character string "MASTER RECORD" is printed. If the current record is not in a sorted file, the string "UNSORTED FILE" is printed.</p>
<p>
For more information on sorted files and sorting, see [[Value loops#Sorting retrieved values|Sorting retrieved values]], [[Sorting]], and [[Sorted files]].
</p>
</p>
<p>If the current record is a master record, the character string "MASTER RECORD" is printed. If the current record is not in a sorted file, the string "UNSORTED FILE" is printed.</p>
 
<p>For more information on sorted files, see [[Value Loops#Value Loops|Value Loops]] and [[Sorting#Sorting|Sorting]] of this manual and refer to the Rocket <var class="product">Model&nbsp;204</var> File Manager's Guide.    </p>
==Formatting page headers and trailers==
===Formatting page headers and trailers===
====Headers and trailers====
===Headers and trailers===
<p><var class="product">Model&nbsp;204</var> provides the capability to add header and trailer lines to each page of a report. The headers and trailers include:</p>
<p>
<var class="product">Model&nbsp;204</var> provides the capability to add header and trailer lines to each page of a report. The headers and trailers include:</p>
<table>
<table>
<tr class="head">
<tr class="head">
Line 306: Line 410:
<th>Which by default is...</th>
<th>Which by default is...</th>
</tr>
</tr>
<tr>
<tr>
<td>Header 0 </td>
<td>Header 0 </td>
<td>Automatically generated at the top of each page by <var class="product">Model&nbsp;204</var>. It includes the date, time, and page number.</td>
<td>Automatically generated at the top of each page by <var class="product">Model&nbsp;204</var>. It includes the date, time, and page number.</td>
</tr>
</tr>
<tr>
<tr>
<td>User defined header lines </td>
<td nowrap>User defined header lines </td>
<td>Up to four header lines that can be printed out on the lines immediately below the header 0 line.</td>
<td>Up to four header lines that can be printed out on the lines immediately below the header 0 line.</td>
</tr>
</tr>
<tr>
<tr>
<td>User defined trailer lines </td>
<td>User defined trailer lines </td>
Line 319: Line 426:
</tr>
</tr>
</table>
</table>
====Header 0====
 
<p>Below is an example of a header 0:</p>
===Header 0===
<p>
Below is an example of a header 0:</p>
<p class="code">90.218  AUG 06  09.05.00            PAGE 63
<p class="code">90.218  AUG 06  09.05.00            PAGE 63
</p>
</p>
<p>At the left is the Julian date: year and day of year. This is followed by the month and day of month and the time, recorded on a 24-hour clock in hours, minutes, and seconds. The page number, incremented automatically, is at the right.        </p>
<p>
====Setting headers and trailers====
At the left is the Julian date: year and day of year. This is followed by the month and day of month and the time, recorded on a 24-hour clock in hours, minutes, and seconds. The page number, incremented automatically, is at the right.        </p>
<p>Use the SET HEADER m statement to define (format) each header line you want; use the SET TRAILER m statement to define each trailer.</p>
<p>Whenever a new page of a report is started, all headers and trailers that are set are printed at the top and bottom of the page, respectively.</p>
===Setting headers and trailers===
<p>After completion of a request, the headers and trailers that were set in that request are no longer printed. </p>
<p>
<p>The number of SET HEADER and SET TRAILER statements allowed in one request is unlimited.</p>
Use the SET HEADER m statement to define (format) each header line you want; use the SET TRAILER m statement to define each trailer.</p>
====Suppressing the printing of headers and trailers====
<p>
<p>The user parameter HDRCTL = 1 suppresses the printing of Header 0. Refer to the Rocket <var class="product">Model&nbsp;204</var> Parameter and Command Reference Manual for more information on the HDRCTL parameter.          </p>
Whenever a new page of a report is started, all headers and trailers that are set are printed at the top and bottom of the page, respectively.</p>
<p>The RESET HEADER m statement suppresses the printing of Header m. For example, if header lines 2, 3, and 4 are set and the statement RESET HEADER 3 is issued, a line is effectively skipped between headers 2 and 4 when they are printed.</p>
<p>
<p>When RESET HEADER is used, the header becomes inactive. For example, if the user can specify as many as 5 header lines and header 5 is not specified, a blank line is not reserved for headers 4 and 5 if the statement RESET HEADER 4 is issued (printing begins immediately after header 3).    </p>
After completion of a request, the headers and trailers that were set in that request are no longer printed. </p>
<p>Similarly, the RESET TRAILER m statement suppresses the printing of  
<p>
The number of SET HEADER and SET TRAILER statements allowed in one request is unlimited.</p>
===Suppressing the printing of headers and trailers===
<p>
Setting the user parameter <var>[[HDRCTL parameter|HDRCTL]]</var> to 1 suppresses the printing of Header 0.
<p>
The RESET HEADER m statement suppresses the printing of Header m. For example, if header lines 2, 3, and 4 are set and the statement RESET HEADER 3 is issued, a line is effectively skipped between headers 2 and 4 when they are printed.</p>
<p>
When RESET HEADER is used, the header becomes inactive. For example, if the user can specify as many as 5 header lines and header 5 is not specified, a blank line is not reserved for headers 4 and 5 if the statement RESET HEADER 4 is issued (printing begins immediately after header 3).    </p>
<p>
Similarly, the RESET TRAILER m statement suppresses the printing of
trailer m.    </p>
trailer m.    </p>
<p>You are allowed an unlimited number of RESET HEADER and RESET TRAILER statements. </p>
<p>
====SET HEADER statement====
You are allowed an unlimited number of RESET HEADER and RESET TRAILER statements. </p>
<p>The SET HEADER m statement sets up a line of header information to be printed at the top of a page on the mth line after the system-generated page header (after Header 0).      </p>
<b>Number of header lines</b>
===SET HEADER statement===
<p>The number of header lines that you can set is controlled by the MAXHDR parameter. (The default is 5.) For more information about MAXHDR, refer to the Rocket <var class="product">Model&nbsp;204</var> Parameter and Command Reference Manual.  </p>
<p>
<b>Purpose</b>
The SET HEADER m statement sets up a line of header information to be printed at the top of a page on the mth line after the system-generated page header (after Header 0).      </p>
<p>The header line is formatted but not printed by the SET HEADER statement. Whenever <var class="product">Model&nbsp;204</var> starts a new page of output, any header lines that are already set are printed. The header feature is designed to label output from the request in which the SET HEADER statement is issued.</p>
<b>Syntax</b>
====Number of header lines====
<p class="code">SET HEADER m [[fieldname | %variable | 'string'
<p>
The number of header lines that you can set is controlled by the <var>[[MAXHDR parameter|MAXHDR]]</var> parameter. (The default is 5.)
</p>
====Purpose====
<p>
The header line is formatted but not printed by the SET HEADER statement. Whenever <var class="product">Model&nbsp;204</var> starts a new page of output, any header lines that are already set are printed. The header feature is designed to label output from the request in which the SET HEADER statement is issued.</p>
====Syntax====
<p class="code">SET HEADER <span class="term">m</span> [[<span class="term">fieldname</span> | <span class="term">%variable</span> | '<span class="term">string</span>'  
| VALUE IN <span class="term">label</span> | COUNT IN <span class="term">label</span>
[AT [COLUMN] <span class="term">n</span>] [AND | TAB| WITH] ...
[TO [COLUMN] <span class="term">n</span>] [AND | TAB | WITH] ...] ... [...]
</p>
<p>
Any information that can be printed can be formatted on a header line. Placement of the header can be controlled by the phrases <code>AT COLUMN <i>n</i></code> or <code>TO COLUMN <i>n</i></code>. The connectives AND, WITH, and TAB can be used.</p>
<p>
If a SET HEADER statement ends with an ellipsis (<tt>...</tt>), the arguments of the next PRINT statement are appended to the arguments of the SET statement.</p>


| VALUE IN label | COUNT IN label
====Length of header lines====
<p>
A header corresponds to a single line of output, normally 132 characters. The maximum length of an output line is determined by the <var>[[OUTMRL parameter|OUTMRL]]</var> parameter.
The header is truncated if the maximum length is exceeded; it does not wrap.    </p>
<p>
The <var>[[HTLEN parameter|HTLEN]]</var> parameter should be set by the system manager or the user if a header is to be longer than 132 characters. If the line is longer than 132 characters, it is truncated when it exceeds the HTLEN parameter value. (The header does not wrap.) </p>


[AT [COLUMN] n] [AND | TAB| WITH] ...
====Multiple header lines====
 
<p>
[TO [COLUMN] n] [AND | TAB | WITH] ...] ... [...]
Multiple header lines can be specified by repeating the SET HEADER statement that has the header number incremented. A later SET statement that has the same header number overrides a previous one. When no terms are specified following the words SET HEADER m, the mth line is effectively skipped in printing. For example, SET HEADER 2 with no text causes two lines to be skipped after header 0, provided that header 1 was not set.</p>
</p>
<p>Any information that can be printed can be formatted on a header line. Placement of the header can be controlled by the phrases AT COLUMN n or TO COLUMN n. The connectives AND, WITH, and TAB can be used.</p>
====Example====
<p>If a SET HEADER statement ends with an ellipsis (...), the arguments of the next PRINT statement are appended to the arguments of the SET statement.</p>
<p>
<b>Length of header lines</b>
This request illustrates the use of headers.</p>
<p>A header corresponds to a single line of output, normally 132 characters. The maximum length of an output line is determined by the OUTMRL parameter, as described in the Rocket <var class="product">Model&nbsp;204</var> Parameter and Command Reference Manual. The header is truncated if the maximum length is exceeded; it does not wrap.    </p>
<p>The HTLEN parameter should be set by the system manager or the user if a header is to be longer than 132 characters. If the line is longer than 132 characters, it is truncated when it exceeds the HTLEN parameter value. (The header does not wrap.) Refer to the Rocket <var class="product">Model&nbsp;204</var> Parameter and Command Reference Manual for more information on the HTLEN parameter.  </p>
<b>Multiple header lines</b>
<p>Multiple header lines can be specified by repeating the SET HEADER statement that has the header number incremented. A later SET statement that has the same header number overrides a previous one. When no terms are specified following the words SET HEADER m, the mth line is effectively skipped in printing. For example, SET HEADER 2 with no text causes two lines to be skipped after header 0, provided that header 1 was not set.</p>
<b>Example</b>
<p>This request illustrates the use of headers.</p>
<p class="code">BEGIN
<p class="code">BEGIN
SET.HEADERS: SET HEADER 2 'POLICYHOLDERS REPORT' -  
SET.HEADERS: SET HEADER 2 'POLICYHOLDERS REPORT' -
                 AT COLUMN 10
                 AT COLUMN 10
             SET HEADER 3 'SECOND QUARTER, 1990' -
             SET HEADER 3 'SECOND QUARTER, 1990' -
Line 382: Line 518:
END
END
</p>
</p>
<b>Example</b>
<p>The first page is headed:</p>
====Example====
<p>
The first page is headed:</p>
<p class="code">90.218  AUG 06 09.05.00        PAGE 63
<p class="code">90.218  AUG 06 09.05.00        PAGE 63
 
         POLICYHOLDERS REPORT
         POLICYHOLDERS REPORT
         SECOND QUARTER, 1990
         SECOND QUARTER, 1990
 
           AUDIT DEPARTMENT
           AUDIT DEPARTMENT
</p>
</p>
<p>All subsequent pages have this format:</p>
<p>
All subsequent pages have this format:</p>
<p class="code">90.218  AUG 06 09.05.01        PAGE 64
<p class="code">90.218  AUG 06 09.05.01        PAGE 64
 
         POLICYHOLDERS REPORT
         POLICYHOLDERS REPORT
 
   NAME                      POLICY NO.
   NAME                      POLICY NO.
 
   ABBOTT, FRANKLIN G        100340
   ABBOTT, FRANKLIN G        100340
   ABBOTT, HAZEL W          100642
   ABBOTT, HAZEL W          100642
Line 404: Line 543:
         .                    .
         .                    .
         .                    .
         .                    .
         .                    .  
         .                    .
</p>
</p>
<b>Considerations</b>
<p>Note the following details about this request:</p>
====Considerations====
<p>
Note the following details about this request:</p>
<ul>
<ul>
<li>The SET.HEADERS and SET.PG.HDR statements each specify a NEW PAGE, in order to generate a page break between the first and second pages. If NEW PAGE is omitted from the SET.HEADERS statements, the first page is not generated. If NEW PAGE is omitted from the SET.PG.HDR statements, the output begins on the first page.      </li>
<li>The SET.HEADERS and SET.PG.HDR statements each specify a NEW PAGE, in order to generate a page break between the first and second pages. If NEW PAGE is omitted from the SET.HEADERS statements, the first page is not generated. If NEW PAGE is omitted from the SET.PG.HDR statements, the output begins on the first page.      </li>
Line 416: Line 557:
</li>
</li>
</ul>
</ul>
====SET TRAILER statement====
<p>The SET TRAILER m statement sets up one line of trailer information to be printed at the bottom of a page. Before <var class="product">Model&nbsp;204</var> begins a new page, it displays the trailers that were set up on the bottom of the current page.</p>
===SET TRAILER statement===
<b>Syntax</b>
<p>
<p class="code">SET TRAILER m [[fieldname | %variable | 'string'
The SET TRAILER m statement sets up one line of trailer information to be printed at the bottom of a page. Before <var class="product">Model&nbsp;204</var> begins a new page, it displays the trailers that were set up on the bottom of the current page.</p>
====Syntax====
<p class="code">SET TRAILER <span class="term">m</span> [[<span class="term">fieldname</span> | <span class="term">%variable</span> | '<span class="term">string</span>'  
| VALUE IN <span class="term">label</span> | COUNT IN <span class="term">label</span>
[AT [COLUMN] <span class="term">n</span>] [AND | TAB| WITH] ...
[TO [COLUMN] <span class="term">n</span>] [AND | TAB | WITH] ...] ... [...]
</p>


| VALUE IN label | COUNT IN label
====Number of trailer lines====
 
<p>
[AT [COLUMN] n] [AND | TAB| WITH] ...
The number of trailer lines that can be set by the user is controlled by the <var>[[MAXTRL parameter|MAXTRL]]</var> parameter. (The default is 5.)
 
</p>
[TO [COLUMN] n] [AND | TAB | WITH] ...] ... [...]
====Length of trailer lines====
<p>
A trailer corresponds to a single line of output, normally 132 characters. Like headers, the maximum length of a trailer line is determined by the OUTMRL parameter.The trailer is truncated if the maximum length is exceeded; it does not wrap.     </p>
<p>
The <var>[[HTLEN parameter|HTLEN]]</var> parameter should be set by the system manager or the user if a trailer is longer than 132 characters. If the line is longer than 132 characters, it is truncated when it exceeds the HTLEN parameter value. (The trailer does not wrap.)
</p>
</p>
<b>Number of trailer lines</b>
<p>The number of trailer lines that can be set by the user is controlled by the MAXTRL parameter. (The default is 5.) For more information about MAXTRL, refer to the Rocket <var class="product">Model&nbsp;204</var> Parameter and Command Reference Manual.  </p>
===Specifying page numbers===
<b>Length of trailer lines</b>
<p>
<p>A trailer corresponds to a single line of output, normally 132 characters. Like headers, the maximum length of a trailer line is determined by the OUTMRL parameter.The trailer is truncated if the maximum length is exceeded; it does not wrap.    </p>
The $HPage and $SetP functions are particularly useful in formatting headers or trailers. </p>
<p>The HTLEN parameter should be set by the system manager or the user if a trailer is longer than 132 characters. If the line is longer than 132 characters, it is truncated when it exceeds the HTLEN parameter value. (The trailer does not wrap.) Refer to the Rocket <var class="product">Model&nbsp;204</var> Parameter and Command Reference Manual for more information on the HTLEN parameter.            </p>
====Specifying page numbers====
<p>The $HPAGE and $SETP functions are particularly useful in formatting headers or trailers. </p>
<ul>
<ul>
<li>$HPAGE is replaced by the current page number when the header or trailer is printed. $HPAGE also can be used to help replace header 0. (See [[$HPAGE#$HPAGE|$HPAGE]].) </li>
<li>$HPage is replaced by the current page number when the header or trailer is printed. $HPage also can be used to help replace header 0. (See [[$HPage#$HPage|$HPage]].) </li>
</li>
</li>
<li>$SETP sets the current page number for the output device in effect and can be used to format header 0 or fill in a value for $HPAGE. $SETP is not valid in a SET HEADER statement. (See [[$SETP#$SETP|$SETP]].)                                  </li>
<li>$SetP sets the current page number for the output device in effect and can be used to format header 0 or fill in a value for $HPage. $SetP is not valid in a SET HEADER statement. (See [[$SetP#$SetP|$SetP]].)                                  </li>
</li>
</li>
</ul>
</ul>
===Interrupting request execution===
 
====PAUSE statement====
==Interrupting request execution==
<p>The PAUSE statement causes request execution to pause and wait for the user to respond before continuing. The PAUSE statement is useful for changing and aligning forms on non-CRT devices.    </p>
<p>The user's response depends upon the terminal being used. Refer to the Rocket <var class="product">Model&nbsp;204</var> Terminal User's Guide for a detailed description of the appropriate responses for each terminal type.    </p>
===PAUSE statement===
<b>Example</b>
<p>
<p>This request causes execution to halt temporarily after <var class="product">Model&nbsp;204</var> has skipped to a new page but before it has printed the page header or the first record:</p>
The PAUSE statement causes request execution to pause and wait for the user to respond before continuing. The PAUSE statement is useful for changing and aligning forms on non-CRT devices.    </p>
<p>
The user's response depends upon the terminal being used.
Refer to the
<var class="book">Rocket Model 204 Terminal User's Guide</var>
for a detailed description of the appropriate responses for each terminal type.    </p>
====Example====
<p>
This request causes execution to halt temporarily after <var class="product">Model&nbsp;204</var> has skipped to a new page but before it has printed the page header or the first record:</p>
<p class="code">BEGIN
<p class="code">BEGIN
FIND.RECS: FIND ALL RECORDS
FIND.RECS: FIND ALL RECORDS
Line 454: Line 613:
               PRINT ALL INFORMATION
               PRINT ALL INFORMATION
           END FOR
           END FOR
END  
END
</p>
</p>
====Use of the PAUSE n statement====
<p>Another form of the PAUSE statement, PAUSE n, is particularly useful in record locking conflicts. Refer to [[Record Level Locking and Concurrency Control#PAUSE statement|PAUSE statement]] for more information.    </p>
===Use of the PAUSE n statement===
===Directing output to a journal/audit trail===
<p>
====AUDIT statement====
Another form of the PAUSE statement, PAUSE n, is particularly useful in record locking conflicts. Refer to [[Record level locking and concurrency control#PAUSE statement|PAUSE statement]] for more information.    </p>
<p>If production of a journal and/or an audit trail has been specified for the run, output can be directed to these data sets by using the AUDIT statement. The AUDIT statement is the same as the PRINT statement, substituting the keyword AUDIT for the PRINT keyword (see [[#The PRINT statement|The PRINT statement]] for a description of the PRINT statement).     </p>
====AUDIT ALL INFORMATION statement====
==Directing output to a journal/audit trail==
<p>The AUDIT ALL INFORMATION (or AAI) statement writes the output of entire records to the audit trail, CCAAUDIT. </p>
<p>The output is identical to the output from PRINT ALL INFORMATION (PAI) but each field=value pair is sent to CCAAUDIT as a series of US lines. (See [[Basic User Language Statements and Commands#PRINT ALL INFORMATION (or PAI) statement|PRINT ALL INFORMATION (or PAI) statement]] for more information.)</p>
===Audit statement===
<p>The AUDIT ALL INFORMATION statement occurs in a FOR EACH RECORD or FOR RECORD NUMBER loop.</p>
<p>
<b>Syntax</b>
If production of a journal and/or an audit trail has been specified for the run, output can be directed to these data sets by using the <var>Audit</var> statement. The <var>Audit</var> statement is the same as the <var>Print</var> statement, substituting the keyword <code>Audit</code> for the <code>Print</code> keyword (see [[#The PRINT statement|The PRINT statement]] for a description of the <var>Print</var> statement). </p>
<p class="code">AUDIT ALL INFORMATION
 
</p>
===Audit All Information statement===
<p>or</p>
<p>
<p class="code">AAI
The <var>Audit All Information</var> (or <var>AAI</var>) statement writes the output of entire records to the audit trail, CCAAUDIT. </p>
</p>
<p>
====AUDIT output====
The output is identical to the output from the <var>[[Basic SOUL statements and commands#PRINT ALL INFORMATION (or PAI) statement|Print All Information]]</var> (or <var>PAI</var>) statement, but each field=value pair is sent to the audit trail as a series of US lines.</p>
<p>AUDIT statement output is directed to the journal, the audit trail, or both, depending upon which is included in the run. The AUDIT statement directs the information to the journal or audit trail where it is printed with the prefix US. </p>
<p>
<p>If an AUDIT message is too long to fit on one line, it is continued on a second line with the prefix XX rather than US.</p>
The <var>Audit All Information</var> statement occurs in a <var>For Each Record</var> or <var>For Record Number</var> loop. </p>
<p>The Rocket <var class="product">Model&nbsp;204</var> System Manager's Guide contains a complete description of the journal and audit trail.     </p>
<b>Example</b>
====Syntax====
<p>This statement tracks changes to a salary field:</p>
{{Template:Audit All Information statement syntax}}
Where:
<p>
<var>CtoFields</var> specifies to print the counter (CTO) field(s). By default CTO fields are not printed.</p>
 
===Audit output===
<p>
<var>Audit</var> statement output is directed to the journal, the audit trail, or both, depending upon which is included in the run. The <var>Audit</var> statement directs the information to the journal or audit trail where it is printed with the prefix <code>US</code>. </p>
<p>
If an <var>Audit</var> message is too long to fit on one line, it is continued on a second line with the prefix <code>XX</code> rather than <code>US</code>. </p>
<p>
 
[[Tracking system activity (CCAJRNL, CCAAUDIT, CCAJLOG)|Tracking system activity]] contains a complete description of the journal and audit trail. </p>
====Example====
<p>
This statement tracks changes to a salary field:</p>
<p class="code">    .
<p class="code">    .
     .
     .
Line 484: Line 659:
     .
     .
     .
     .
     .  
     .
</p>
</p>
<p>In the previous statement, the $USERID function is used to obtain the ID of the user making the change. The statement produces the following audit trail record when it is executed:</p>
<p>
<p class="code">86123110011 1 1 135 US SMITH HAS CHANGED SALARY FROM 20344 TO 45888
In the previous statement, the <var>$Userid</var> function is used to obtain the ID of the user making the change. The statement produces the following audit trail record when it is executed: </p>
<p class="output">86123110011 1 1 135 US SMITH HAS CHANGED SALARY FROM 20344 TO 45888
</p>
</p>
====Using the AUDIT and PRINT statements together====
 
<p>If the AUDIT statement ends in an ellipsis (...), it can be added to with PRINT or SET statements. For example:      </p>
===Using the Audit and Print statements together===
<p>
If the <var>Audit</var> statement ends in an ellipsis (<tt>...</tt>), it can be added to with <var>Print</var> or <var>Set</var> statements. For example, the following statements produce <code>US BEGIN123END</code> in the audit trail:      </p>
<p class="code">AUDIT 'BEGIN' ...
<p class="code">AUDIT 'BEGIN' ...
PRINT '123' ...
PRINT '123' ...
PRINT 'END'  
PRINT 'END' </p>
</p>
<p>
<p>produces US BEGIN123END in the audit trail.</p>
If the <var>Audit</var> statement follows a normal <var>Print</var> statement that ends in an ellipsis, the <var>Print</var> line is ended by the <var>Audit</var> statement. The <var>Print</var> line ends when the <var>Audit</var> line begins.</p>
<p>If the AUDIT statement follows a normal PRINT statement that ends in an ellipsis, the PRINT line is ended by the AUDIT statement. The PRINT line ends when the AUDIT line begins.</p>
====Printing records using AUDIT====
===Printing records using Audit===
<p>If a record is printed by means of an AUDIT statement, the lines printed by the user can be broken, and the partial lines intermixed with lines printed by another user in an online system. </p>
<p>
<p>This problem can be alleviated by assigning the field value to a variable (see [[Using Variables and Values in Computation#Field name variables|Field name variables]]) and then referring to the variable in the AUDIT statement, or by using a NOTE statement and referring to it with a VALUE IN phrase in the AUDIT statement. </p>
If a record is printed by means of an <var>Audit</var> statement, the lines printed by the user can be broken, and the partial lines intermixed with lines printed by another user in an online system. </p>
<p>See [[Record Loops#Noting character strings|Noting character strings]] for more information about the NOTE statement and the VALUE IN phrase.   </p>
<p>
===Directing output to other devices===
This problem can be alleviated by assigning the field value to a variable (see [[Using variables and values in computation#Field name variables|Field name variables]]) and then referring to the variable in the <var>Audit</var> statement, or by using a <var>Note</var> statement and referring to it with a <code>Value In</code> phrase in the <var>Audit</var> statement. </p>
====The USE command====
<p>
<p>The USE command directs the output produced by a request to a device other than your terminal, such as a line printer or to a device that is used as input to another program. </p>
See [[Record loops#Noting character strings|Noting character strings]] for more information about the <var>Note</var> statement and the <var>Value In</var> phrase. </p>
<p>Under the VM operating system, a USE command can direct output to another system and can tag output for production on a particular device available on that system.        </p>
 
<p>The syntax of the USE command differs depending upon the operating system under which <var class="product">Model&nbsp;204</var> is running. Refer to the Rocket <var class="product">Model&nbsp;204</var> Parameter and Command Reference Manual for a detailed description of the USE command for each operating system. For information on the control language requirements associated with the command, refer to the Rocket <var class="product">Model&nbsp;204</var> System Manager's Guide. </p>
==Directing output to other devices==
<p>When output from <var class="product">Model&nbsp;204</var> is being sent to an alternate device, the USE command must be specified before any commands that produce output on that alternate device are executed.</p>
====Handling lengthy reports====
<p>The USE command is particularly useful in handling requests that produce lengthy reports, and in creating sequential files from <var class="product">Model&nbsp;204</var> files. If the length of a report is not known ahead of time, the END MORE statement and the MORE command permit you to issue the USE command after the number of records has been determined. </p>
===The USE command===
<b>Example</b>
<p>
<p>If this request: </p>
The USE command directs the output produced by a request to a device other than your terminal, such as a line printer or to a device that is used as input to another program. </p>
<p>
Under the VM operating system, a USE command can direct output to another system and can tag output for production on a particular device available on that system.        </p>
<p>
The syntax of the USE command differs depending upon the operating system under which <var class="product">Model&nbsp;204</var> is running.
Refer to
[[USE command: Directing output]]
for a detailed description of the USE command for each operating system.
For information on the control language requirements associated with the command, refer to the
<var class="book">[http://www.rocketsoftware.com/m204/products/model204/documentation/v7r4/M204-System-Mgr/view Rocket Model 204 204 System Manager's Guide]</var>.
<p>
When output from <var class="product">Model&nbsp;204</var> is being sent to an alternate device, the USE command must be specified before any commands that produce output on that alternate device are executed.</p>
 
===Handling lengthy reports===
<p>
The USE command is particularly useful in handling requests that produce lengthy reports, and in creating sequential files from <var class="product">Model&nbsp;204</var> files. If the length of a report is not known ahead of time, the END MORE statement and the MORE command permit you to issue the USE command after the number of records has been determined. </p>
====Example====
<p>
If this request: </p>
<p class="code">BEGIN
<p class="code">BEGIN
FIND.RECS: FIND ALL RECORDS FOR WHICH
FIND.RECS: FIND ALL RECORDS FOR WHICH
Line 517: Line 714:
CT: COUNT RECORDS IN FIND.RECS
CT: COUNT RECORDS IN FIND.RECS
PRINT COUNT IN CT
PRINT COUNT IN CT
END MORE    
END MORE
</p>
</p>
<p>produces a result of 1220, the user might respond with a USE command in the following form before continuing with the request:</p>
<p>
<p class="code">USE output name  
produces a result of 1220, the user might respond with a USE command in the following form before continuing with the request:</p>
<p class="code">USE output name
</p>
</p>
<p>where output name is a device or data set name established by the system manager. </p>
<p>
<p>The user then continues:</p>
where output name is a device or data set name established by the system manager. </p>
<p>
The user then continues:</p>
<p class="code">MORE
<p class="code">MORE
FOR EACH RECORD IN FIND.RECS
FOR EACH RECORD IN FIND.RECS
PRINT FULLNAME WITH DRIVER ID AT COLUMN 30
PRINT FULLNAME WITH DRIVER ID AT COLUMN 30
END FOR
END FOR
END  
END
</p>
</p>
<p>The final output would then be written, in the following format, to an alternate device, rather than to the user's terminal:</p>
<p>
The final output would then be written, in the following format, to an alternate device, rather than to the user's terminal:</p>
<p class="code">ABBOTT, FRANKLIN G          100816
<p class="code">ABBOTT, FRANKLIN G          100816
ABBOTT, HAROLD N            102271
ABBOTT, HAROLD N            102271
Line 537: Line 738:
     .                        .
     .                        .
     .                        .
     .                        .
     .                        .  
     .                        .
</p>
</p>
====The END USE statement====
<p>If a request ends with an END USE statement, the device remains available for this user after the request has been completed, allowing output from another request can be added to the original output. </p>
===The END USE statement===
<p>The output page number is not reset. </p>
<p>
<p>If the USE keyword is not specified in the END statement, the USE command applies only to the first request following the USE command. USE must be repeated before any other request whose output is to appear on the alternate device.</p>
If a request ends with an END USE statement, the device remains available for this user after the request has been completed, allowing output from another request can be added to the original output. </p>
<p>
The output page number is not reset. </p>
<p>
If the USE keyword is not specified in the END statement, the USE command applies only to the first request following the USE command. USE must be repeated before any other request whose output is to appear on the alternate device.</p>
<p class="note"><b>Note:</b> Both keywords, MORE and USE, can be specified in conjunction with END. Both END MORE USE or END USE MORE are accepted.  </p>
<p class="note"><b>Note:</b> Both keywords, MORE and USE, can be specified in conjunction with END. Both END MORE USE or END USE MORE are accepted.  </p>
====Creating a sequential data set====
<p>The USE command can create a sequential data set from a <var class="product">Model&nbsp;204</var> file. </p>
===Creating a sequential data set===
<b>Example</b>
<p>
<p>This request writes all of the data in a <var class="product">Model&nbsp;204</var> file to the OUTFILE data set, from which it can be reloaded or used by another program:</p>
The USE command can create a sequential data set from a <var class="product">Model&nbsp;204</var> file. </p>
====Example====
<p>
This request writes all of the data in a <var class="product">Model&nbsp;204</var> file to the OUTFILE data set, from which it can be reloaded or used by another program:</p>
<p class="code">USE OUTFILE
<p class="code">USE OUTFILE
BEGIN
BEGIN
Line 556: Line 765:
SKIP 1 LINE
SKIP 1 LINE
END FOR
END FOR
END  
END
</p>
</p>
<p>The $BINARY, $FLOAT, $FLOATD, and $PACK functions, discussed in <b>See User Language Functions</b>, allow data in special representations to be written to a USE data set.             </p>
<p>
The $BINARY, $FLOAT, $FLOATD, and $PACK functions, discussed in
[[SOUL $functions]],
allow data in special representations to be written to a USE data set. </p>
</div> <!-- end of toc limit div -->
 
[[Category:SOUL]]
[[Category:SOUL]]

Latest revision as of 21:12, 18 May 2018

Overview

Model 204 provides several report generation capabilities, including:

  • Sorting output
  • Formatting output
  • Directing output

Sorted output

User Language provides the following features that allow output to be produced in sorted order:

  • IN ORDER clause — This clause can be specified on FOR EACH RECORD and FOR EACH VALUE statements in order to produce output in sorted order. See Processing records in order for a discussion of the IN ORDER clause for the FOR EACH RECORD statement. See FOR EACH VALUE statement for a discussion of the IN ORDER clause for the FOR EACH VALUE statement.
  • SORT RECORDS and SORT RECORD KEYS statements — These statements can be used when the IN ORDER clause cannot be used to provide the order you desire. Sorting includes a detailed discussion of sort statements.

Formatting capabilities

Model 204 provides User Language statements, commands, and parameters to allow you to control the following report formatting elements:

  • Headings or comments
  • Spacing on a line (skipping spaces)
  • Assignment of columns for output
  • Printing record numbers and record IDs
  • Page headers and trailers
  • Pausing execution of request output

The PRINT statement

You use variations of the PRINT statement to perform most of the formatting capabilities described above. The PRINT statement is described in more detail throughout this topic.

For additional information about formatting

Basic SOUL statements and commands provides a discussion of these statements, which control report formatting:

  • FIND AND PRINT COUNT
  • PRINT ALL INFORMATION
  • PRINT fieldname
  • SKIP n LINES

Example of formatting output

The complete syntax of the PRINT statement provides several options that permit you to design quite complex formats for reports. Some of these are illustrated in this request:

BEGIN DRIVERS: FIND ALL RECORDS FOR WHICH RECTYPE = DRIVER STATE = MASSACHUSETTS END FIND PRINT ''MASSACHUSETTS DRIVERS' AT COLUMN 12 SKIP 1 LINE PRINT 'POLICY NO' WITH 'NAME' AT COLUMN 15 - WITH 'DRIVER ID' TO COLUMN 45 SKIP 1 LINE FOR EACH RECORD IN DRIVERS PRINT POLICY NO WITH FULLNAME AT COLUMN 15 - WITH DRIVER ID TO COLUMN 45 END FOR END

The output from this request appears as:

MASSACHUSETTS DRIVERS POLICY NO NAME DRIVER ID 100095 ALTON, BARBARA W 100223 100095 ALTON, CARRIE Y 100225 100095 ALTON, CHARLES Z 100226 100095 ALTON, THOMAS V 100222 100095 ALTON, TIMOTHY X 100224 100096 ANCH, EDITH X 100228

Directed output

The features described at the end of this page allow you to direct output from a User Language request.

Use Model 204 feature... To direct output to...
AUDIT statement Journal or audit trail.
USE command Devices other than the user's terminal.
WRITE IMAGE statement Sequential file, a terminal, or a a Host Language application program. See WRITE IMAGE statement for more information.

PRINT statement

The PRINT statement controls most report formatting.

This section provides an overview of the PRINT statement. Specific uses of the PRINT statement are described in later sections. See also:

Syntax

The basic form of the PRINT statement is provided here, followed by a discussion of the statements used in the example and several additional output features.

PRINT [[fieldname | %variable | 'string' | VALUE IN label | COUNT IN label] [AT [COLUMN] n] [AND | TAB | WITH] ... [TO [COLUMN] n] [AND | TAB | WITH] ...] ... [...]

List of terms

A list of terms specifying what is to be printed and the placement of the printing on the line follows the statement name PRINT. Terms can be specified in any order.

Each PRINT statement normally specifies one line of output. Alternatively, see Continuing the PRINT statement.

Use of keyword FIELD

The keyword FIELD is required in order to print a field whose name begins with the word IMAGE, MENU, or SCREEN if the field name appears at the beginning of the PRINT statement. For example:

PRINT FIELD SCREEN SIZE

prints the field named SCREEN SIZE.

The keyword FIELD is recognized only when it is the first word after PRINT. FIELD should not be used with field names that appear elsewhere in a PRINT statement.

TO and AT column options

When using the PRINT statement in conjunction with the AT or TO column options, you cannot specify negative numbers or numbers greater than 32767 for the column.

Procedures containing PRINT statements with negative numbers or numbers greater than 32767 fails at compile time with this counting error message:

M204.0263: AT/TO MUST BE BETWEEN 1 AND 32767

Continuing the PRINT statement

Normally, each PRINT statement formats one line of output. However, if a PRINT statement ends with an ellipsis (...), the next PRINT statement continues on the same output line. In this way an unlimited number of PRINT statements can apply to a single line of output.

The first PRINT statement that does not end with an ellipsis, or SKIP or NEW PAGE statement, ends the output line. The END statement ends the output line if the last PRINT statement ends with an ellipsis.

For example, the following request prints each vehicle identification number for blue Mustangs, with three spaces between each number:

BEGIN FIND.RECS: FIND ALL RECORDS FOR WHICH MODEL = MUSTANG AND COLOR = BLUE END FIND FOR EACH RECORD IN FIND.RECS PRINT VIN AND AND AND ... END FOR END

The output looks like:

FOR2100547 FOR2101155

Version 7.4 limitation

In Model 204 version 7.4, there is a limit of 127 on the number of fields that can be added in a PRINT statement using a subscripted variable. If you are currently adding more than this number, the following message will be issued:

M204.2840: STATEMENT HAS TOO MANY INTERMEDIATE RESULTS

The issue has been resolved in SirMods 8.1. Therefore, the best solution for Model 204 version 7.4 is to rerun the job with a load module that includes SirMods 8.1 linked in. As of Model 204 version 7.5, SirMods is totally integrated into the Model 204 nucleus, so no special linking is required.

Formatting/printing headers or comments

Use the PRINT statement

To print out headings or comments, the PRINT statement is used with the desired phrase, which is enclosed in single quotation marks.

For example:

PRINT 'FIRST REPORT'

causes Model 204 to print:

FIRST REPORT

Use of quotation marks

The pair of single quotation marks delineates the quoted string. Any character that appears within the quotation marks (including space) is considered part of the text to be printed. A pair of consecutive single quotation marks ('') embedded in quoted text reproduces a single quotation mark in the output. Thus:

PRINT 'WHY JOHNNY CAN''T READ'

yields:

WHY JOHNNY CAN'T READ

Quoted phrases are stored and utilized by Model 204 with quotation marks dropped. Quotation marks provides additional information about the use of quotation marks.

Controlling spacing on an output line

The spacing of printed output can be controlled by using the connectives AND, WITH, and TAB with the PRINT statement, as described below.

Connectives required for multiple outputs on one line

When several pieces of output are to be printed on a single line, a connective or placement phrase must follow each field name except the last. The following statements are legal:

PRINT CITY WITH ', ' WITH STATE PRINT CITY AND STATE

but the statements below are not:

PRINT CITY STATE PRINT '('TOTAL PREMIUM')'

Skipping one space (AND)

When AND is used, one space is skipped before further printing. For example, if Model 204 has retrieved a record with the field:

TOTAL PREMIUM = 15,000

then:

PRINT 'PREMIUM IS $' TOTAL PREMIUM AND 'PER YEAR'

yields the printout:

PREMIUM IS $15,000 PER YEAR

This statement:

PRINT AND AND COUNT IN CT

skips two spaces before printing the count.

Skipping no spaces (WITH)

When WITH is used, no spaces are skipped. For example, the statement:

PRINT '($' WITH TOTAL PREMIUM WITH ')'

yields:

($15,000)

WITH more efficient than AND

WITH is more efficient than AND. When a quoted string is used, WITH can replace AND by including an extra space in the string as illustrated below:

PRINT 'PREMIUM IS $' TOTAL PREMIUM AND 'PER YEAR'

can be changed to:

PRINT 'PREMIUM IS $' TOTAL PREMIUM WITH ' PER YEAR'

Using tab stops

When TAB is used, further printing begins at the next tab stop. Tab stops normally are set to 1, 11, 21, and so on. For example, the statement:

PRINT COUNT IN CT TAB PREMIUM TAB TAB MODEL

would result in output such as:

8 392 PINTO

The standard spacing between successive tab stops can be changed by resetting the TABSP parameter.

When a TAB is specified, at least two spaces are left after the last character printed. If the last character printed ends at the next tab stop or there is only one space remaining before the next tab stop, Model 204 automatically inserts an extra TAB.

Specifying columns for output

The phrases AT COLUMN n and TO COLUMN n, used with the PRINT statement, provide for the left- or right-justification of output.

  • AT COLUMN n means that printing begins in column n.
  • TO COLUMN n specifies that output is positioned to end in column n.

Note: A placement phrase applies only to the single piece of output that precedes it in the PRINT statement and not to the entire output line.

Example

This request illustrates the use of placement phrases:

BEGIN FIND.RECS: FIND ALL RECORDS FOR WHICH RECTYPE = DRIVER INCIDENT IS PRESENT END FIND FOR EACH RECORD IN FIND.RECS PRINT 'INCIDENT TYPE:' - WITH INCIDENT AT COLUMN 30 PRINT 'DATE OF INCIDENT:' - WITH INCIDENT DATE AT COLUMN 30 PRINT 'POLICYHOLDER:' - WITH FULLNAME AT COLUMN 30 SKIP 1 LINE END FOR END

These statements produce output such as:

INCIDENT TYPE: T2 DATE OF INCIDENT: 19900222 POLICYHOLDER: ABBOTT, FRANKLIN G

Using AT COLUMN n and TO COLUMN n together

AT COLUMN n can be immediately followed by TO COLUMN n. For example:

PRINT FULLNAME AT COLUMN 30 TO COLUMN 40

If the value of FULLNAME in this example is less than 11 characters long, trailing blanks are added. If the value is more than 11 characters, only the first 11 are printed. See the next section for more information about exceptional conditions relating to the placement of output.

Placement of output: Exceptional conditions

These conditions can affect the placement of output:

  • Line too long
  • Overlapping TAB
  • Overlapping TO COLUMN n
  • Overlapping placement

Impact of the OUTCCC parameter setting

The rules for handling the four exceptional conditions described below do not apply if the user parameter OUTCCC is set to 0. This causes output to be truncated to one line.

Line too long

When output does not fit on a designated line, Model 204 prints a hyphen at the end of the line and continues printing in column 1 on the next line.

Overlapping TAB

If a TAB spaces beyond the end of a line, the output is continued beginning at the first tab on the next line. For example, if the end of the line is column 130 (the output device line width is 130 columns) and the last tab occurs at column 121, the statement:

PRINT 'AGE' AT COLUMN 120 TAB AGE

prints AGE in columns 120-122, places a hyphen in column 130, and continues output on the next line beginning at the first tab, as follows:

AGE - 54

Overlapping TO COLUMN n

If output positioned by the phrase TO COLUMN n is too large to fit on one line and still end at the specified column, it is printed on two lines so as to end on the second line at the specified column. Model 204 prints a hyphen at the end of the first line.

Therefore, the result of:

PRINT 'MASSACHUSETTS' TO COLUMN 10

is:

MAS - SACHUSETTS

Overlapping placement

If the column number given in an AT COLUMN n or TO COLUMN n phrase is less than a previously specified column number, output is placed on the next line. So the result of:

PRINT NAME AT COLUMN 20 AND AGE AT COLUMN 1

is:

JOSEPH MARTIN - 29

Similarly, if the value to be printed overlays the next AT COLUMN n or TO COLUMN n, output is printed on the next line. If the PRINT is in this form:

PRINT NAME AND ADDRESS AT COLUMN 20

and the name to be printed consists of more than 19 characters, the address prints in column 20 on the next line:

COMPUTER CORPORATION OF AMERICA 500 OLD CONNECTICUT PATH

Printing the record number and record ID

Printing the record number

This statement prints the internal Model 204 record number of the current record:

PRINT *RECORD

Note: The internal record number can also be obtained by using the $CURREC function; see $CURREC.

Printing the record ID

For a sorted file, if the current record is an overflow record, this statement prints the ID of the preferred master area for the record:

PRINT *ID

If the current record is a master record, the character string "MASTER RECORD" is printed. If the current record is not in a sorted file, the string "UNSORTED FILE" is printed.

For more information on sorted files and sorting, see Sorting retrieved values, Sorting, and Sorted files.

Formatting page headers and trailers

Headers and trailers

Model 204 provides the capability to add header and trailer lines to each page of a report. The headers and trailers include:

Headers or trailers Which by default is...
Header 0 Automatically generated at the top of each page by Model 204. It includes the date, time, and page number.
User defined header lines Up to four header lines that can be printed out on the lines immediately below the header 0 line.
User defined trailer lines Up to five trailer lines that can be printed out on lines at the bottom of the page.

Header 0

Below is an example of a header 0:

90.218 AUG 06 09.05.00 PAGE 63

At the left is the Julian date: year and day of year. This is followed by the month and day of month and the time, recorded on a 24-hour clock in hours, minutes, and seconds. The page number, incremented automatically, is at the right.

Setting headers and trailers

Use the SET HEADER m statement to define (format) each header line you want; use the SET TRAILER m statement to define each trailer.

Whenever a new page of a report is started, all headers and trailers that are set are printed at the top and bottom of the page, respectively.

After completion of a request, the headers and trailers that were set in that request are no longer printed.

The number of SET HEADER and SET TRAILER statements allowed in one request is unlimited.

Suppressing the printing of headers and trailers

Setting the user parameter HDRCTL to 1 suppresses the printing of Header 0.

The RESET HEADER m statement suppresses the printing of Header m. For example, if header lines 2, 3, and 4 are set and the statement RESET HEADER 3 is issued, a line is effectively skipped between headers 2 and 4 when they are printed.

When RESET HEADER is used, the header becomes inactive. For example, if the user can specify as many as 5 header lines and header 5 is not specified, a blank line is not reserved for headers 4 and 5 if the statement RESET HEADER 4 is issued (printing begins immediately after header 3).

Similarly, the RESET TRAILER m statement suppresses the printing of trailer m.

You are allowed an unlimited number of RESET HEADER and RESET TRAILER statements.

SET HEADER statement

The SET HEADER m statement sets up a line of header information to be printed at the top of a page on the mth line after the system-generated page header (after Header 0).

Number of header lines

The number of header lines that you can set is controlled by the MAXHDR parameter. (The default is 5.)

Purpose

The header line is formatted but not printed by the SET HEADER statement. Whenever Model 204 starts a new page of output, any header lines that are already set are printed. The header feature is designed to label output from the request in which the SET HEADER statement is issued.

Syntax

SET HEADER m [[fieldname | %variable | 'string' | VALUE IN label | COUNT IN label [AT [COLUMN] n] [AND | TAB| WITH] ... [TO [COLUMN] n] [AND | TAB | WITH] ...] ... [...]

Any information that can be printed can be formatted on a header line. Placement of the header can be controlled by the phrases AT COLUMN n or TO COLUMN n. The connectives AND, WITH, and TAB can be used.

If a SET HEADER statement ends with an ellipsis (...), the arguments of the next PRINT statement are appended to the arguments of the SET statement.

Length of header lines

A header corresponds to a single line of output, normally 132 characters. The maximum length of an output line is determined by the OUTMRL parameter. The header is truncated if the maximum length is exceeded; it does not wrap.

The HTLEN parameter should be set by the system manager or the user if a header is to be longer than 132 characters. If the line is longer than 132 characters, it is truncated when it exceeds the HTLEN parameter value. (The header does not wrap.)

Multiple header lines

Multiple header lines can be specified by repeating the SET HEADER statement that has the header number incremented. A later SET statement that has the same header number overrides a previous one. When no terms are specified following the words SET HEADER m, the mth line is effectively skipped in printing. For example, SET HEADER 2 with no text causes two lines to be skipped after header 0, provided that header 1 was not set.

Example

This request illustrates the use of headers.

BEGIN SET.HEADERS: SET HEADER 2 'POLICYHOLDERS REPORT' - AT COLUMN 10 SET HEADER 3 'SECOND QUARTER, 1990' - AT COLUMN 10 SET HEADER 5 'AUDIT DEPARTMENT' - AT COLUMN 12 NEW PAGE SET.PG.HDR: SET HEADER 3 SET HEADER 4 'NAME' AT COLUMN 3 - WITH 'POLICY NO.' AT COLUMN 29 SET HEADER 5 NEW PAGE POL.HOLDERS: FIND ALL RECORDS FOR WHICH RECTYPE = POLICYHOLDER END FIND FOR EACH RECORD IN POL.HOLDERS PRINT FULLNAME AT COLUMN 3 - WITH POLICY NO TO COLUMN 36 END FOR END

Example

The first page is headed:

90.218 AUG 06 09.05.00 PAGE 63 POLICYHOLDERS REPORT SECOND QUARTER, 1990 AUDIT DEPARTMENT

All subsequent pages have this format:

90.218 AUG 06 09.05.01 PAGE 64 POLICYHOLDERS REPORT NAME POLICY NO. ABBOTT, FRANKLIN G 100340 ABBOTT, HAZEL W 100642 ABBOTT, LILLIE P 100037 ABBOTT, SHARON M 100944 . . . . . .

Considerations

Note the following details about this request:

  • The SET.HEADERS and SET.PG.HDR statements each specify a NEW PAGE, in order to generate a page break between the first and second pages. If NEW PAGE is omitted from the SET.HEADERS statements, the first page is not generated. If NEW PAGE is omitted from the SET.PG.HDR statements, the output begins on the first page.
  • Header 3 is printed only on the first page. The SET.PG.HDR statements reset headers 3 and 5, overriding previous SET HEADER statements. After the first page, headers 3 and 5 are blank lines.
  • The SET.PG.HDR statements set header 4, which was a blank line for the first page.

SET TRAILER statement

The SET TRAILER m statement sets up one line of trailer information to be printed at the bottom of a page. Before Model 204 begins a new page, it displays the trailers that were set up on the bottom of the current page.

Syntax

SET TRAILER m [[fieldname | %variable | 'string' | VALUE IN label | COUNT IN label [AT [COLUMN] n] [AND | TAB| WITH] ... [TO [COLUMN] n] [AND | TAB | WITH] ...] ... [...]

Number of trailer lines

The number of trailer lines that can be set by the user is controlled by the MAXTRL parameter. (The default is 5.)

Length of trailer lines

A trailer corresponds to a single line of output, normally 132 characters. Like headers, the maximum length of a trailer line is determined by the OUTMRL parameter.The trailer is truncated if the maximum length is exceeded; it does not wrap.

The HTLEN parameter should be set by the system manager or the user if a trailer is longer than 132 characters. If the line is longer than 132 characters, it is truncated when it exceeds the HTLEN parameter value. (The trailer does not wrap.)

Specifying page numbers

The $HPage and $SetP functions are particularly useful in formatting headers or trailers.

  • $HPage is replaced by the current page number when the header or trailer is printed. $HPage also can be used to help replace header 0. (See $HPage.)
  • $SetP sets the current page number for the output device in effect and can be used to format header 0 or fill in a value for $HPage. $SetP is not valid in a SET HEADER statement. (See $SetP.)

Interrupting request execution

PAUSE statement

The PAUSE statement causes request execution to pause and wait for the user to respond before continuing. The PAUSE statement is useful for changing and aligning forms on non-CRT devices.

The user's response depends upon the terminal being used. Refer to the Rocket Model 204 Terminal User's Guide for a detailed description of the appropriate responses for each terminal type.

Example

This request causes execution to halt temporarily after Model 204 has skipped to a new page but before it has printed the page header or the first record:

BEGIN FIND.RECS: FIND ALL RECORDS END FIND NEW PAGE PAUSE FOR EACH RECORD IN FIND.RECS PRINT ALL INFORMATION END FOR END

Use of the PAUSE n statement

Another form of the PAUSE statement, PAUSE n, is particularly useful in record locking conflicts. Refer to PAUSE statement for more information.

Directing output to a journal/audit trail

Audit statement

If production of a journal and/or an audit trail has been specified for the run, output can be directed to these data sets by using the Audit statement. The Audit statement is the same as the Print statement, substituting the keyword Audit for the Print keyword (see The PRINT statement for a description of the Print statement).

Audit All Information statement

The Audit All Information (or AAI) statement writes the output of entire records to the audit trail, CCAAUDIT.

The output is identical to the output from the Print All Information (or PAI) statement, but each field=value pair is sent to the audit trail as a series of US lines.

The Audit All Information statement occurs in a For Each Record or For Record Number loop.

Syntax

{Audit All Information | AAI} [CtoFields]

Where:

CtoFields specifies to print the counter (CTO) field(s). By default CTO fields are not printed.

Audit output

Audit statement output is directed to the journal, the audit trail, or both, depending upon which is included in the run. The Audit statement directs the information to the journal or audit trail where it is printed with the prefix US.

If an Audit message is too long to fit on one line, it is continued on a second line with the prefix XX rather than US.

Tracking system activity contains a complete description of the journal and audit trail.

Example

This statement tracks changes to a salary field:

. . . AUDIT $USERID WITH ' HAS CHANGED SALARY FROM ' - WITH %SALARY1 ' TO ' WITH SALARY . . .

In the previous statement, the $Userid function is used to obtain the ID of the user making the change. The statement produces the following audit trail record when it is executed:

86123110011 1 1 135 US SMITH HAS CHANGED SALARY FROM 20344 TO 45888

Using the Audit and Print statements together

If the Audit statement ends in an ellipsis (...), it can be added to with Print or Set statements. For example, the following statements produce US BEGIN123END in the audit trail:

AUDIT 'BEGIN' ... PRINT '123' ... PRINT 'END'

If the Audit statement follows a normal Print statement that ends in an ellipsis, the Print line is ended by the Audit statement. The Print line ends when the Audit line begins.

Printing records using Audit

If a record is printed by means of an Audit statement, the lines printed by the user can be broken, and the partial lines intermixed with lines printed by another user in an online system.

This problem can be alleviated by assigning the field value to a variable (see Field name variables) and then referring to the variable in the Audit statement, or by using a Note statement and referring to it with a Value In phrase in the Audit statement.

See Noting character strings for more information about the Note statement and the Value In phrase.

Directing output to other devices

The USE command

The USE command directs the output produced by a request to a device other than your terminal, such as a line printer or to a device that is used as input to another program.

Under the VM operating system, a USE command can direct output to another system and can tag output for production on a particular device available on that system.

The syntax of the USE command differs depending upon the operating system under which Model 204 is running. Refer to USE command: Directing output for a detailed description of the USE command for each operating system. For information on the control language requirements associated with the command, refer to the Rocket Model 204 204 System Manager's Guide.

When output from Model 204 is being sent to an alternate device, the USE command must be specified before any commands that produce output on that alternate device are executed.

Handling lengthy reports

The USE command is particularly useful in handling requests that produce lengthy reports, and in creating sequential files from Model 204 files. If the length of a report is not known ahead of time, the END MORE statement and the MORE command permit you to issue the USE command after the number of records has been determined.

Example

If this request:

BEGIN FIND.RECS: FIND ALL RECORDS FOR WHICH SEX = M END FIND CT: COUNT RECORDS IN FIND.RECS PRINT COUNT IN CT END MORE

produces a result of 1220, the user might respond with a USE command in the following form before continuing with the request:

USE output name

where output name is a device or data set name established by the system manager.

The user then continues:

MORE FOR EACH RECORD IN FIND.RECS PRINT FULLNAME WITH DRIVER ID AT COLUMN 30 END FOR END

The final output would then be written, in the following format, to an alternate device, rather than to the user's terminal:

ABBOTT, FRANKLIN G 100816 ABBOTT, HAROLD N 102271 ABBOTT, JACK P 102273 ABRAMS, RALPH M 100138 . . . . . .

The END USE statement

If a request ends with an END USE statement, the device remains available for this user after the request has been completed, allowing output from another request can be added to the original output.

The output page number is not reset.

If the USE keyword is not specified in the END statement, the USE command applies only to the first request following the USE command. USE must be repeated before any other request whose output is to appear on the alternate device.

Note: Both keywords, MORE and USE, can be specified in conjunction with END. Both END MORE USE or END USE MORE are accepted.

Creating a sequential data set

The USE command can create a sequential data set from a Model 204 file.

Example

This request writes all of the data in a Model 204 file to the OUTFILE data set, from which it can be reloaded or used by another program:

USE OUTFILE BEGIN FIND.RECS: FIND ALL RECORDS END FIND FOR EACH RECORD IN FIND.RECS PRINT ALL INFORMATION SKIP 1 LINE END FOR END

The $BINARY, $FLOAT, $FLOATD, and $PACK functions, discussed in SOUL $functions, allow data in special representations to be written to a USE data set.