Model 204
USE OF AND ACCESS TO PRODUCTS AND FEATURES ARE IN ACCORDANCE WITH THE TERMS AND CONDITIONS OF THE USERS SOFTWARE LICENSE. THE PRESENTATION OF MATERIAL HEREIN DOES NOT, IN ANY MANNER, MODIFY SUCH TERMS AND CONDITIONS.
The COPY STREAM Command: A Sequential Dataset Copy Utility By James Damon
Under all operating systems, the COPY STREAM (or COPY DATASET) command is essentially a general purpose, sequential-dataset copy utility that you can issue from a Model 204 Online session to copy datasets. The command is especially useful under VM where utilities for copying sequential datasets residing on OS-format volumes are nonexistent. Even under VSE and OS, where sequential copy utilities do exist, for small to medium-size datasets it may be more expedient to use COPY STREAM than to submit a batch job to copy a dataset.
Although the COPY STREAM command was developed primarily to convert a CCAJRNL ring stream to a sequential dataset for archival purposes, over time several other handy uses have come to light. Using the COPY STREAM command, you can:
Creating a reusable copy utility Using the syntax for the COPY STREAM command as described in detail in the Model 204 Command Reference Manual, you can create a reusable, generalized copy utility in the form of a procedure, as shown in Figure 1. This procedure, using dummy string variables to prompt for input and output dataset names, copies a sequential dataset to an existing, output sequential dataset. It can be further generalized to copy to a new output dataset.
FREE INFREE OUTDEFINE DATASET IN WITH SCOPE=SYSTEM OLD SEQUENTIAL - DSN=??INPUTDSNDEFINE DATASET OUT WITH SCOPE=SYSTEM OLD SEQUENTIAL - DSN=??OUTPUTDSNCOPY STREAM IN TO OUTFREE IN FREE OUT
Creating an exact copy of a dataset If you are copying to a new dataset and requesting that Model 204 allocate the dataset, omit the BLKSIZE, LRECL and RECFM parameters in the DEFINE DATASET command, as shown in Figure 2. This forces Model 204 to use the data control block (DCB) attributes from the input dataset; the result is an identical copy of the dataset, including DCB attributes. This exact copy feature is equivalent to other copy utilities, such as IEBGENER, FDR, or DFDSS.
Figure 2. Backing up a sequential dataset
FREE INFREE OUTDEFINE DATASET IN WITH SCOPE=SYSTEM OLD SEQUENTIAL - DSN=??INPUTDSNDEFINE DATASET OUT WITH SCOPE=SYSTEM NEW CATALOG - SEQUENTIAL TRK PRI n SEC n DSN=??OUTPUTDSN - VOLUME=volser UNIT=unitCOPY STREAM IN TO OUTFREE IN FREE OUT
The COPY STREAM command simply copies all physical blocks from the input dataset to the output dataset, one block at a time. When the command completes, the number of blocks copied is displayed, as shown in Figure 3.
Figure 3. COPY command success messages
*** M204.1858: COPY COMMAND COMPLETED*** M204.1859: 500 BLOCKS HAVE BEEN COPIED TO OUTPUT STREAM/DATASET
Creating a test dataset You can also use the COPY STREAM command to copy only a portion of the original input dataset. For example, you may want to copy a small sample of a large dataset to a smaller, test dataset. Using the COUNT option, you can limit the number of blocks (not records) copied from the input to the output dataset, as shown in Figure 4.
Figure 4. Creating a test file and success messages
COPY STREAM IN TO OUT COUNT=100*** M204.1858: COPY COMMAND COMPLETED*** M204.1859: 100 BLOCKS HAVE BEEN COPIED TO OUTPUT STREAM/DATASET
A Simple Backup Utility Another use of the COPY STREAM command is to make dataset backups. For example, you can make a backup copy of CCASTAT, the Model 204 password dataset. There are no special utilities for performing this function because this dataset is a small, simple sequential dataset. Figure 5 shows how the COPY STREAM command can easily make a backup copy.
Figure 5. Backing up CCASTAT
DEFINE DATASET STATIN WITH SCOPE=SYSTEM OLD SEQUENTIAL - DSN=CCA.PROD.CCASTATDEFINE DATASET STATOUT WITH SCOPE=SYSTEM NEW SEQUENTIAL - DSN=CCA.PROD.CCASTAT.BKUP TRK PRI 1 SEC 1 - VOLUME=CCA001 UNIT= COPY STREAM STATIN TO STATOUT
Reviewing Ring Streams The COPY STREAM command is required to convert a CCAJRNL ring stream into a sequential dataset. To create a complete copy of the ring stream in sequential format, Model 204 reads the control dataset defined for the ring stream to determine which ring members and offload datasets, and in what order, must be copied to the output stream. Consult the Model 204 Command Reference Manual for additional command keywords to use when copying a CCAJRNL ring.
In Summary The COPY STREAM command is a quick, convenient way to copy datasets while logged in as a user in a Model 204 Online session without submitting jobs using third-party utilities.
System 1032
Back to Basics, Part 2 Data Values By Tym Stegner
In the June 2004 article of this series, we reviewed the components of the System 1032 environment. In this article, we focus on the basic unit of the DBMS environment, the data value. While a data value is the basic building block of the environment, each data value is defined and stored within a dataset (or table) structure comprised of columns and rows. This article examines your data values and helps you determine what columns you want in your datasets.
Describing Data Values To store data values, such names, addresses, appointments, salary figures, sales figures, photo IDs, results of tests, temperatures, and taxes, you must have a description of the data you are storing. These descriptions are called data definitions and are coded using PL1032 DDL, the command language of the System 1032 DBMS and its Data Definition Language. In System 1032 the value definitions are called attribute definitions, where the attribute is the column or field of a tabular table.
At a minimum each attribute has a primary name and a data type. Many other options exist to further quantify the type of data stored by the attribute. Before these qualities can be defined, however, you must first decide the most appropriate data type for each attribute.
Choosing the Appropriate Data Type How efficiently System 1032 can store, manipulate, and retrieve data values is based on the attribute types defined. Although you may define attributes in a particular order, this might not correlate to the arrangement of data within the dataset. System 1032 compacts data elements together to achieve efficient storage, thus maximizing the amount of data retrievable in the least number of IO operations. In light of this capability, it behooves you to choose appropriate data types to store your data values. .
Reviewing Data Types The data type of an attribute determines what and how the data value for that attribute is stored and displayed and how it is handled when you make queries against your data. It also determines default validations that System 1032 can perform while you enter or update data.
Whether you are creating a dataset for the first time or from data you already have, or you are reviewing how the datasets you have had for years at your site are defined, think of data as falling into roughly the following classifications:
Considering Text Data While you can store most any data as text, it is wise to make use of the intrinsic System 1032 data validation capabilities to ensure proper data is input, by choosing the data type that best describes the data values you want to storeeven text data can be handled in several ways. The System 1032 text and related data types are described in Table 1.
Table 1. Text data types
Text n and Text Varying Data When choosing text data types, you must decide between fixed length text (Text n) or varying length text (Text Varying). Storing data as Text Varying is convenient, but not necessarily efficient. Fixed text values are stored as part of the internal record, text varying data is stored in a completely separate structure within the dataset, tagged with the proper record number, because System 1032 does not know in advance how much space to set aside.
The intrinsic overhead associated with Text Varying amounts to about 16 characters of space per attribute, per record. Keep in mind:
In a study of this topic, I found the break-even point to be around the 80-character mark. If your text values are 80 characters or fewer, just use fixed-length Text for your data, instead of incurring the overhead of Text Varying.
Binary Varying Data Binary Varying, also known as a Binary Large OBject (BLOB, and similar to a MS Memo field), is the catch-all data type for very large value sizes. There is much flexibility in the storage arrangements; you can choose to store the entire data in a single segment or use multiple same-sized segments for the data value.
Considering Numeric Data The System 1032 Numeric data types are described in Table 2. Table 2. Numeric data types
Proper classification of numeric data is very important in System 1032 data definitions. Although System 1032 is very forgiving if a value is not stored in its most efficient state, your applications pay a price of extra overhead from decreased storage efficency and, sometimes, with decreased precision of values derived from attributes used in calculations.
Considering Times and Dates System 1032 can store date and time values, as shown in Table 3. Storing dates and times as such gives you greater flexibility to manipulate and calculate against the values.
Table 3. Date and time attribute definitions
The advantange of storing dates and times as one of the data types in Table 3, instead of Text n, is that you can add limits in the definitions to prevent errors at the time of data entry. You can also add and subtract the date-time values when you make queries, which is not possible when you define them as text. Details of how to do this will be discussed in a later article on System 1032 fundamentals.
Considering the Composite Data Types Before the introduction of ODBC with its heavy reliance on relational data, the composite data types were a very important means of storing related data. You may be storing data in Arrays, Groups, or an Array of Group at your site. The System 1032 ODBC Driver can handle these data types, although you probably would not include them in the design of a new application.
Table 4. Quick overview of the composite data types
Introducing the Special Data Types The data types listed in Table 5 are called special because you do not supply the data values; System 1032 does that. You simply define the attribute when you define the dataset; the values are filled in during record entry or update. Database-generated data is stored on a per-record basis. You have Read-only access to Special data type values.
Figure 5. System 1032 generated attribute definitions and values
In Summary
Data values are the be-all and end-all of any database management system, because data is what you are managing, updating, accessing, and displaying. System 1032 offers many features of its dataset definition to enable you to accurately store and manage various types of data.
Copyright © 2008 Computer Corporation of America. All right reserved. Published in the United States of America.
Contact CCA Webmaster Copyright 2008