SourceForge.net Logo   JRecord

Record Layouts
 

Record Layouts

  • Cobol
  • RecordEditor XML
  • XML Layout for a CSV file
  • XML File Definition
  • RecordEditor XML Tags
  • Record Tag
  • Field Tag
  • Single Layout Format
  • Multiple record Layout Format
  • DB CSV Copybook format
  • RecordEditor CSV Copybook Format
  • The 2 main formats of RecordLayouts are Cobol and RecordEditor-XML Two other formats worth mentioning are

    Cobol

    The package accepts standard Cobol Copybooks, look up the Cobol definition on the Web for more details. Here is a Sample:

       6:000600*
       7:000700*   RECORD LENGTH IS 27.
       8:000800*
       9:000900        03  DTAR020-KCODE-STORE-KEY.
      10:001000            05 DTAR020-KEYCODE-NO      PIC X(08).
      11:001100            05 DTAR020-STORE-NO        PIC S9(03)   COMP-3.
      12:001200        03  DTAR020-DATE               PIC S9(07)   COMP-3.
      13:001300        03  DTAR020-DEPT-NO            PIC S9(03)   COMP-3.
      14:001400        03  DTAR020-QTY-SOLD           PIC S9(9)    COMP-3.
      15:001500        03  DTAR020-SALE-PRICE         PIC S9(9)V99 COMP-3.
      16:
    

    RecordEditor XML

    Record can be described via XML like the following. The easiest way to define a RecordEditor-XML file is to use the Layout-Wizard

       1:<?xml version="1.0" ?>
       2:<RECORD RECORDNAME="DTAR020" COPYBOOK="DTAR020" DELIMITER="&lt;Tab&gt;" 
       3:        FONTNAME="CP037" FILESTRUCTURE="Default" STYLE="0" RECORDTYPE="RecordLayout"
       4:        LIST="Y" QUOTE="" RecSep="default">
       5:        <FIELDS>
       6:                <FIELD NAME="KEYCODE-NO" POSITION="1"  LENGTH="8" TYPE="Char" />
       7:                <FIELD NAME="STORE-NO"   POSITION="9"  LENGTH="2" TYPE="Mainframe Packed Decimal (comp-3)" />
       8:                <FIELD NAME="DATE"       POSITION="11" LENGTH="4" TYPE="Mainframe Packed Decimal (comp-3)" />
       9:                <FIELD NAME="DEPT-NO"    POSITION="15" LENGTH="2" TYPE="Mainframe Packed Decimal (comp-3)" />
      10:                <FIELD NAME="QTY-SOLD"   POSITION="17" LENGTH="5" TYPE="Mainframe Packed Decimal (comp-3)" />
      11:                <FIELD NAME="SALE-PRICE" POSITION="22" LENGTH="6" DECIMAL="2" TYPE="Mainframe Packed Decimal (comp-3)" />
      12:        </FIELDS>
      13:</RECORD>
    

    Or if there are more than one format used in the file.

       1:<?xml version="1.0" ?>
       2:<RECORD RECORDNAME="ams PO Download" COPYBOOK="" DELIMITER="&lt;Tab&gt;" FILESTRUCTURE="Default" STYLE="0" 
       3:        RECORDTYPE="GroupOfRecords" LIST="Y" QUOTE="" RecSep="default">
       4:        <RECORDS>
       5:                <RECORD RECORDNAME="ams PO Download: Detail" COPYBOOK="" DELIMITER="&lt;Tab&gt;" 
       6:                DESCRIPTION="PO Download: Detail" FILESTRUCTURE="Default" STYLE="0" RECORDTYPE="RecordLayout" 
       7:                LIST="N" QUOTE="" RecSep="default" TESTFIELD="Record Type" TESTVALUE="D1">
       8:                        <FIELDS>
       9:                                <FIELD NAME="Record Type" POSITION="1" LENGTH="2" TYPE="Char"/>
      10:                                <FIELD NAME="Pack Qty" POSITION="3" LENGTH="9" DECIMAL="4" TYPE="Num Assumed Decimal (Zero padded)"/>
      11:                                <FIELD NAME="Pack Cost" POSITION="12" LENGTH="13" DECIMAL="4" TYPE="Num Assumed Decimal (Zero padded)"/>
      12:                                <FIELD NAME="APN" POSITION="25" LENGTH="13" TYPE="Num (Right Justified zero padded)"/>
      13:                                <FIELD NAME="Filler" POSITION="38" LENGTH="1" TYPE="Char"/>
      14:                                <FIELD NAME="Product" POSITION="39" LENGTH="8" TYPE="Num (Right Justified zero padded)"/>
      15:                                <FIELD NAME="pmg dtl tech key" POSITION="72" LENGTH="15" TYPE="Char"/>
      16:                                <FIELD NAME="Case Pack id" POSITION="87" LENGTH="15" TYPE="Char"/>
      17:                                <FIELD NAME="Product Name" POSITION="101" LENGTH="50" TYPE="Char"/>
      18:                        </FIELDS>
      19:                </RECORD>
      20:                <RECORD RECORDNAME="ams PO Download: Header" COPYBOOK="" DELIMITER="&lt;Tab&gt;" 
      21:                DESCRIPTION="PO Download: Header" FILESTRUCTURE="Default" STYLE="0" RECORDTYPE="RecordLayout" LIST="N" 
      22:                QUOTE="" RecSep="default" TESTFIELD="Record Type" TESTVALUE="H1">
      23:                        <FIELDS>
      24:                                <FIELD NAME="Record Type" POSITION="1" LENGTH="2" TYPE="Char"/>
      25:                                <FIELD NAME="Sequence Number" POSITION="3" LENGTH="5" DECIMAL="3" TYPE="Num Assumed Decimal (Zero padded)"/>
      26:                                <FIELD NAME="Vendor" POSITION="8" LENGTH="10" TYPE="Num (Right Justified zero padded)"/>
      27:                                <FIELD NAME="PO" POSITION="18" LENGTH="12" TYPE="Num Assumed Decimal (Zero padded)"/>
      28:                                <FIELD NAME="Entry Date" DESCRIPTION="Format YYMMDD" POSITION="30" LENGTH="6" TYPE="Char"/>
      29:                                <FIELD NAME="Filler" POSITION="36" LENGTH="8" TYPE="Char"/>
      30:                                <FIELD NAME="beg01 code" POSITION="44" LENGTH="2" TYPE="Char"/>
      31:                                <FIELD NAME="beg02 code" POSITION="46" LENGTH="2" TYPE="Char"/>
      32:                                <FIELD NAME="Department" POSITION="48" LENGTH="4" TYPE="Char"/>
      33:                                <FIELD NAME="Expected Reciept Date" DESCRIPTION="Format YYMMDD" POSITION="52" LENGTH="6" TYPE="Char"/>
      34:                                <FIELD NAME="Cancel by date" DESCRIPTION="Format YYMMDD" POSITION="58" LENGTH="6" TYPE="Char"/>
      35:                                <FIELD NAME="EDI Type" POSITION="68" LENGTH="1" TYPE="Char"/>
      36:                                <FIELD NAME="Add Date" DESCRIPTION="Format YYMMDD" POSITION="69" LENGTH="6" TYPE="Char"/>
      37:                                <FIELD NAME="Filler" POSITION="75" LENGTH="1" TYPE="Char"/>
      38:                                <FIELD NAME="Department Name" POSITION="76" LENGTH="10" TYPE="Char"/>
      39:                                <FIELD NAME="Prcoess Type" DESCRIPTION="C/N Conveyable/Non-Conveyable" POSITION="86" LENGTH="1" TYPE="Char"/>
      40:                                <FIELD NAME="Order Type" POSITION="87" LENGTH="2" TYPE="Char"/>
      41:                        </FIELDS>
      42:                </RECORD>
      43:                <RECORD RECORDNAME="ams PO Download: Allocation" COPYBOOK="" DELIMITER="&lt;Tab&gt;" 
      44:                DESCRIPTION="Allocation Line" FILESTRUCTURE="Default" STYLE="0" RECORDTYPE="RecordLayout"
      45:                LIST="N" QUOTE="" RecSep="default" TESTFIELD="Record Type" TESTVALUE="S1">
      46:                        <FIELDS>
      47:                                <FIELD NAME="Record Type" POSITION="1" LENGTH="2" TYPE="Char"/>
      48:                                <FIELD NAME="DC Number 1" POSITION="3" LENGTH="4" TYPE="Num (Right Justified zero padded)"/>
      49:                                <FIELD NAME="Pack Quantity 1" POSITION="7" LENGTH="8" TYPE="Num (Right Justified zero padded)"/>
      50:                                <FIELD NAME="DC Number 2" POSITION="15" LENGTH="4" TYPE="Num (Right Justified zero padded)"/>
      51:                                <FIELD NAME="Pack Quantity 2" POSITION="19" LENGTH="8" TYPE="Num (Right Justified zero padded)"/>
      52:                                <FIELD NAME="DC Number 4" POSITION="39" LENGTH="4" TYPE="Char"/>
      53:                                <FIELD NAME="Pack Quantity 4" POSITION="43" LENGTH="8" TYPE="Num (Right Justified zero padded)"/>
      54:                                <FIELD NAME="DC Number 5" POSITION="51" LENGTH="4" TYPE="Num (Right Justified zero padded)"/>
      55:                                <FIELD NAME="Pack Quantity 5" POSITION="55" LENGTH="8" TYPE="Num (Right Justified zero padded)"/>
      56:                                <FIELD NAME="DC Number 6" POSITION="63" LENGTH="4" TYPE="Num (Right Justified zero padded)"/>
      57:                                <FIELD NAME="Pack Quantity 6" POSITION="67" LENGTH="8" TYPE="Num (Right Justified zero padded)"/>
      58:                                <FIELD NAME="DC Number 7" POSITION="75" LENGTH="4" TYPE="Num (Right Justified zero padded)"/>
      59:                                <FIELD NAME="Pack Quantity 7" POSITION="79" LENGTH="8" TYPE="Num (Right Justified zero padded)"/>
      60:                                <FIELD NAME="DC Number 8" POSITION="87" LENGTH="4" TYPE="Num (Right Justified zero padded)"/>
      61:                                <FIELD NAME="Pack Quantity 8" POSITION="91" LENGTH="8" TYPE="Num (Right Justified zero padded)"/>
      62:                                <FIELD NAME="DC Number 9" POSITION="99" LENGTH="4" TYPE="Num (Right Justified zero padded)"/>
      63:                                <FIELD NAME="Pack Quantity 9" POSITION="103" LENGTH="8" TYPE="Num (Right Justified zero padded)"/>
      64:                                <FIELD NAME="DC Number 10" POSITION="111" LENGTH="4" TYPE="Num (Right Justified zero padded)"/>
      65:                                <FIELD NAME="Pack Quantity 10" POSITION="115" LENGTH="8" TYPE="Num (Right Justified zero padded)"/>
      66:                        </FIELDS>
      67:                </RECORD>
      68:        </RECORDS>
      69:</RECORD>
    

    XML Layout for a CSV file

    Following is an example of a CSV file (Tab Field Seperator). Key fields for Delimited files

    RECORDTYPE

    For CSV files it must be RECORDTYPE="Delimited".

    DELIMITER

    Holds the field delimiter. i.e. DELIMITER="," for comma; For a Tab see below.

    FILESTRUCTURE

    File Structure,

    • if the names are held on the first line of the file. use FILESTRUCTURE="CSV_NAME_1ST_LINE". You must define at least one field (input files). If the Layout is to be used to write out files; you must define all fields
    • Otherwise use FILESTRUCTURE="default"

    POSITION

    The Field Number (1 = first field etc).

    LENGTH

    Should not be entered (or be negative).

       2:<RECORD RECORDNAME="csv_DTAR020" COPYBOOK="csv_DTAR020" DELIMITER="&lt;Tab&gt;" 
       3:        FILESTRUCTURE="CSV_NAME_1ST_LINE" 
       4:        STYLE="0" RECORDTYPE="Delimited" LIST="Y" QUOTE="" RecSep="default">
       5:        <FIELDS>
       6:                <FIELD NAME="keycode-no" DESCRIPTION="keycode-no" POSITION="1" TYPE="Char"/>
       7:                <FIELD NAME="Store-No"   DESCRIPTION="Store-No"   POSITION="2" TYPE="Char"/>
       8:                <FIELD NAME="Date"       DESCRIPTION="Date"       POSITION="3" TYPE="Char"/>
       9:                <FIELD NAME="Dept-No"    DESCRIPTION="Dept-No"    POSITION="4" TYPE="Char"/>
      10:                <FIELD NAME="Qty-Sold"   DESCRIPTION="Qty-Sold"   POSITION="5" TYPE="Char"/>
      11:                <FIELD NAME="Sale-Price" DESCRIPTION="Sale-Price" POSITION="6" TYPE="Char"/>
      12:        </FIELDS>
      13:</RECORD>
    

    XML File Definition

    For XML files, The fields XML~* and Following~Text are required and must be defined in the sequence as below.

       2:<RECORD RECORDNAME="Xml_DTAR020_Copybook" COPYBOOK="Xml_DTAR020_Copybook" FILESTRUCTURE="XML_Use_Layout" 
       3:        STYLE="0" RECORDTYPE="GroupOfRecords" LIST="Y" QUOTE="" RecSep="default">
       4:        <RECORDS>
       5:                <RECORD RECORDNAME="ExportData" COPYBOOK="Xml_DTAR020_Copybook_ExportData" FILESTRUCTURE="XML_Use_Layout" 
       6:                        STYLE="0" RECORDTYPE="XML" LIST="N" QUOTE="" RecSep="default">
       7:                        <FIELDS>
       8:                                <FIELD NAME="Xml~Name"       POSITION="0" TYPE="XML Name Tag"/>
       9:                                <FIELD NAME="Xml~End"        POSITION="1" TYPE="Check Box True / Space"/>
      10:                                <FIELD NAME="Following~Text" POSITION="2" TYPE="Edit Multi Line field"/>
      11:                                <FIELD NAME="Xml~Prefix"     POSITION="3" TYPE="Char"/>
      12:                                <FIELD NAME="Xml~Namespace"  POSITION="4" TYPE="Char"/>
      13:                        </FIELDS>
      14:                </RECORD>
      15:                <RECORD RECORDNAME="DTAR020" COPYBOOK="Xml_DTAR020_Copybook_DTAR020" FILESTRUCTURE="XML_Use_Layout" 
      16:                        STYLE="0" RECORDTYPE="XML" LIST="N" QUOTE="" RecSep="default">
      17:                        <FIELDS>
      18:                                <FIELD NAME="Xml~Name"       POSITION="0"  TYPE="XML Name Tag"/>
      19:                                <FIELD NAME="Xml~End"        POSITION="1"  TYPE="Check Box True / Space"/>
      20:                                <FIELD NAME="Following~Text" POSITION="2"  TYPE="Edit Multi Line field"/>
      21:                                <FIELD NAME="Xml~Prefix"     POSITION="3"  TYPE="Char"/>
      22:                                <FIELD NAME="Xml~Namespace"  POSITION="4"  TYPE="Char"/>
      23:                                <FIELD NAME="KEYCODE-NO"     POSITION="5"  TYPE="Char"/>
      24:                                <FIELD NAME="STORE-NO"       POSITION="6"  TYPE="Char"/>
      25:                                <FIELD NAME="DATE"           POSITION="7"  TYPE="Char"/>
      26:                                <FIELD NAME="DEPT-NO"        POSITION="8"  TYPE="Char"/>
      27:                                <FIELD NAME="QTY-SOLD"       POSITION="9"  TYPE="Char"/>
      28:                                <FIELD NAME="SALE-PRICE"     POSITION="10" TYPE="Char"/>
      29:                        </FIELDS>
      30:                </RECORD>
      31:                <RECORD RECORDNAME="/ExportData" COPYBOOK="Xml_DTAR020_Copybook_/ExportData" FILESTRUCTURE="XML_Use_Layout" 
      32:                        STYLE="0" RECORDTYPE="XML" LIST="N" QUOTE="" RecSep="default">
      33:                        <FIELDS>
      34:                                <FIELD NAME="Xml~Name"       POSITION="0" TYPE="XML Name Tag"/>
      35:                                <FIELD NAME="Xml~End"        POSITION="1" TYPE="Check Box True / Space"/>
      36:                                <FIELD NAME="Following~Text" POSITION="2" TYPE="Edit Multi Line field"/>
      37:                        </FIELDS>
      38:                </RECORD>
      39:        </RECORDS>
      40:</RECORD>
    

    RecordEditor XML Tags

    In recordEditor XML all attributes must be in quotes. i.e Length="12" and not Length=12.

       1:<RECORD ...>
       2:        <FIELDS>
       3:                <FIELD .../> <!-- one or more fields -->
       4:        </FIELDS>
       5:</RECORD>
    

    Record Tag

    Contains one record Definition. It can contain either sub-records held in a <records> tag or Fields in a <Fields>. Only one level of record nesting is allowed. You can not nest records within records within records.

    Attributes on a Record tag:

    RecordName

    Records Name

    Delimiter

    Field Delimiter for CSV files.

    FontName

    Java name of the font. Normally this can be left out / spaces. Use CP037 for reading native mainframe on a PC / Linux.

    FileStructure

    File Structure, Normally you can use default. Possible values are

    • Default Standard file, The system will work out the structure from the layout Details
    • CSV_NAME_1ST_LINE Csv file with names on the first Line in the file.
    • Fixed_Length Fixed Record Lines
    • Mainframe_VB Mainframe VB file. Consists of a Big ending Length + data.
    • Mainframe_VB_As_RECFMU Mainframe VB file with the block descriptor record.
    • FUJITSU_VB Fujitsu Cobol (PC) VB file consisting of Length at the start and end of a line.
    • XML_Use_Layout XML with all attributes defined in the Layout Definition
    • XML_Build_Layout XML - build the layout as it is Read in.
    • TextText file, Used internally, but would suggest using default.

    RecordType

    Type of Record. Values are

    • RecordLayout Standard Record that consists of a series of fields.
    • Delimited A CSV record. Contains a series of fields.
    • XML A XML record. Contains a series of fields.
    • BinaryRecord Fixed Length Record (i.e. all lines are the same length). It could contain binary fields.
    • GroupOfRecords Record consists of series of Sub-Records.

    Style

    Should be 0 (zero).

    RecSep

    Record Separator. Leave as default.

    TestField

    When there are more records in a file, If the value of this field equals TestValue This record will be used..

    TestValue

    The value the TestField is compared with.

    Other

    Other Tags like List, Copybook are used by the RecordEditor and can be left out.

    Field Tag

    Used to define a field. Attribute available include

    Name

    Field Name

    Position

    For flat (fixed field width) files it is the character position of the field. For CSV/XML fields, it is the field number.

    Length

    Field Length. Do not code for CSV / XML fields.

    Decimal

    The number of decimal places in a numeric field

    Type

    Field Type - possible values are
    Id Type Name Description
    0 Char Text Field
    1 Char (right justified) Right Justified Text Field
    2 Char Null terminated Character String that is terminated by nul (0h). C-style string.
    3 Char Null padded Character String that is null padded on the right
    4 Hex Hex Field (max length 8 bytes).
    5 Num (Left Justified) Left justified numeric field
    6 Num (Right Justified space padded) Right Justified space padded Numeric field
    7 Num (Right Justified zero padded) Right Justified zero padded Numeric field
    8 Num Assumed Decimal (Zero padded) Right Justified zero padded Numeric field with an assumed Decimal space
    9 Num Sign Separate Leading Numeric Sign separate from the field and at the front.
    10 Num Sign Separate Trailing Numeric Sign separate from the field and at the end of the field.
    11 Decimal Unsigned Decimal (i.e. 121 is represented as hex x'0121'
    15 Binary Integer PC format (i.e. Low to High) Binary integer. A value of 255 is represented as hex x'FF00'.
    16 Positive Binary Integer PC format positive Integer
    17 Float Standard Floating point number
    18 Double Standard Double
    21 Bit Show the individual bits.
    31 Mainframe Packed Decimal (comp-3) Mainframe packed decimal (Pic s9(#) comp-3 in mainframe Cobol). In this format, 255 would be stored as hex x'255F'
    32 Mainframe Zoned Numeric Corresponds to Cobol PIC S999. on the mainframe.

    The format dates to the Punch Card days when a fields sign was entered by over punching the last byte of a numeric field. This saved 1 byte per numeric field - big advantages in the 1960's.

    35 Binary Integer Big Endian (Mainframe, AIX etc) Standard Java / Mainframe / Power PC /etc Binary Integer. The number of is stored as high to low format i.e. 255 is stored as hex x'00FF'.
    41 Fujitsu Zoned Numeric Fujitsu Cobol Zoned Numeric
    71 Date - Date Format is held in Parameter field (on the record Definition table).
    72 Date - Format YYMMDD
    73 Date - Format YYYYMMDD
    74 Date - Format DDMMYY
    75 Date - Format DDMMYYYY
    110 Check Box True / Space
    111 Checkbox Y/N for a Y/N field (ie Yes / No)
    112 Checkbox T/F for a T/F field (ie True / False)
    115 CSV array
    116 XML Name Tag
    117 Edit Multi Line field Display a text file that contains more than one line. It primarly for XML files.

    Description

    Field Description. In the editor it is the column help.

    Single Layout Format

    If there is only one record in a Layout the format is as follows.

       1:<RECORD ...>
       2:        <FIELDS>
       3:                <FIELD .../> <!-- one or more fields -->
       4:        </FIELDS>
       5:</RECORD>
    

    Multiple record Layout Format

    When there are more than one record in a file, You need to define sub-record's within the record as follows. Also you should enter TestField and TestValue fields. These are used to determine which record to use.

       1:<RECORD ... >
       2:        <RECORDS>
       3:                <RECORD ... TESTFIELD="Record Type" TESTVALUE="D1">
       4:                        <FIELDS>
       5:                                <FIELD .../>
       6:                                ...
       7:                        </FIELDS>
       8:                </RECORD>
       9:                <RECORD ... TESTFIELD="Record Type" TESTVALUE="H1">
      10:                        <FIELDS>
      11:                                <FIELD .../>
      12:                                ...
      13:                        </FIELDS>
      14:                </RECORD>
      15:        </RECORDS>
      16:</RECORD>
    

    DB CSV Copybook format

    The DB Format is for viewing / editing DB2-UDB delimited table exports files. The following SQL will generate SQL to create a copybook file for each table.

       1:SELECT 'EXPORT TO "C:\Data\RecordEditor\CsvCopybooks\'  || TabName || '.Csv" OF DEL MESSAGES "C:\export.txt"  '
       2:    || 'SELECT ''DB_DVMT_'' || c.TABSCHEMA, c.TABNAME, c.COLNAME, c.COLNO, c.TYPENAME, c.LENGTH, c.SCALE '
       3:    ||  ' FROM SYSCAT.COLUMNS AS c '
       4:    || ' where c.TABSCHEMA = ''' || TABSCHEMA || ''' and c.TABNAME = ''' || TabName || ''' '
       5:    || ' ORDER BY  c.TABNAME ASC, c.COLNO ASC; '
       6:FROM SYSCAT.TABLES where TABSCHEMA = 'ETB';;
       7:
       8:
    

    RecordEditor CSV Copybook Format

    The Record Editor is a Copybook Transfer format. You can create files in this format via the RecordEditor - LayoutEditor - Copy-Option. You can also cut from the RecordLayout editor and paste into a normal Text Editor.

    The format of the file is basically a tab delimited file with the following fields

    1. Position - where the field starts on a line
    2. Field Length
    3. Field Name
    4. Description - Field description
    5. Field Type
    6. Decimal - number of decimal places
    7. Cell Format - How to format the cell in the editor.
    8. Parameter - for Cell Format / Type. This is used by the Editor

     

    JRecord at SourceForge Download Page Forums