General Report Writer

The SARGRW program is a general purpose reporting utility that provides hardcopy printout or data set output of information in the database. The utility can obtain any information from the following database records:
view
The SARGRW program is a general purpose reporting utility that provides hardcopy printout or data set output of information in the database. The utility can obtain any information from the following database records:
  • Report Control Record
  • Tape Control Record
The database records are not referenced explicitly, but implicitly using field names. The utility accesses the appropriate database records depending on the field names that are referenced. 
The utility provides free-format control statements to sort, print, output, compare, and select fields from the database. In addition, statements are provided to define report titles, to define special fields, and to manipulate special fields. These special fields can also be used for sorting, printing, and other purposes.
Contents
2
SARGRW Job Control Statements
To execute SARGRW, specify the following JCL:
  • JOB
    Initiates the job.
  • EXEC
    Specifies the program name (PGM=SARGRW) and optionally, the high-level name of the database as the PARM parameter (PARM='VIEW.SYSTEM1').
    You may also need to specify a region size (REGION=4096K is recommended).
  • STEPLIB DD
    Identifies the load library that contains SARGRW.
    If the program resides in a linklist library, you can omit this statement.
  • SYSPRINT DD
    Identifies the sequential output data set (typically the SYSOUT) to which control statements and messages are sent.
    If you do not specify a SYSOUT data set, then specify DCB=BLKSIZE=
    nnn
    , where
    nnn
    represents a number that is a multiple of 133.
  • PRTFILE DD
    Defines the sequential output data set (typically SYSOUT) to which the hardcopy report is to be written using the PRINT control statement.
    Use the CONTROL control statement to change the DD statement name.
  • OUTFILE DD
    Defines the sequential output data set to which records are to be output using the OUTPUT control statement.
    Use the CONTROL control statement to change the DD statement name. The DCB parameters LRECL, BLKSIZE, and RECFM are required to avoid a system error.
  • SORTLIB DD
    Defines the load library containing the sort library programs.
  • SORTWK01 DD
    Defines the sort work disk space.
  • SORTWK02 DD
    Defines the sort work disk space.
  • SORTWK03 DD
    Defines the sort work disk space.
  • SYSOUT DD
    Defines the sort message data set.
  • SYSIN DD
    Specifies the name of the card image data set, where the control statements you want to input are located.
SARGRW Control Statements
Control statements have the following general structure:
/name specifications
  • Code a slash in column 1, followed by the name and specifications for the control statement to be performed.
  • The control statement name and specifications are specified between columns 2 through 72 of the card image.
  • A statement that exceeds 72 characters must be continued on additional statements. When continuing a statement, the specifications can be interrupted anywhere within the syntax structure. The continued specifications are specified between column 1 and 72 of the subsequent statement. Do not begin these statements with a slash as slash designates the beginning of a new control statement.
  • Quoted fields that flow onto additional statements must be continued in column 1 of the subsequent statement. The continued statement cannot begin with a slash.
  • Include a comment within the control statements by coding an asterisk in column 1 of the card image containing the comment.
To execute SARGRW, specify the following control statements:
  • BREAK
    Discontinues processing of a repetitive group of statements (DO control statement) and proceeds with the statement following the repetitive group of statements.
  • CONTINUE
    Performs the next iteration of a repetitive group of statements (DO control statement).
  • CONTROL
    Specifies alternate values for line count, line size, database high-level name, print file DDname, output DDname, and database selection sequence.
  • DEFINE
    Defines the fields to be used to store data or values.
  • DO
    Specifies the beginning of a repetitive group of statements.
  • ELSE
    Specifies the statements to execute when a false condition is determined for an IF control statement.
  • END
    Specifies the end of a repetitive group of statements (DO control statement), the end of a conditional operation (IF control statement), the end of at-end logic (ON control statement), or the end of the control statements.
  • IF
    Specifies the beginning of a conditional operation.
  • NEXT
    Retrieves the next occurrence of a record.
  • ON
    Specifies the statements to execute when no more database records or sort records are available.
  • OUTPUT
    Specifies the writing of data to the output data set.
  • PRINT
    Specifies the writing of data to the print data set.
  • RELEASE
    Specifies to construct and sort a sort record.
  • SELECT
    Specifies a condition or restriction to selection of information from the database.
  • SET
    Specifies the setting of a defined field (DEFINE control statement).
  • SORT
    Specifies a specific sort sequence for use in ordering information that is written to the print and output files.
  • STOP
    Specifies the end of a control statement processing phase.
  • THEN
    Specifies the statements to execute when a true condition is determined for an IF control statement.
  • TITLE
    Specifies the definition of a report title.
Report Writer Field Names
Field names reference and maintain information or data by the general report writer:
  • Database fields reference information from the database.
  • Database fields are presented chronologically and by database record.
  • Defined fields save information independent from the database.
    The DEFINE control statement defines these fields.
  • Reserved fields contain the current date, current time, line size, column position, and so on.
Each field name can contain a single type of data. The types of data that can be maintained are as follows:
  • Binary (B)
  • Character (C)
  • Packed (P)
  • Date (D)
  • Time (T)
Dates are maintained as the number of days from January 1, 1900 in a binary format. Times are maintained as hundredths of seconds in a binary format.
When date fields are output with the OUTPUT control statement, they are output as a 4-byte Julian date in packed decimal as
0CYYDDDF,
where:
  • C
    represents the century as follows:
    • 0 represents years 1900 through 1999
    • 1 represents years 2000 through 2099
  • YY
    represents the last two digits of the year
  • DDD
    represents the day of the year (000 to 366)
  • F
    represents the 4-bit sign character
To alter the appearance of the date field in the output file, use the EDIT function.
Date Field Example
The Julian date '0101025F' represents January 25, 2001.
Sequence in Which Database Records Are Accessed
The SARGRW utility program accesses database records based on the database fields that are referenced. The following guidelines determine the sequence in which database records are accessed:
  • If database fields from the report control record are referenced, database records are retrieved in SYSOUT/Report identifier (ID) sequence.
  • If database fields from the job control record are referenced, database records are retrieved in JOBNAME sequence.
  • If database field from the tape control record are only referenced, database records are sequenced by type of tape (primary, duplex, or disaster recovery) and tape sequence number.
When database fields from the report control record and tape control record are referenced, SARGRW retrieves all tape references for the report including continuation tapes. These tape references are primary backup tapes, duplex backup tapes, and disaster recovery tapes, or a combination of these tape types. The TAPESEQ field identifies the tape sequence number of the tape, and the TAPEPOS fields identify the location on the tape where the report resides. Use the TAPETYPE fields, TAPEDSN fields, or both fields, to determine the type and name of the tape being retrieved.