Working with COBOL Data Object
COBOL Data object corresponds to the structure of COBOL files. The COBOL data object can be associated with File data point. For more details, refer Working with Data Point.
To work with COBOL Data Object, follow below steps:
Step I: Edit, create or import a COBOL data object
- To open and edit an existing data Object, refer to the page Opening Data Object.
- To create a new data object, refer to the page Creating New Data Object.
- To import COBOL copybook as data objects, refer to the page Importing Data Object.
- To create file data object based on data object of another type, refer to the page Creating copy of Data Object as other type.
It is recommended to create data object by importing the structure from the data file or schema file.Here, the COBOL schema file (copybook) is required while importing, which is used in creating COBOL Data Object.
Step II: Configuring attributes
The COBOL Data Object contains following fields. These fields can be edited by clicking on the field and inputting the required value.
- Level: Level number is used to specify the level of data in a record. Level numbers describe the hierarchy of the data items/ variables declared. They are used to differentiate between elementary items and group items. The level numbers include levels from 01 to 49 and special purpose levels 66, 77 and 88.
- Attribute: Displays the name of the field at a certain position in the file. This is a text field and name can be defined as needed. For COBOL data object the name of the field is immaterial. These field names will be used when this data object is used to create data objects of other types.
- Data Type: Displays the datatype associated with the field. This is a list of applicable data types. You can select appropriate type for the field.
- Precision: Displays the precision for the varchar, number and decimal data type. This is a text field and name can be defined as per the data in the file.
- Scale: Displays the scale for the number and decimal data type. This is a text field and name can be defined as per the data in the file.
- Usage: COBOL defines several binary data types. It supports BINARY,COMP,COMP-1,COMP-2,COMP-3,PACKED,USAGE COMP,USAGE COMP-1,USAGE COMP-2,USAGE COMP-3 datatypes.
- Occurs: Occurs specifies how many times a field or group of fields is repeated.
- Transpose: Transpose field is used to change the order of data i.e rows into columns. The repeating rows of data are transposed to single row with repeating columns into single data object only when the transpose field is enabled in Source data object and used in data flow creation. The transpose checkbox is enabled only when the field occurrence (Occur field value) is greater than 1.
- Redefines: Redefines is used to define a storage with different data description. If one or more data items are not used simultaneously, then the same storage can be utilized for another data item. Hence, the same storage can be referred with different data items.
- Depending On: COBOL permits tables that occur a variable number of times, depending on the VALUE field. This is similar to the COBOL OCCURS, except the number of times it occurs varies from record to record.
- Dist Field Start: Dist value will start from after how many bytes
- Dist Field Size: Specifies the size of the distinguished value
- Dist Value: Which records match given dist value those will go into corresponding file
- Value: The Value is an integer which is manually defined for each field and it's defined in the provided text box.
- Description: Displays any details provided for the field. This is a text field and you can enter any detail as need.
Note:
- Following operations are allowed on the database entries: Add, Cut, Copy, Paste, Up, Down, Delete, Promote, Demote, and Search.
- From the list of attributes, multiple attributes can be selected and we can perform/apply these operations.
- To add a new attribute, click Add. By default a new attribute is populated in the last row. If you want to add an attribute at a specific position then, select the attribute in the position prior to it and click Add.
- To search for a specific attribute, enter the keyword in the search bar, and the page displays the related attributes.
Step III: Configuring properties
The properties tab displays the object level details relevant to extract the data from file.
The grid displays following fields,
Property | Description | Default Value | Other possible values |
---|---|---|---|
Conversion Table | Specifies whether the conversion is to ASCII or CP037. | Cp037 | ASCII |
New Line Size | Specifies the size of a newline if a COBOL data file has any new line among records. | 0 | |
Record format | Specifies the format of the file | Fixed | |
Header Offset | Specifies if the header of a COBOL file needs to be ignored. | -1 | |
Record Offset | Specifies the value after which the Distinguished value should be defined. | 0 | |
File Location | Specify the file location | $$SrcFileDir | |
File Name | The name of the schema is assigned as File name along with .ebcdic extension and its editable at runtime | sample1.ebcdic |
Step IV: Save the changes
To save the changes made to the data object, refer Saving Data Object.
- If the changes made to the data object need to be reverted and not saved then, refer Reverting changes in Data Object.
- Once the data object has been created and the changes have been saved then, Close or Unlock the data object so that it is editable by other users. For more information, refer Closing Data Object and Unlocking Data Object.
Viewing sample Data:
Displays preview of data from associated object in the database.
- The Data Files drop down displays the list of individual stage files associated to selected data object for preview, you can select a file and preview the data before loading. The number of files available in Data Files list are based on number of files in staging location.
Following options are available in View Data tab:
- By clicking Refresh, the data displayed is reloaded.
- By clicking Export, the displayed records are exported and saved as excel to default download folder in the machine.