TextPipe: Online Help
    Mainframe Copybook Wizard
 

Submit feedback on this topic 

 Home  User Assistance   Tutorials   How to Use TextPipe
 Menus: File   Edit   Filters[ Wizards  Convert   Unicode   Add   Remove   Replace   Extract   Special   Maps   Restrict ]  Tools   Window   Help   Advanced
Home
Up

 

 

This wizard saves time by creating a large group of filters to convert mainframe data to CSV (comma-separated), Tab-delimited, Pipe-delimited or fixed-width data. If you need the final output in XML, follow this filter with a Convert CSV to XML filter.

Copybook data is accepted in a number of formats - see below.

TextPipe handles fields and groups with a fixed number of repeats (e.g. OCCURS 8 TIMES. or OCCURS 6 INDEXED BY TN-IDX.), it cannot handle data with OCCURS fields which depend on another field (e.g. OCCURS DEPENDING ON FIELDXXX).

To use this wizard, simply paste (or use the right-click menu to load) your copybook data, then click the [Build] button.

When you click the [Build] button, TextPipe first pre-processes the copybook:

  1. Looks for OCCURS DEPENDING ON <FIELD NAME> and flags an error if found (TextPipe can't handle OCCURS depending on a field value)
  2. Removes blank lines, line numbers and comment lines (those with a '*' in column 7)
  3. Removes single field and group REDEFINES - keeping the first definition. Ensure you manually remove any redefines you do not need
  4. Un-word wraps field definitions that are shown over several lines - this can cause errors if your lines do not end with a period '.'
  5. Duplicates single field and group OCCURS clauses
  6. Starts parsing field definitions.

TextPipe then generates a series of filters:

  1. A comment with the entire copybook in it, for future reference
  2. A search/replace to remove any of the existing field delimiters from the source text (to prevent extra fields being created), and replace them with an EBCDIC space
  3. Fields are processed in reverse order i.e. right to left. This is because fields may change size (typically get larger) when processed, so this ensures that column positions do not change
  4. Each field has a comment that shows the field name, size and column positions, and the text extracted from the copybook. This can be used to cross-check the filters created.
  5. Inside the filter comment is a restriction, followed by a filter to expand or convert the data (if not an alpha field). This is followed by an Add Footer filter which outputs the specified field delimiter in EBCDIC form (for CSV, an EBCDIC comma, ASCII k) which then gets converted to an ASCII delimiter later
  6. Filters to trim spaces from each field, and to remove the leading + sign from numeric values. These can be removed if you wish.
  7. A file header is added with the field names.

If TextPipe does not generate filters correctly, please send your copybook to us.

If you have an SAS copybook, then first use the filter mainframe\SAS to mainframe copybook.fll to convert it to the format above.

Output Format

You can choose if TextPipe outputs CSV (comma-separated) data, Tab delimited, Pipe-delimited or Fixed width data. If you need the final output in XML, you can use the Convert CSV to XML filter.

If TextPipe encounters an invalid packed or zoned decimal digit or sign field, it will output 'x' in the field to indicate an invalid value. If a packed or zoned field contains just spaces, TextPipe will output a blank field.

Assume adjacent COMP fields are overlapped

Odd-length COMP fields have half-bytes (nybbles) of unused data. Some compilers overlap adjacent COMP fields in files to save space. Check this option if your files contains overlapped COMP fields.

Your copybook must show the positions of every packed field and any extra filler COMP fields added by your compiler, as the location of these is system-dependant.

Trim leading spaces and zeroes from the output file

By default, TextPipe leaves leading spaces, zeros and even '+' signs on numerics. Check this option to remove them to save space in the output file.

Only handle numeric fields

Check this option if you only wish to expand packed decimal fields for a target application that understands EBCDIC. You will still need to disable the EBCDIC to ASCII conversion filter at the end of the filter list.

Copybook Formats Accepted (*)

(*) TextPipe will also process variations on these types.

Note: If your copybook has group REDEFINE or OCCUR clauses, you must use an indented layout like that below.

01 EMP-RECORD.
  03 EMP-ID PIC 9(6).
  03 EMP-NAME PIC X(30).
  03 EMP-JOIN-DATE.
    05 EMP-JOIN-DATE-YY PIC 9(4).
    05 EMP-JOIN-DATE-MM PIC 9(2).
    05 EMP-JOIN-DATE-DD PIC 9(2).
  03 EMP-BASIC-SALARY PIC 9(12)V99.
    05 EMP-JOIN-DATE-YY PIC X(4).
    05 EMP-JOIN-DATE-MM PIC X(2).
    05 EMP-JOIN-DATE-DD PIC X(2).

    05 EMP-JOIN-DATE-YY PIC 999.
    05 EMP-JOIN-DATE-MM PIC X.
    05 EMP-JOIN-DATE-DD PIC XXX.

Note: The Position in Record column is entirely optional, all TextPipe needs is the field name and definition.

FILE RECORD LAYOUT

                                           FIELD        POSITION
DATA ELEMENT                               DEFINITION   IN RECORD

RECORD CD                                    1 AN          1
PURCHASE REQUEST NUMBER                     14 AN          2-15
PR LINE ITEM NUMBER                          6 AN         16-21
QUANTITY                                     5 P          22-26
UNIT OF ISSUE                                2 AN         27-28
STANDARD UNIT PRICE                          5 P          29-33
FUND CLASS CODE                              3 AN         34-36
STOCK NUMBER                                15 AN         37-51
S/P                                          1 AN         52
OUTPUT ROUTING CODE                          2 AN         53-54
OWNR/PURP                                    1 AN         55

If your copybook is in this format:

Pos Type Name
----- -------------- ------------------
1-20 char ID Num
21-22 char State Code
23-31 char SSN
32-43 char Claim #
44-51 num DOB
52-52 char Sex
53-53 char Race
 

then use the filter mainframe\convert copybook format.fll to convert it to the format above.

 

 

 

 

 Contact Us   Support   Community   Tutorials and User Guides (online)
 Copyright © 1999-2006 DataMystic. All rights reserved.