Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved


Chapter 2 The COBOL Copybook Palette : Parse Copybook Data

Parse Copybook Data
Activity
The Parse Copybook Data activity parses incoming COBOL data based on the schema defined in the Copybook Schema resource. The data is converted to XML and can then be used by other activities within a process definition.
Configuration
The configuration tab has the following fields.
The name to appear as the label for the activity in the process definition.
The Copybook Schema shared configuration resource that defines the schema to use to parse the incoming COBOL data into XML.
Are the binary (COMP) numeric values in Big Endian format?
This field specifies the byte order of the incoming data. Check this field to specify the byte order is Big Endian (for example, this format is used on IBM mainframes and some UNIX platforms). Uncheck this field if the byte order is Little Endian (for example, this format is used by MS Windows and some UNIX platforms).
The character set encoding used by string values in the incoming data; also affects the parsing of zoned decimal values. For details, see Handling of Zoned Decimal Items.
Note that only single byte character sets are available in the Parse Copybook Data activity.
Trim Whitespaces from String Values
Check this field to specify that the values converted to text type should have whitespace characters trimmed after parsing. Whitespace characters include:
'\u0009' – HORIZONTAL TABULATION
'\u000A' – LINE FEED
'\u000B' – VERTICAL TABULATION
'\u000C' – FORM FEED
'\u000D' – CARRIAGE RETURN
'\u001C' – FILE SEPARATOR
'\u001D' – GROUP SEPARATOR
'\u001E' – RECORD SEPARATOR
'\u001F' – UNIT SEPARATOR
'\u0000' – NULL CHARACTER
Note: internally a trim() method of Java class String is used.
This field also affects the how the redefine control field values are matched. For details, see Configure REDEFINES.
Check this field’s checkbox to specify that there is more than one record in the input data.
Specifies the delimiter used between records in the input data. The following are the types of delimiters you can specify:
None — specifies that a new record begins directly after the last record ends. There is no character separating each record.
New Line — specifies that a new line character separates records in the input.
Carriage Return — specifies that a carriage return character separates records in the input.
Carriage Return/Line Feed — specifies that a carriage return character followed by a line feed character separates records in the input.
Input can either be a byte array or a file. If the input is a byte array, supply the string to the bytes input item. If the input is a file, supply the file name and location to the fileName input item.
Input
See TIBCO BusinessWorks Process Design Guide for more information about mapping and transforming input data.
The input for the activity is the following.
A byte stream containing COBOL data. If your COBOL data is a text string, you must convert the text to bytes before passing the input data to this activity. You can use the string-to-base64() XPath function to convert text to a byte array. This input item is only available when "Bytes" is specified in the Input Type field on the Configuration tab.
The location and name of the file to read. The file’s contents are used as the input for this activity. This input item is only available when "File" is specified in the Input Type field on the Configuration tab.
This element is only available when File is chosen in the Input Type field on the Configuration tab. This element specifies the number of records to read from the input stream. The default value of this element is "-1" which reads all records in the input stream.
This is useful if you wish to read the input stream in parts to minimize memory usage. For details, see Parsing a Large Number of Records.
Parsing a Large Number of Records
The input for this activity is placed in a process variable and takes up memory as it is being processed. If you are reading a large number of records from a file, the process may consume significant machine resources. To avoid using too much memory, you may wish to read the input in parts, parsing and processing a small set of records before moving on to the next set.
To process a large number of records, follow this procedure:
1.
2.
3.
Select the Parse Copybook Data activity and click the group icon on the toolbar to create a group containing the Parse Copybook Data activity. See TIBCO BusinessWorks Process Design Guide for more information about working with groups.
4.
5.
The loop should exit when the EOF output element for the Parse Copybook Data activity is set to true. For example, the condition for the loop could be set to the following:
   string($ParseCopybookData/Output/EOF) = string(true())
6.
Set the noOfRecords input item for the Parse Copybook Data activity to the number of records you wish to process for each execution of the loop.
7.
The loop processes the specified noOfRecords with each iteration until there are no more input records to parse.
The procedure above is a general guideline for creating a loop group for parsing a large set of input records in parts. You may want to modify the procedure to include additional processing of the records, or you may want to change the XPath expressions to suit your business process.
Output
The output for the activity is the following.
<CopybookSchema>
true if no more records are available for parsing. false if there are more records available.
This output item is useful for checking if there are no more records in the input stream when you are reading the input in parts to preserve memory. See Parsing a Large Number of Records for more information.
Error Output
The Error Output tab lists the possible exceptions that can be thrown by this activity. See TIBCO BusinessWorks Error Codes for more information about error codes and corrective action to take.

Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved