Creating data sets using a template
When you use a template to create a data set, the template provides structure for the data. You can also use “create attributes” in the template to initialize field values in the data set.
Initialization can be performed at two levels: record level and field level. Field-level initialization takes place when you specify that a copybook or template is to be used. In this case, the record is first filled with the character specified by the Fillchar entry field. Selected fields are then individually initialized using the field create attributes specified in a template.
When File Manager is creating a data set, it uses only the first record type described in the template. The length of the records written depends upon whether the records are fixed-length or variable-length, and the length of the record description in the template:
- For fixed-length records, all records are created with the record length specified for the data set. If the length of the record in the template is less than the data set record length, the records are padded with the value specified for the Fillchar field.
- For variable-length records, the length of each record depends upon the length of the record built using the field attributes in the template. If the template record description contains one or more variable-length arrays, the length of the record varies according to the values assigned to the objects of the OCCURS DEPENDING ON clauses or, in the case of a template created from a PL/I copybook, arrays or variables whose number of elements or length is controlled by a REFER variable.
To create data in a new or existing data set, using a template:
- From the Primary Option Menu panel, select option 3. Utilities and
then option 1. Create.
The Data Create Utility panel is displayed.
- Do one of the following:
- Specify the name of an existing data set; for PDS(E) data sets,
also specify a new or existing member.
The new records replace or are appended to the records in the existing data set or member, depending upon how you set the Disposition Processing Option.
- Specify the name of a new data set; for PDS(E) data sets, also
specify a new member name.
When you press Enter to process this panel, you are asked to allocate and define the new data set.
- Specify the name of an existing data set; for PDS(E) data sets,
also specify a new or existing member.
- If you are creating data in variable length records and you want the new records to have a length less than that of the maximum record size, type a value in the Record length field. Otherwise, leave this field empty. (The field is ignored for fixed length and undefined length records.)
- Enter the number of records that you want to create, in the Records field.
Note: To create an empty data set, specify the number of records as 0.
- To initialize the data at the record level, enter a value in the Fillchar field.
To initialize data at the field level, you must use a template in which the Create Attributes values have been defined for the template fields. If these values have not yet been defined for your template, you can select the Edit Template option and define them as part of this process.
If you would like to include a sequence field as part of the record, you must specify this as part of your template Create Attribute values. When you are using a template, information in the Sequence field position, Sequence field length and Sequence field increment fields is ignored.
- If you have specified the name of a new data set and you want to use another data set as a model, spedify the name of the model data set in the Like data set field.
- Specify your template by doing one of the following:
- In the Copybook or Template Data set name and Member fields, specify the name of an existing copybook or template, then set the Copybook or Template processing option to 1. Above.
- Set the Copybook or Template processing option to 2. Previous. This tells File Manager to use the copybook or template that you have most recently associated with this data set (discrete to each user). File Manager ignores the contents of the Data set name and Member fields.
- Set the Copybook or Template processing option to 4. Create Dynamic. File Manager ignores the contents of the Data set name and Member fields and displays the Dynamic Template panel when you press Enter to process the Create Data panel.
- If you want to run this process as a batch job, select the Batch execution option. See Using File Manager functions in batch jobs for details about using batch mode.
- Select your Disposition, Use I/O exit, Use proc and ISPF Packing Processing Options to suit your needs (see Creating data without using a template for details).
- Press Enter.
If you have specified an existing data set and template, and the process is successful, a message is displayed to show the number of records written to the file.
If you have elected to create a dynamic template, the Dynamic Template panel is displayed. If you have specified an existing template and selected the Edit Template option, the appropriate template editing panel is displayed. When you have finished defining your template, File Manager either creates the records or asks you to allocate a new data set, depending upon whether you specified an existing or new data set name.
If you have specified a new data set name, you are asked to allocate it after your template has been specified or created. When the data set has been successfully allocated, the Data Create panel is displayed again, with a message to show the number of records written to the file.
Related topics