HomeStartingEnvironmentDBMSVisualPQLProceduresSQLFormsHost/APIIndex
PQL Procedures homecontents start chapter top of pagebottom of pagenext page index SIR Save File

SIR Save File

The SIR SAVE FILE procedure creates a sequential file in the same format as that produced by the UNLOAD and SIR SUBSET utilities. Reload this file to create a new SIR/XS database or use the SIR MERGE utility to merge this file into an existing database.

The output records all have the same format and record type. Variables carry with them all variable schema information, including valid values, variable ranges, missing values, variable labels and value labels.

SIR SAVE FILE does not produce an INPUT FORMAT or DATA LIST with input columns. Using this procedure is equivalent to having defined a record schema using the variable declarations of internal storage types and sizes. Once the new database has been reloaded, the schema may be modified to specify input columns for Batch Data Input use.

Many of the options on this command specify schema information for the database that is created when the file is reloaded.

Note that the SIR SAVE FILE procedure cannot be run from a PROGRAM. It must be run from a database RETRIEVAL.

SIR SAVE FILE
         { {DATABASE  = database_name | FILENAME = filename } |
            DATABASE = database_name   FILENAME  = filename  }
            RECTYPE = recnum [, recname]

     [ {CASEID   = varname [(D | A)] | NOCASEID }]
     [ VARIABLES = var_list ]
     [ SORTIDS   = variable [(D | A)] ...  ]
     [ NOFCASES  = number  ]
     [ RECSCASE  = number  ]
     [ MAXTYPES  = number  ]
     [ MAXRECS   = number  ]
     [ MAXKEYSZ  = number  ]
     [ SAMPLE    = fraction]
     [ BOOLEAN   = (logical_expression) ]
     [ NOLABELS ]
DATABASE Specify either the name of the new database or a filename or both. If not specified, the name defaults to the attribute name assigned to the file. The name must comply with the rules for naming a SIR/XS database. The password for the new database is the same as the password of the original database.

FILENAME Specify the name of the output file. If not specified, a file with the same name as the DATABASE clause is written.

RECTYPE Specifies the record number of the records when reloaded in the new database. This clause is required. The record name is optional, if it is omitted, a default name in the form RECn is assigned.

VARIABLES Specifies the procedure variables to form the new database record type. The order in which they are specified becomes the data list order.

CASEID Specifies the procedure variable used as the Case Id in the new database. If the CASEID clause is omitted, the case id of the original database is used for the new database. The original case id must be included as a procedure variable. To alter the default sort sequence, specify D for Descending or A for Ascending in parentheses following the variable name.

NOCASEID Specifies that a caseless database is created.

SORTIDS Specifies the Key Fields of the new database record type. By default, the records are sorted in Ascending order by Key Field (Sort ID) value. To alter the default sort sequence, specify D for Descending or A for Ascending in parentheses following the variable name.

BOOLEAN Specifies which procedure table records are used by the procedure. The procedure table records for which the logical expression is true are used by the procedure. If this option is not specified, all procedure table records are used.

SAMPLE Specifies that a random sample of the procedure table records are used by the procedure.
The fraction specifies the percent of records used and is specified as a positive decimal number less than or equal to 1 (one). .25, for example specifies that a 25% sample be used.

MAXKEYSZ Specifies the maximum key size for the new database. This clause is the equivalent of the database parameter MAX KEY SIZE. If this clause is omitted, the value from the original database or the size implied by this record type (if it is larger) is used.

MAXRECS Specifies the maximum number of records per case of any record type in the new database. This clause is the equivalent of the database parameter MAX REC COUNT. If this clause is omitted, the value from the original database is used.

MAXTYPES Specifies the maximum number of record types in the new database. This clause is the equivalent of the database parameter MAX REC TYPES. If this clause is omitted, the MAX REC TYPES of the original database is used.

NOFCASES Specifies the maximum number of cases in the new database. This clause is the equivalent of the N OF CASES database parameter. If this clause is omitted, the N OF CASES specification from the original database is used.

RECSCASE Specifies the average number of records per case in the new database. This clause is the equivalent of the RECS PER CASE database parameter. If this clause is omitted, the RECS PER CASE specification from the original database is used.

NOLABELS Specifies that variable and value labels for the variables used in the procedure are not transferred to the new database.

Example

The requirement is to extract from an educational database, a new database where a case includes all students in a grade level and record type 10 contains essential information on each student.

SIR SAVE FILE    DATABASE  = EDUCAT /
                 FILENAME  = SAVE /
                 CASEID    = GRADE /
                 RECTYPE   = 10 , STUDENTS/
                 SORTIDS   = STUDNO /
                 VARIABLES = STUDNO , GRADE , AGE , SEX ,IQ

homecontents start chapter top of pagebottom of pagenext page index