IBM Sterling Transformation Extender

Sterling Transformation Extender

Come for answers, stay for best practices. All we're missing is you.

 View Only
Expand all | Collapse all

COBOL Copybook - process header, unkown number of record detail, trailer - newbie question

  • 1.  COBOL Copybook - process header, unkown number of record detail, trailer - newbie question

    Posted Tue October 31, 2006 03:43 PM

    Originally posted by: rarw


    Hi,

    We recently obtained Datastage Tx and need to start processing cobol records. Listed below is an example of a copybook and data file. Please inform us on how to determine when to start reading the tailer - the actual record count will be unknown. What rules and/or properties need to be set in the type tree to handle an unkown number of records and then process a trailer? -Thanks for your help in advance.

    copybook:
    01 TEST-HDDR.
    05 HDDR-ID PIC X(4).
    05 CREATE-DATE PIC 9(8).
    05 FILLER PIC X(37).
    01 TEST-RECORD.
    05 SSN PIC 9(9).
    05 NAME PIC X(20).
    05 DESC PIC X(20).
    01 TEST-TRLR.
    05 TRLR-ID PIC X(4).
    05 NUM-RECS PIC 9(8).
    05 FILLER PIC X(37).

    data:
    HDDR20061031
    123456789Anthony Sessions GO FOR BROKE
    987654321MICKEY MOUSE HELLO MINNEY
    615273653DONALD DUCK WHAT THE... HEY
    TRLR00000003
    #DataExchange
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender


  • 2.  Re: COBOL Copybook - process header, unkown number of record detail, trailer - newbie question

    Posted Tue October 31, 2006 04:32 PM

    Originally posted by: NancyR


    You'll have a group to describe your data that has components:
    TEST-HDDR.
    TEST-RECORD.
    TEST-TRLR.

    You'll need to add a range of s to the TEST-RECORD to show there may be many of them. Then you'll need to add a component rule of LEFT($,4)!="TRLR" to the TEST-RECORD component so the WTX engine can distinguish the TEST-RECORDs from he TEST-TRLR.

    You may also want to add a component rule of $=COUNT(TEST-RECORD)to the NUM_RECS field in the TEST-TRLR so the WTX engine can check to make sure the number of TEST-RECORDs matches the value in this field.
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender
    #DataExchange


  • 3.  Re: COBOL Copybook - process header, unkown number of record detail, trailer - newbie question

    Posted Wed November 01, 2006 08:47 AM

    Originally posted by: SystemAdmin


    I work with rarw. Thank you for the reply. The LEFT($,4)!="TRLR" did not work but ISNUMBER did.

    I want to add some comlexity to this. The following COBOL Copybook represents a file we have to handle. It has repeating data with different structures. The two CNT elements states how many of each type... the values could be 02 and 05. Section1 would be repeated two times and Section2 would be repeated 5 times and the remaining 41 occurences (of 10 characters)would be filled with spaces. For each record the CNTs/Data changes.

    Can you explain to us how to configure this Type Tree? Would it need partitioning? Thank you in advace.

    01 RECORD.
    02 DATA-ELEMENT1 PIC X(1).
    02 DATA-ELEMENT2 PIC X(1).
    02 DATA-ELEMENT3 PIC X(1).
    02 SECT1-CNT PIC 9(2).
    02 SECT2-CNT PIC 9(2).
    02 SECTION-1 OCCURS 24 TIMES.
    03 DATA-ELEMENT4 PIC 9(2).
    03 DATA-ELEMENT5 PIC 9(3).
    03 FILLER PIC X(5).
    02 SECTION-2 OCCURS 24 TIMES REDEFINES SECTION-1.
    03 DATA-ELEMENT6 PIC 9(1).
    03 DATA-ELEMENT7 PIC 9(4).
    03 DATA-ELEMENT8 PIC 9(3).
    03 DATA-ELEMENT9 PIC 9(2).

    #DataExchange
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender


  • 4.  Re: COBOL Copybook - process header, unkown number of record detail, trailer - newbie question

    Posted Wed November 01, 2006 08:59 AM

    Originally posted by: janhess


    Your description of the data structure can't be correct for a redefines. You can only have a maximum of 24 occurrences of 10 characters so if you have 2 sect 1 and 5 sect 2 you will have 17 empty occurrences.
    This is a horrible structure. It would be better if they were both occurs 24.
    #IBM-Websphere-Transformation-Extender
    #DataExchange
    #IBMSterlingTransformationExtender


  • 5.  Re: COBOL Copybook - process header, unkown number of record detail, trailer - newbie question

    Posted Wed November 01, 2006 09:45 AM

    Originally posted by: SystemAdmin


    I obviously can not give the actual file structure but you are right I did not specify it correctly. This is more like the original. I appologize I am not a COBOL expert. I have no control over the source. We have been tasked to pick these files up, transform and merge them with other data. Try the following...

    01 RECORD.
    02 DATA-ELEMENT1 PIC X(1).
    02 DATA-ELEMENT2 PIC X(1).
    02 DATA-ELEMENT3 PIC X(1).
    02 SECT1-CNT PIC 9(2).
    02 SECT2-CNT PIC 9(2).
    02 SECTION-1.
    03 SECT-1 OCCURS 48 TIMES.
    05 DATA-ELEMENT4 PIC 9(2).
    05 DATA-ELEMENT5 PIC 9(3).
    05 FILLER PIC X(5).
    02 SECTION-2 REDEFINES SECTION-1.
    03 SECT-2 OCCURS 48 TIMES.
    05 DATA-ELEMENT6 PIC 9(1).
    05 DATA-ELEMENT7 PIC 9(4).
    05 DATA-ELEMENT8 PIC 9(3).
    05 DATA-ELEMENT9 PIC 9(2).
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender
    #DataExchange


  • 6.  Re: COBOL Copybook - process header, unkown number of record detail, trailer - newbie question

    Posted Wed November 01, 2006 09:54 AM

    Originally posted by: jvanboga


    I work with this kind of copybook a bit.... I'm not sure I'd call it cheating but this is what I'd do...

    Change the copy book to

    01 TEST-HDDR.
    05 CREATE-DATE PIC 9(8).
    05 FILLER PIC X(37).
    01 TEST-RECORD.
    05 SSN PIC 9(9).
    05 NAME PIC X(20).
    05 DESC PIC X(20).
    01 TEST-TRLR.
    05 NUM-RECS PIC 9(8).
    05 FILLER PIC X(37).

    Import the book to a tree and add a 'group called 'FILE' and 1 called 'REC_LOOP'

    Structure your groups as follows..

    FILE
    --REC_LOOP (1:S)
    ---TEST-HDDR (1:1) {ADD an INITIATOR of 'HDDR' and your terminator of <NL>}
    ---TEST-HDDR (1:1) {ADD your terminator of <NL>}
    ---TEST-TRLR (1:1) {ADD an TERMIATOR of 'TRLR' and your terminator of <NL>}

    Compile the tree, you might get a warning but unless you have problems validating your file don't stree about it.

    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender
    #DataExchange


  • 7.  Re: COBOL Copybook - process header, unkown number of record detail, trailer - newbie question

    Posted Wed November 01, 2006 10:11 AM

    Originally posted by: jvanboga


    In answer to second question try using an unordered group....

    FILE CopyBook
    RECORD Record (s)
    DATA_ELEMENT1 Field
    DATA_ELEMENT2 Field
    DATA_ELEMENT3 Field
    SECT1_CNT Field
    SECT2_CNT Field
    SECTION_CHOICE Group {UNORDERED}
    SECTION_1 (24:24)
    SECTION_2 (24:24)

    Try maing your tree look like this....
    #DataExchange
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender


  • 8.  Re: COBOL Copybook - process header, unkown number of record detail, trailer - newbie question

    Posted Wed November 01, 2006 09:28 AM

    Originally posted by: janhess


    In the type tree
    for the header record set HDDR_ID to be an identifier and set the value to $="HDDR"
    for the trailer record set TRLR_ID to be an identifier and set the value to $="TRLR"
    set the record occurrence to 0 to S
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender
    #DataExchange


  • 9.  Re: COBOL Copybook - process header, unkown number of record detail, trailer - newbie question

    Posted Wed November 01, 2006 10:35 AM

    Originally posted by: janhess


    ok the file in the type tree should be madu up like this. I haven't included header and trailer.

    RECORD Record (s)
    DATA_ELEMENT1 Field
    DATA_ELEMENT2 Field
    DATA_ELEMENT3 Field
    SECT1_CNT Field
    SECT2_CNT Field
    SECTION_1 Group (0:24) INDEX($) <= SECT1_CNT Field
    SECTION_2 Group (0:24) INDEX($) <= SECT2_CNT Field
    tenchars Filler (0:24) INDEX($) <= 24 - SECT1_CNT Field - SECT2_CNT Field

    The tenchars ITEM at the end is needed to pad out the record to fixed length.
    If your records have <CR><LF> terminators you will need to add this to the record terminator.
    I have tested this at vn 6.7.1 with fixed length records and it works ok. You just need to add the header and trailer.
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender
    #DataExchange


  • 10.  Re: COBOL Copybook - process header, unkown number of record detail, trailer - newbie question

    Posted Wed November 01, 2006 10:36 AM

    Originally posted by: janhess


    Sorry the 24's should be 48 for your revised layout.
    #IBMSterlingTransformationExtender
    #DataExchange
    #IBM-Websphere-Transformation-Extender


  • 11.  Re: COBOL Copybook - process header, unkown number of record detail, trailer - newbie question

    Posted Wed November 01, 2006 10:44 AM

    Originally posted by: SystemAdmin


    I hope you're sending a bill. You're a better man than I. I don't care to spend a lot of time solving problems for people who don't have the courtesy to identify themselves.

    Jim Divoky
    #IBMSterlingTransformationExtender
    #DataExchange
    #IBM-Websphere-Transformation-Extender


  • 12.  Re: COBOL Copybook - process header, unkown number of record detail, trailer - newbie question

    Posted Wed November 01, 2006 10:51 AM

    Originally posted by: janhess


    Jim,
    Just thought it might be useful for a future project.
    Jan
    #DataExchange
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender


  • 13.  Re: COBOL Copybook - process header, unkown number of record detail, trailer - newbie question

    Posted Wed November 01, 2006 11:06 AM

    Originally posted by: jvanboga


    Thought this type of help was what the forum was intended for.
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender
    #DataExchange


  • 14.  Re: COBOL Copybook - process header, unkown number of record detail, trailer - newbie question

    Posted Wed November 01, 2006 11:56 AM

    Originally posted by: SystemAdmin


    Your absolutely correct, Ivan. It's just that in the past in my experience, it was considered proper manners to identify oneself in professional forums. I guess I'm just an old fogey. No offense meant.
    #IBM-Websphere-Transformation-Extender
    #DataExchange
    #IBMSterlingTransformationExtender


  • 15.  Re: COBOL Copybook - process header, unkown number of record detail, trailer - newbie question

    Posted Wed November 01, 2006 11:11 AM

    Originally posted by: SystemAdmin


    Jim,

    If you don't want to spend time then don't. There are plenty of alias users on this and many other forums that have no issues with helping strangers. As I said before, I greatly appreciate others' insights. I hope to be able to give feedback as I gain more experience, but for now I am mainly going to be asking questions. I appologize if I offended you, but that is how it is.

    Regards,
    #IBMSterlingTransformationExtender
    #DataExchange
    #IBM-Websphere-Transformation-Extender


  • 16.  Re: COBOL Copybook - process header, unkown number of record detail, trailer - newbie question

    Posted Wed November 01, 2006 12:04 PM

    Originally posted by: SystemAdmin


    GoinBuggy,
    I have no problem helping strangers. That's how I make my living. I just don't build type trees for strangers who don't identify themselves. As I said, Jan is a better man than me in this regard. No problem with your use of the forum. Obviously, others are more than willing to help. Good luck with your new endeavor.
    #DataExchange
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender


  • 17.  Re: COBOL Copybook - process header, unkown number of record detail, trailer - newbie question

    Posted Wed November 01, 2006 10:59 AM

    Originally posted by: SystemAdmin


    Thank you. This makes sense. We are new to the product and using v8.1. We are migrating a Mainframe to J2EE. Training has been delayed and we are appreciative of any and all help provided.
    #IBMSterlingTransformationExtender
    #DataExchange
    #IBM-Websphere-Transformation-Extender


  • 18.  Re: COBOL Copybook - process header, unkown number of record detail, trailer - newbie question

    Posted Wed November 01, 2006 11:17 AM

    Originally posted by: janhess


    Here's the exported type tree.
    code<?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE TTMAKER SYSTEM "ttmaker60.dtd">
    <?ANALYZE?><TTMAKER Version="6.0"><NEWTREE Filename="C:\TEMP\testcbl.mtt"><ROOT SimpleTypeName="CopyBook" Description="COBOL CopyBook imported on 11/01/06 13:53:38" SetUpProperties="DEFAULT" SetUpComponents="DELETE" OrderSubtypes="ASCENDING"><Sequence partition="NO"><Implicit/></Sequence>
    <CharTextWestern><Size Min="0" Max="S"/>
    <Western CharSet="NATIVE"/>
    <ValueRestrictions IgnoreCase="NO" Rule="INCLUDE"></ValueRestrictions>
    </CharTextWestern>
    </ROOT>
    <CATEGORY SimpleTypeName="Field" CategoryParent="CopyBook" Description="Fields are components of Groups and Records" OrderSubtypes="ASCENDING"><Sequence partition="NO"><Implicit/></Sequence>
    <CharTextWestern><Size Min="0" Max="S"/>
    <Western CharSet="NATIVE"/>
    <ValueRestrictions IgnoreCase="NO" Rule="INCLUDE"></ValueRestrictions>
    </CharTextWestern>
    </CATEGORY>
    <ITEM SimpleTypeName="DATA_ELEMENT1" CategoryOrItemParent="Field CopyBook" Description="02 DATA-ELEMENT1 PIC X(1)." partition="NO" OrderSubtypes="ASCENDING"><CharTextWestern><Size Min="0" Max="1"/>
    <PadText Justify="LEFT" ApplyPad="ANYCONTEXT"><PadValue><SP></PadValue>
    <PaddedToFixedSize Length="1"/>
    </PadText>
    <Western CharSet="NATIVE"/>
    <NONE RequiredOnInput="YES"> </NONE>
    <ValueRestrictions IgnoreCase="NO" Rule="INCLUDE"></ValueRestrictions>
    </CharTextWestern>
    </ITEM>
    <ITEM SimpleTypeName="DATA_ELEMENT2" CategoryOrItemParent="Field CopyBook" Description="02 DATA-ELEMENT2 PIC X(1)." partition="NO" OrderSubtypes="ASCENDING"><CharTextWestern><Size Min="0" Max="1"/>
    <PadText Justify="LEFT" ApplyPad="ANYCONTEXT"><PadValue><SP></PadValue>
    <PaddedToFixedSize Length="1"/>
    </PadText>
    <Western CharSet="NATIVE"/>
    <NONE RequiredOnInput="YES"> </NONE>
    <ValueRestrictions IgnoreCase="NO" Rule="INCLUDE"></ValueRestrictions>
    </CharTextWestern>
    </ITEM>
    <ITEM SimpleTypeName="DATA_ELEMENT3" CategoryOrItemParent="Field CopyBook" Description="02 DATA-ELEMENT3 PIC X(1)." partition="NO" OrderSubtypes="ASCENDING"><CharTextWestern><Size Min="0" Max="1"/>
    <PadText Justify="LEFT" ApplyPad="ANYCONTEXT"><PadValue><SP></PadValue>
    <PaddedToFixedSize Length="1"/>
    </PadText>
    <Western CharSet="NATIVE"/>
    <NONE RequiredOnInput="YES"> </NONE>
    <ValueRestrictions IgnoreCase="NO" Rule="INCLUDE"></ValueRestrictions>
    </CharTextWestern>
    </ITEM>
    <ITEM SimpleTypeName="DATA_ELEMENT4" CategoryOrItemParent="Field CopyBook" Description="03 DATA-ELEMENT4 PIC 9(2)." partition="NO" OrderSubtypes="ASCENDING" ImpliedDefaultValue="0"><CharNumber><CharInt><TotalDigits Min="0" Max="2"/>
    <PadNumber Justify="RIGHT" ApplyPad="ANYCONTEXT" Fill="BEFORE"><PadValue>0</PadValue>
    <PaddedToFixedSize Length="2"/>
    </PadNumber>
    <IntegerFormatString>{######}</IntegerFormatString>
    </CharInt>
    <Western CharSet="NATIVE"/>
    <ValueRestrictions IgnoreCase="NO" Rule="INCLUDE"></ValueRestrictions>
    </CharNumber>
    </ITEM>
    <ITEM SimpleTypeName="DATA_ELEMENT5" CategoryOrItemParent="Field CopyBook" Description="03 DATA-ELEMENT5 PIC 9(3)." partition="NO" OrderSubtypes="ASCENDING" ImpliedDefaultValue="0"><CharNumber><CharInt><TotalDigits Min="0" Max="3"/>
    <PadNumber Justify="RIGHT" ApplyPad="ANYCONTEXT" Fill="BEFORE"><PadValue>0</PadValue>
    <PaddedToFixedSize Length="3"/>
    </PadNumber>
    <IntegerFormatString>{######}</IntegerFormatString>
    </CharInt>
    <Western CharSet="NATIVE"/>
    <ValueRestrictions IgnoreCase="NO" Rule="INCLUDE"></ValueRestrictions>
    </CharNumber>
    </ITEM>
    <ITEM SimpleTypeName="DATA_ELEMENT6" CategoryOrItemParent="Field CopyBook" Description="03 DATA-ELEMENT6 PIC 9(1)." partition="NO" OrderSubtypes="ASCENDING" ImpliedDefaultValue="0"><CharNumber><CharInt><TotalDigits Min="0" Max="1"/>
    <PadNumber Justify="RIGHT" ApplyPad="ANYCONTEXT" Fill="BEFORE"><PadValue>0</PadValue>
    <PaddedToFixedSize Length="1"/>
    </PadNumber>
    <IntegerFormatString>{######}</IntegerFormatString>
    </CharInt>
    <Western CharSet="NATIVE"/>
    <ValueRestrictions IgnoreCase="NO" Rule="INCLUDE"></ValueRestrictions>
    </CharNumber>
    </ITEM>
    <ITEM SimpleTypeName="DATA_ELEMENT7" CategoryOrItemParent="Field CopyBook" Description="03 DATA-ELEMENT7 PIC 9(4)." partition="NO" OrderSubtypes="ASCENDING" ImpliedDefaultValue="0"><CharNumber><CharInt><TotalDigits Min="0" Max="4"/>
    <PadNumber Justify="RIGHT" ApplyPad="ANYCONTEXT" Fill="BEFORE"><PadValue>0</PadValue>
    <PaddedToFixedSize Length="4"/>
    </PadNumber>
    <IntegerFormatString>{######}</IntegerFormatString>
    </CharInt>
    <Western CharSet="NATIVE"/>
    <ValueRestrictions IgnoreCase="NO" Rule="INCLUDE"></ValueRestrictions>
    </CharNumber>
    </ITEM>
    <ITEM SimpleTypeName="DATA_ELEMENT8" CategoryOrItemParent="Field CopyBook" Description="03 DATA-ELEMENT8 PIC 9(3)." partition="NO" OrderSubtypes="ASCENDING" ImpliedDefaultValue="0"><CharNumber><CharInt><TotalDigits Min="0" Max="3"/>
    <PadNumber Justify="RIGHT" ApplyPad="ANYCONTEXT" Fill="BEFORE"><PadValue>0</PadValue>
    <PaddedToFixedSize Length="3"/>
    </PadNumber>
    <IntegerFormatString>{######}</IntegerFormatString>
    </CharInt>
    <Western CharSet="NATIVE"/>
    <ValueRestrictions IgnoreCase="NO" Rule="INCLUDE"></ValueRestrictions>
    </CharNumber>
    </ITEM>
    <ITEM SimpleTypeName="DATA_ELEMENT9" CategoryOrItemParent="Field CopyBook" Description="03 DATA-ELEMENT9 PIC 9(2)." partition="NO" OrderSubtypes="ASCENDING" ImpliedDefaultValue="0"><CharNumber><CharInt><TotalDigits Min="0" Max="2"/>
    <PadNumber Justify="RIGHT" ApplyPad="ANYCONTEXT" Fill="BEFORE"><PadValue>0</PadValue>
    <PaddedToFixedSize Length="2"/>
    </PadNumber>
    <IntegerFormatString>{######}</IntegerFormatString>
    </CharInt>
    <Western CharSet="NATIVE"/>
    <ValueRestrictions IgnoreCase="NO" Rule="INCLUDE"></ValueRestrictions>
    </CharNumber>
    </ITEM>
    <ITEM SimpleTypeName="SECT1_CNT" CategoryOrItemParent="Field CopyBook" Description="02 SECT1-CNT PIC 9(2)." partition="NO" OrderSubtypes="ASCENDING" ImpliedDefaultValue="0"><CharNumber><CharInt><TotalDigits Min="0" Max="2"/>
    <PadNumber Justify="RIGHT" ApplyPad="ANYCONTEXT" Fill="BEFORE"><PadValue>0</PadValue>
    <PaddedToFixedSize Length="2"/>
    </PadNumber>
    <IntegerFormatString>{######}</IntegerFormatString>
    </CharInt>
    <Western CharSet="NATIVE"/>
    <ValueRestrictions IgnoreCase="NO" Rule="INCLUDE"></ValueRestrictions>
    </CharNumber>
    </ITEM>
    <ITEM SimpleTypeName="SECT2_CNT" CategoryOrItemParent="Field CopyBook" Description="02 SECT2-CNT PIC 9(2)." partition="NO" OrderSubtypes="ASCENDING" ImpliedDefaultValue="0"><CharNumber><CharInt><TotalDigits Min="0" Max="2"/>
    <PadNumber Justify="RIGHT" ApplyPad="ANYCONTEXT" Fill="BEFORE"><PadValue>0</PadValue>
    <PaddedToFixedSize Length="2"/>
    </PadNumber>
    <IntegerFormatString>{######}</IntegerFormatString>
    </CharInt>
    <Western CharSet="NATIVE"/>
    <ValueRestrictions IgnoreCase="NO" Rule="INCLUDE"></ValueRestrictions>
    </CharNumber>
    </ITEM>
    <CATEGORY SimpleTypeName="File" CategoryParent="CopyBook" Description="COBOL CopyBook imported on 11/01/06 13:53:38" OrderSubtypes="ASCENDING"><Sequence partition="NO"><Implicit/></Sequence>
    <CharTextWestern><Size Min="0" Max="S"/>
    <Western CharSet="NATIVE"/>
    <ValueRestrictions IgnoreCase="NO" Rule="INCLUDE"></ValueRestrictions>
    </CharTextWestern>
    </CATEGORY>
    <GROUP SimpleTypeName="File" CategoryOrGroupParent="File CopyBook" Description="COBOL CopyBook imported on 11/01/06 13:53:38" OrderSubtypes="ASCENDING"><Sequence partition="NO"><Implicit/><SequenceComponent><RelativeTypeName>RECORD Record</RelativeTypeName>
    <Range Min="0" Max="S"/>
    </SequenceComponent>
    </Sequence>
    </GROUP>
    <CATEGORY SimpleTypeName="Filler" CategoryParent="CopyBook" Description="Fillers are components of Groups and Records" OrderSubtypes="ASCENDING"><Sequence partition="NO"><Implicit/></Sequence>
    <CharTextWestern><Size Min="0" Max="S"/>
    <Western CharSet="NATIVE"/>
    <ValueRestrictions IgnoreCase="NO" Rule="INCLUDE"></ValueRestrictions>
    </CharTextWestern>
    </CATEGORY>
    <ITEM SimpleTypeName="#10" CategoryOrItemParent="Filler CopyBook" Description="03 FILLER PIC X(5)." partition="NO" OrderSubtypes="ASCENDING"><CharTextWestern><Size Min="0" Max="5"/>
    <PadText Justify="LEFT" ApplyPad="ANYCONTEXT"><PadValue><SP></PadValue>
    <PaddedToFixedSize Length="5"/>
    </PadText>
    <Western CharSet="NATIVE"/>
    <NONE RequiredOnInput="YES"> </NONE>
    <ValueRestrictions IgnoreCase="NO" Rule="INCLUDE"></ValueRestrictions>
    </CharTextWestern>
    </ITEM>
    <ITEM SimpleTypeName="tenchars" CategoryOrItemParent="Filler CopyBook" Description="Fillers are components of Groups and Records" partition="NO" OrderSubtypes="ASCENDING"><CharTextWestern><Size Min="0" Max="10"/>
    <PadText Justify="LEFT" ApplyPad="ANYCONTEXT"><PadValue><SP></PadValue>
    <PaddedToFixedSize Length="10"/>
    </PadText>
    <Western CharSet="NATIVE"/>
    <ValueRestrictions IgnoreCase="NO" Rule="INCLUDE"></ValueRestrictions>
    </CharTextWestern>
    </ITEM>
    <CATEGORY SimpleTypeName="Group" CategoryParent="CopyBook" Description="Groups are components of other Groups and Records" OrderSubtypes="ASCENDING"><Sequence partition="NO"><Implicit/><SequenceComponent><RelativeTypeName>Field</RelativeTypeName>
    <Range Min="0" Max="S"/>
    </SequenceComponent>
    <SequenceComponent><RelativeTypeName>Filler</RelativeTypeName>
    <Range Min="0" Max="S"/>
    </SequenceComponent>
    </Sequence>
    <CharTextWestern><Size Min="0" Max="S"/>
    <Western CharSet="NATIVE"/>
    <ValueRestrictions IgnoreCase="NO" Rule="INCLUDE"></ValueRestrictions>
    </CharTextWestern>
    </CATEGORY>
    <GROUP SimpleTypeName="SECTION_1" CategoryOrGroupParent="Group CopyBook" Description="02 SECTION-1 OCCURS 24 TIMES." OrderSubtypes="ASCENDING"><Sequence partition="NO"><Implicit/><SequenceComponent><RelativeTypeName>DATA_ELEMENT4 Field</RelativeTypeName>
    <Range Min="1" Max="1"/>
    </SequenceComponent>
    <SequenceComponent><RelativeTypeName>DATA_ELEMENT5 Field</RelativeTypeName>
    <Range Min="1" Max="1"/>
    </SequenceComponent>
    <SequenceComponent><RelativeTypeName>#10 Filler</RelativeTypeName>
    <Range Min="1" Max="1"/>
    </SequenceComponent>
    </Sequence>
    </GROUP>
    <GROUP SimpleTypeName="SECTION_2" CategoryOrGroupParent="Group CopyBook" Description="02 SECTION-2 OCCURS 24 TIMES REDEFINES SECTION-1." OrderSubtypes="ASCENDING"><Sequence partition="NO"><Implicit/><SequenceComponent><RelativeTypeName>DATA_ELEMENT6 Field</RelativeTypeName>
    <Range Min="1" Max="1"/>
    </SequenceComponent>
    <SequenceComponent><RelativeTypeName>DATA_ELEMENT7 Field</RelativeTypeName>
    <Range Min="1" Max="1"/>
    </SequenceComponent>
    <SequenceComponent><RelativeTypeName>DATA_ELEMENT8 Field</RelativeTypeName>
    <Range Min="1" Max="1"/>
    </SequenceComponent>
    <SequenceComponent><RelativeTypeName>DATA_ELEMENT9 Field</RelativeTypeName>
    <Range Min="1" Max="1"/>
    </SequenceComponent>
    </Sequence>
    </GROUP>
    <CATEGORY SimpleTypeName="Record" CategoryParent="CopyBook" Description="Records are components of files" OrderSubtypes="ASCENDING"><Sequence partition="NO"><Implicit/><SequenceComponent><RelativeTypeName>Group</RelativeTypeName>
    <Range Min="0" Max="S"/>
    </SequenceComponent>
    <SequenceComponent><RelativeTypeName>Field</RelativeTypeName>
    <Range Min="0" Max="S"/>
    </SequenceComponent>
    <SequenceComponent><RelativeTypeName>Filler</RelativeTypeName>
    <Range Min="0" Max="S"/>
    </SequenceComponent>
    </Sequence>
    <CharTextWestern><Size Min="0" Max="S"/>
    <Western CharSet="NATIVE"/>
    <ValueRestrictions IgnoreCase="NO" Rule="INCLUDE"></ValueRestrictions>
    </CharTextWestern>
    </CATEGORY>
    <GROUP SimpleTypeName="RECORD" CategoryOrGroupParent="Record CopyBook" Description="01 RECORD." OrderSubtypes="ASCENDING"><Sequence partition="NO"><Implicit/><SequenceComponent><RelativeTypeName>DATA_ELEMENT1 Field</RelativeTypeName>
    <Range Min="1" Max="1"/>
    </SequenceComponent>
    <SequenceComponent><RelativeTypeName>DATA_ELEMENT2 Field</RelativeTypeName>
    <Range Min="1" Max="1"/>
    </SequenceComponent>
    <SequenceComponent><RelativeTypeName>DATA_ELEMENT3 Field</RelativeTypeName>
    <Range Min="1" Max="1"/>
    </SequenceComponent>
    <SequenceComponent><RelativeTypeName>SECT1_CNT Field</RelativeTypeName>
    <Range Min="1" Max="1"/>
    </SequenceComponent>
    <SequenceComponent><RelativeTypeName>SECT2_CNT Field</RelativeTypeName>
    <Range Min="1" Max="1"/>
    </SequenceComponent>
    <SequenceComponent><RelativeTypeName>SECTION_1 Group</RelativeTypeName>
    <Range Min="0" Max="24"/>
    <Rule>INDEX($) <= SECT1_CNT Field</Rule>
    </SequenceComponent>
    <SequenceComponent><RelativeTypeName>SECTION_2 Group</RelativeTypeName>
    <Range Min="0" Max="24"/>
    <Rule>INDEX($) <= SECT2_CNT Field</Rule>
    </SequenceComponent>
    <SequenceComponent><RelativeTypeName>tenchars Filler</RelativeTypeName>
    <Range Min="0" Max="24"/>
    <Rule>INDEX($) <= 24 - SECT1_CNT Field - SECT2_CNT Field</Rule>
    </SequenceComponent>
    </Sequence>
    </GROUP>
    </NEWTREE>
    </TTMAKER>
    [/code]
    #DataExchange
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender


  • 19.  Re: COBOL Copybook - process header, unkown number of record detail, trailer - newbie question

    Posted Wed November 01, 2006 11:03 AM

    Originally posted by: jvanboga


    The nice thing is there's usually more than one way to do something and make it work.

    janhess, the only potential problem I see with your rule is that (0:24) means a vairable length record. As the copybook is define the record is fixed length. So, if the count is less than 24 won't that cause a problem with validation? (honest question as I've never written the rule as described.) Using the unordered choice group allows for an if/then map rule that could incorporate the function 'clone'.

    I try to keep most of our rules in the maps and dummy down the trees. Had a problem a while back where developers that don't use the tools as much modified a tree without realizing the impact of their changes. It seemed to test out OK but had a negative impact on some other maps that shared the trees.

    The other side of the coin is that adding component rules can make map coding easier.

    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender
    #DataExchange


  • 20.  Re: COBOL Copybook - process header, unkown number of record detail, trailer - newbie question

    Posted Wed November 01, 2006 11:12 AM

    Originally posted by: janhess


    You misunderstand the rules. The tree defines section 1 as occurrinc sect1_cnt times, section 2 as sect2_cnt times and the tenchars occurs the remaining number of times.
    This is the only way to define the data where you have two variable occurrences.
    #DataExchange
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender


  • 21.  Re: COBOL Copybook - process header, unkown number of record detail, trailer - newbie question

    Posted Wed November 01, 2006 12:24 PM

    Originally posted by: jvanboga


    Ok, I see what you're saying and as usual I like it.

    But unless they keep section 1 & 2 separated by record isn't it difficult to determine which section to map unless there is something more to their actual file format... ie... they wouldn't have 4 occurs of type 1 and 1 or more of type 2 in the same record unless there was a consistant method of identifying which was which. Can't be assured that the filler will not contain numeric values as the test can you? I know that in my office its not uncommon for the MF developers to forget to initialize fields.

    moot point as it sounds like their problem is resolved with your answer.

    Jim.... You're really not that old.... ;)
    #DataExchange
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender


  • 22.  Re: COBOL Copybook - process header, unkown number of record detail, trailer - newbie question

    Posted Thu November 02, 2006 05:04 AM

    Originally posted by: janhess


    If each section is passed to a functional map it just processes that section. It assumes that the occurs 24 is first populated by section 1 entries then section 2 entries then padding to a fixed length record. If the occurrences were in random order they would need some kind of identifier but no information was given on this so I assume the first case is true. Because the padding group tenchars is character, it doesn't matter about the format of the data and anyway it's not used.
    Hope this explains everything.
    Jan
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender
    #DataExchange


  • 23.  Re: COBOL Copybook - process header, unkown number of record detail, trailer - newbie question

    Posted Thu November 02, 2006 08:48 AM

    Originally posted by: SystemAdmin


    To clarify the data...

    If the CNT for SECT-1 is 5 and SECT-2 is 2 then there will be 70 characters of data 50 characters of SECT-1 type and 20 characters of SECT-2 type then the remaing characters are padded with <SP>.

    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender
    #DataExchange


  • 24.  Re: COBOL Copybook - process header, unkown number of record detail, trailer - newbie question

    Posted Thu November 02, 2006 08:50 AM

    Originally posted by: janhess


    So have you tried my type tree?
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender
    #DataExchange


  • 25.  Re: COBOL Copybook - process header, unkown number of record detail, trailer - newbie question

    Posted Thu November 02, 2006 09:26 AM

    Originally posted by: janhess


    Here is the full type tree with header and trailer.

    code
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE TTMAKER SYSTEM "ttmaker60.dtd">
    <?ANALYZE?><TTMAKER Version="6.0"><OPENTREE Filename="C:\TEMP\testcbl.mtt"><CATEGORY SimpleTypeName="Field" CategoryParent="CopyBook" Description="Fields are components of Groups and Records" OrderSubtypes="ASCENDING"><Sequence partition="NO"><Implicit/></Sequence>
    <CharTextWestern><Size Min="0" Max="S"/>
    <Western CharSet="NATIVE"/>
    <ValueRestrictions IgnoreCase="NO" Rule="INCLUDE"></ValueRestrictions>
    </CharTextWestern>
    </CATEGORY>
    <ITEM SimpleTypeName="CREATE_DATE" CategoryOrItemParent="Field CopyBook" Description="Fields are components of Groups and Records" partition="NO" OrderSubtypes="ASCENDING"><CharNumber><CharInt><TotalDigits Min="0" Max="8"/>
    <PadNumber Justify="RIGHT" ApplyPad="ANYCONTEXT"><PadValue>0</PadValue>
    <PaddedToFixedSize Length="8"/>
    </PadNumber>
    <IntegerFormatString>{######}</IntegerFormatString>
    </CharInt>
    <Western CharSet="NATIVE"/>
    <ValueRestrictions IgnoreCase="NO" Rule="INCLUDE"></ValueRestrictions>
    </CharNumber>
    </ITEM>
    <ITEM SimpleTypeName="DATA_ELEMENT1" CategoryOrItemParent="Field CopyBook" Description="02 DATA-ELEMENT1 PIC X(1)." partition="NO" OrderSubtypes="ASCENDING"><CharTextWestern><Size Min="0" Max="1"/>
    <PadText Justify="LEFT" ApplyPad="ANYCONTEXT"><PadValue><SP></PadValue>
    <PaddedToFixedSize Length="1"/>
    </PadText>
    <Western CharSet="NATIVE"/>
    <NONE RequiredOnInput="YES"> </NONE>
    <ValueRestrictions IgnoreCase="NO" Rule="INCLUDE"></ValueRestrictions>
    </CharTextWestern>
    </ITEM>
    <ITEM SimpleTypeName="DATA_ELEMENT2" CategoryOrItemParent="Field CopyBook" Description="02 DATA-ELEMENT2 PIC X(1)." partition="NO" OrderSubtypes="ASCENDING"><CharTextWestern><Size Min="0" Max="1"/>
    <PadText Justify="LEFT" ApplyPad="ANYCONTEXT"><PadValue><SP></PadValue>
    <PaddedToFixedSize Length="1"/>
    </PadText>
    <Western CharSet="NATIVE"/>
    <NONE RequiredOnInput="YES"> </NONE>
    <ValueRestrictions IgnoreCase="NO" Rule="INCLUDE"></ValueRestrictions>
    </CharTextWestern>
    </ITEM>
    <ITEM SimpleTypeName="DATA_ELEMENT3" CategoryOrItemParent="Field CopyBook" Description="02 DATA-ELEMENT3 PIC X(1)." partition="NO" OrderSubtypes="ASCENDING"><CharTextWestern><Size Min="0" Max="1"/>
    <PadText Justify="LEFT" ApplyPad="ANYCONTEXT"><PadValue><SP></PadValue>
    <PaddedToFixedSize Length="1"/>
    </PadText>
    <Western CharSet="NATIVE"/>
    <NONE RequiredOnInput="YES"> </NONE>
    <ValueRestrictions IgnoreCase="NO" Rule="INCLUDE"></ValueRestrictions>
    </CharTextWestern>
    </ITEM>
    <ITEM SimpleTypeName="DATA_ELEMENT4" CategoryOrItemParent="Field CopyBook" Description="03 DATA-ELEMENT4 PIC 9(2)." partition="NO" OrderSubtypes="ASCENDING" ImpliedDefaultValue="0"><CharNumber><CharInt><TotalDigits Min="0" Max="2"/>
    <PadNumber Justify="RIGHT" ApplyPad="ANYCONTEXT" Fill="BEFORE"><PadValue>0</PadValue>
    <PaddedToFixedSize Length="2"/>
    </PadNumber>
    <IntegerFormatString>{######}</IntegerFormatString>
    </CharInt>
    <Western CharSet="NATIVE"/>
    <ValueRestrictions IgnoreCase="NO" Rule="INCLUDE"></ValueRestrictions>
    </CharNumber>
    </ITEM>
    <ITEM SimpleTypeName="DATA_ELEMENT5" CategoryOrItemParent="Field CopyBook" Description="03 DATA-ELEMENT5 PIC 9(3)." partition="NO" OrderSubtypes="ASCENDING" ImpliedDefaultValue="0"><CharNumber><CharInt><TotalDigits Min="0" Max="3"/>
    <PadNumber Justify="RIGHT" ApplyPad="ANYCONTEXT" Fill="BEFORE"><PadValue>0</PadValue>
    <PaddedToFixedSize Length="3"/>
    </PadNumber>
    <IntegerFormatString>{######}</IntegerFormatString>
    </CharInt>
    <Western CharSet="NATIVE"/>
    <ValueRestrictions IgnoreCase="NO" Rule="INCLUDE"></ValueRestrictions>
    </CharNumber>
    </ITEM>
    <ITEM SimpleTypeName="DATA_ELEMENT6" CategoryOrItemParent="Field CopyBook" Description="03 DATA-ELEMENT6 PIC 9(1)." partition="NO" OrderSubtypes="ASCENDING" ImpliedDefaultValue="0"><CharNumber><CharInt><TotalDigits Min="0" Max="1"/>
    <PadNumber Justify="RIGHT" ApplyPad="ANYCONTEXT" Fill="BEFORE"><PadValue>0</PadValue>
    <PaddedToFixedSize Length="1"/>
    </PadNumber>
    <IntegerFormatString>{######}</IntegerFormatString>
    </CharInt>
    <Western CharSet="NATIVE"/>
    <ValueRestrictions IgnoreCase="NO" Rule="INCLUDE"></ValueRestrictions>
    </CharNumber>
    </ITEM>
    <ITEM SimpleTypeName="DATA_ELEMENT7" CategoryOrItemParent="Field CopyBook" Description="03 DATA-ELEMENT7 PIC 9(4)." partition="NO" OrderSubtypes="ASCENDING" ImpliedDefaultValue="0"><CharNumber><CharInt><TotalDigits Min="0" Max="4"/>
    <PadNumber Justify="RIGHT" ApplyPad="ANYCONTEXT" Fill="BEFORE"><PadValue>0</PadValue>
    <PaddedToFixedSize Length="4"/>
    </PadNumber>
    <IntegerFormatString>{######}</IntegerFormatString>
    </CharInt>
    <Western CharSet="NATIVE"/>
    <ValueRestrictions IgnoreCase="NO" Rule="INCLUDE"></ValueRestrictions>
    </CharNumber>
    </ITEM>
    <ITEM SimpleTypeName="DATA_ELEMENT8" CategoryOrItemParent="Field CopyBook" Description="03 DATA-ELEMENT8 PIC 9(3)." partition="NO" OrderSubtypes="ASCENDING" ImpliedDefaultValue="0"><CharNumber><CharInt><TotalDigits Min="0" Max="3"/>
    <PadNumber Justify="RIGHT" ApplyPad="ANYCONTEXT" Fill="BEFORE"><PadValue>0</PadValue>
    <PaddedToFixedSize Length="3"/>
    </PadNumber>
    <IntegerFormatString>{######}</IntegerFormatString>
    </CharInt>
    <Western CharSet="NATIVE"/>
    <ValueRestrictions IgnoreCase="NO" Rule="INCLUDE"></ValueRestrictions>
    </CharNumber>
    </ITEM>
    <ITEM SimpleTypeName="DATA_ELEMENT9" CategoryOrItemParent="Field CopyBook" Description="03 DATA-ELEMENT9 PIC 9(2)." partition="NO" OrderSubtypes="ASCENDING" ImpliedDefaultValue="0"><CharNumber><CharInt><TotalDigits Min="0" Max="2"/>
    <PadNumber Justify="RIGHT" ApplyPad="ANYCONTEXT" Fill="BEFORE"><PadValue>0</PadValue>
    <PaddedToFixedSize Length="2"/>
    </PadNumber>
    <IntegerFormatString>{######}</IntegerFormatString>
    </CharInt>
    <Western CharSet="NATIVE"/>
    <ValueRestrictions IgnoreCase="NO" Rule="INCLUDE"></ValueRestrictions>
    </CharNumber>
    </ITEM>
    <ITEM SimpleTypeName="HDDR_ID" CategoryOrItemParent="Field CopyBook" Description="Fields are components of Groups and Records" partition="NO" OrderSubtypes="ASCENDING"><CharTextWestern><Size Min="0" Max="4"/>
    <PadText Justify="LEFT" ApplyPad="ANYCONTEXT"><PadValue><SP></PadValue>
    <PaddedToFixedSize Length="4"/>
    </PadText>
    <Western CharSet="NATIVE"/>
    <ValueRestrictions IgnoreCase="NO" Rule="INCLUDE"></ValueRestrictions>
    </CharTextWestern>
    </ITEM>
    <ITEM SimpleTypeName="NUM_RECS" CategoryOrItemParent="Field CopyBook" Description="Fields are components of Groups and Records" partition="NO" OrderSubtypes="ASCENDING"><CharNumber><CharInt><TotalDigits Min="0" Max="8"/>
    <PadNumber Justify="RIGHT" ApplyPad="ANYCONTEXT"><PadValue>0</PadValue>
    <PaddedToFixedSize Length="8"/>
    </PadNumber>
    <IntegerFormatString>{######}</IntegerFormatString>
    </CharInt>
    <Western CharSet="NATIVE"/>
    <ValueRestrictions IgnoreCase="NO" Rule="INCLUDE"></ValueRestrictions>
    </CharNumber>
    </ITEM>
    <ITEM SimpleTypeName="SECT1_CNT" CategoryOrItemParent="Field CopyBook" Description="02 SECT1-CNT PIC 9(2)." partition="NO" OrderSubtypes="ASCENDING" ImpliedDefaultValue="0"><CharNumber><CharInt><TotalDigits Min="0" Max="2"/>
    <PadNumber Justify="RIGHT" ApplyPad="ANYCONTEXT" Fill="BEFORE"><PadValue>0</PadValue>
    <PaddedToFixedSize Length="2"/>
    </PadNumber>
    <IntegerFormatString>{######}</IntegerFormatString>
    </CharInt>
    <Western CharSet="NATIVE"/>
    <ValueRestrictions IgnoreCase="NO" Rule="INCLUDE"></ValueRestrictions>
    </CharNumber>
    </ITEM>
    <ITEM SimpleTypeName="SECT2_CNT" CategoryOrItemParent="Field CopyBook" Description="02 SECT2-CNT PIC 9(2)." partition="NO" OrderSubtypes="ASCENDING" ImpliedDefaultValue="0"><CharNumber><CharInt><TotalDigits Min="0" Max="2"/>
    <PadNumber Justify="RIGHT" ApplyPad="ANYCONTEXT" Fill="BEFORE"><PadValue>0</PadValue>
    <PaddedToFixedSize Length="2"/>
    </PadNumber>
    <IntegerFormatString>{######}</IntegerFormatString>
    </CharInt>
    <Western CharSet="NATIVE"/>
    <ValueRestrictions IgnoreCase="NO" Rule="INCLUDE"></ValueRestrictions>
    </CharNumber>
    </ITEM>
    <ITEM SimpleTypeName="TRLR_ID" CategoryOrItemParent="Field CopyBook" Description="Fields are components of Groups and Records" partition="NO" OrderSubtypes="ASCENDING"><CharTextWestern><Size Min="0" Max="4"/>
    <PadText Justify="LEFT" ApplyPad="ANYCONTEXT"><PadValue><SP></PadValue>
    <PaddedToFixedSize Length="4"/>
    </PadText>
    <Western CharSet="NATIVE"/>
    <ValueRestrictions IgnoreCase="NO" Rule="INCLUDE"></ValueRestrictions>
    </CharTextWestern>
    </ITEM>
    </OPENTREE>
    </TTMAKER>
    [/code]

    Here is a test map to read the data file

    code
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE MMS SYSTEM "mms.dtd">
    <MMS mapcount="1" path="C:\TEMP\textcblmap.mms">

    <Map name="testcbl" InputCount="1" OutputCount="0" AuditCount="0" RemarkCount="0">
    <MapSettings>
    <MapAudit Switch="ON">
    <BurstAudit>
    <Data.Never SizeValidation="WrongSize"/>
    <Execution.Never/>
    </BurstAudit>
    <SummaryAudit execution="Always"/>
    <SettingsAudit data="Never" map="Never"/>
    <AuditLocation.File>
    <Directory.Custom>Logs\</Directory.Custom>
    <FileName.Default action="Create"/>
    </AuditLocation.File>
    </MapAudit>
    <MapTrace Switch="ON">
    <ContentTrace.File Switch="ON">
    <TraceLocation.File>
    <Directory.Custom>Trace\</Directory.Custom>
    <FileName.Default/>
    </TraceLocation.File>
    <InputContentTrace.ALL/>
    <RulesTrace.ALL/>
    <SummaryContentTrace.ON/>
    </ContentTrace.File>
    </MapTrace>
    <WorkSpace.File PageSize="64" PageCount="8">
    <Directory.Map/>
    <WorkFilePrefix.MapName action="Delete"/>
    </WorkSpace.File>
    <Century.Current/>
    <Validation.Standard/>
    <Retry Switch="OFF" MaxAttempts="0" Interval="0"/>
    <Warnings.Every action="warn"/>
    </MapSettings>

    <Input>
    <Schema cardnumber="1"
    cardname="testcblin"
    typetree="testcbl.mtt"
    type="File File CopyBook"/>
    <SourceRule>
    <FetchAs>
    <Integral workarea="Create" fetchunit="S"/>
    </FetchAs>
    <GET>
    <FILE_Source>
    <FilePath>testcbl.dat.txt</FilePath>
    <FILE_Source.Transaction OnSuccess="Keep" OnFailure="Rollback" Scope="Map"/>
    <Retry Switch="OFF" MaxAttempts="0" Interval="0"/>
    <DocumentVerification>Never</DocumentVerification>
    </FILE_Source>
    </GET>
    <Backup Switch="OFF" When="Always">
    <BackupLocation.File>
    <Directory.Map/>
    <FileName.Custom action="Create"></FileName.Custom>
    </BackupLocation.File>
    </Backup>
    </SourceRule>
    </Input>
    </Map>

    </MMS>
    [/code]

    Here is the test data. don't forget there's a <CR><LF> at the end of the trailer.

    code
    HDDR20061102
    1230405444444444444444444444444444444444444444455555555555555555555555555555555555555555555555555999999999999999999999

    9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999

    99999999999
    1230505444444444444444444444444444444444444444444444444445555555555555555555555555555555555555555999999999999999999999

    9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999

    99999999999
    TRLR00000002

    [/code]
    #IBMSterlingTransformationExtender
    #DataExchange
    #IBM-Websphere-Transformation-Extender


  • 26.  Re: COBOL Copybook - process header, unkown number of record detail, trailer - newbie question

    Posted Thu November 02, 2006 09:42 AM

    Originally posted by: SystemAdmin


    Not yet. I had other production issues to work through yesterday. I am just about to get back to this. Thank you very much for the reccomendations, Type Trees and quick response. I'll post back soon. Thanks again.
    #IBMSterlingTransformationExtender
    #DataExchange
    #IBM-Websphere-Transformation-Extender


  • 27.  Re: COBOL Copybook - process header, unkown number of record detail, trailer - newbie question

    Posted Thu November 02, 2006 09:55 AM

    Originally posted by: janhess


    oops! only had the ITEMs in previous post. I'll try again.
    code
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE TTMAKER SYSTEM "ttmaker60.dtd">
    <?ANALYZE?><TTMAKER Version="6.0"><NEWTREE Filename="C:\TEMP\testcbl.mtt"><ROOT SimpleTypeName="CopyBook" Description="COBOL CopyBook imported on 11/01/06 13:53:38" SetUpProperties="DEFAULT" SetUpComponents="DELETE" OrderSubtypes="ASCENDING"><Sequence partition="NO"><Implicit/></Sequence>
    <CharTextWestern><Size Min="0" Max="S"/>
    <Western CharSet="NATIVE"/>
    <ValueRestrictions IgnoreCase="NO" Rule="INCLUDE"></ValueRestrictions>
    </CharTextWestern>
    </ROOT>
    <CATEGORY SimpleTypeName="Field" CategoryParent="CopyBook" Description="Fields are components of Groups and Records" OrderSubtypes="ASCENDING"><Sequence partition="NO"><Implicit/></Sequence>
    <CharTextWestern><Size Min="0" Max="S"/>
    <Western CharSet="NATIVE"/>
    <ValueRestrictions IgnoreCase="NO" Rule="INCLUDE"></ValueRestrictions>
    </CharTextWestern>
    </CATEGORY>
    <ITEM SimpleTypeName="CREATE_DATE" CategoryOrItemParent="Field CopyBook" Description="Fields are components of Groups and Records" partition="NO" OrderSubtypes="ASCENDING"><CharNumber><CharInt><TotalDigits Min="0" Max="8"/>
    <PadNumber Justify="RIGHT" ApplyPad="ANYCONTEXT"><PadValue>0</PadValue>
    <PaddedToFixedSize Length="8"/>
    </PadNumber>
    <IntegerFormatString>{######}</IntegerFormatString>
    </CharInt>
    <Western CharSet="NATIVE"/>
    <ValueRestrictions IgnoreCase="NO" Rule="INCLUDE"></ValueRestrictions>
    </CharNumber>
    </ITEM>
    <ITEM SimpleTypeName="DATA_ELEMENT1" CategoryOrItemParent="Field CopyBook" Description="02 DATA-ELEMENT1 PIC X(1)." partition="NO" OrderSubtypes="ASCENDING"><CharTextWestern><Size Min="0" Max="1"/>
    <PadText Justify="LEFT" ApplyPad="ANYCONTEXT"><PadValue><SP></PadValue>
    <PaddedToFixedSize Length="1"/>
    </PadText>
    <Western CharSet="NATIVE"/>
    <NONE RequiredOnInput="YES"> </NONE>
    <ValueRestrictions IgnoreCase="NO" Rule="INCLUDE"></ValueRestrictions>
    </CharTextWestern>
    </ITEM>
    <ITEM SimpleTypeName="DATA_ELEMENT2" CategoryOrItemParent="Field CopyBook" Description="02 DATA-ELEMENT2 PIC X(1)." partition="NO" OrderSubtypes="ASCENDING"><CharTextWestern><Size Min="0" Max="1"/>
    <PadText Justify="LEFT" ApplyPad="ANYCONTEXT"><PadValue><SP></PadValue>
    <PaddedToFixedSize Length="1"/>
    </PadText>
    <Western CharSet="NATIVE"/>
    <NONE RequiredOnInput="YES"> </NONE>
    <ValueRestrictions IgnoreCase="NO" Rule="INCLUDE"></ValueRestrictions>
    </CharTextWestern>
    </ITEM>
    <ITEM SimpleTypeName="DATA_ELEMENT3" CategoryOrItemParent="Field CopyBook" Description="02 DATA-ELEMENT3 PIC X(1)." partition="NO" OrderSubtypes="ASCENDING"><CharTextWestern><Size Min="0" Max="1"/>
    <PadText Justify="LEFT" ApplyPad="ANYCONTEXT"><PadValue><SP></PadValue>
    <PaddedToFixedSize Length="1"/>
    </PadText>
    <Western CharSet="NATIVE"/>
    <NONE RequiredOnInput="YES"> </NONE>
    <ValueRestrictions IgnoreCase="NO" Rule="INCLUDE"></ValueRestrictions>
    </CharTextWestern>
    </ITEM>
    <ITEM SimpleTypeName="DATA_ELEMENT4" CategoryOrItemParent="Field CopyBook" Description="03 DATA-ELEMENT4 PIC 9(2)." partition="NO" OrderSubtypes="ASCENDING" ImpliedDefaultValue="0"><CharNumber><CharInt><TotalDigits Min="0" Max="2"/>
    <PadNumber Justify="RIGHT" ApplyPad="ANYCONTEXT" Fill="BEFORE"><PadValue>0</PadValue>
    <PaddedToFixedSize Length="2"/>
    </PadNumber>
    <IntegerFormatString>{######}</IntegerFormatString>
    </CharInt>
    <Western CharSet="NATIVE"/>
    <ValueRestrictions IgnoreCase="NO" Rule="INCLUDE"></ValueRestrictions>
    </CharNumber>
    </ITEM>
    <ITEM SimpleTypeName="DATA_ELEMENT5" CategoryOrItemParent="Field CopyBook" Description="03 DATA-ELEMENT5 PIC 9(3)." partition="NO" OrderSubtypes="ASCENDING" ImpliedDefaultValue="0"><CharNumber><CharInt><TotalDigits Min="0" Max="3"/>
    <PadNumber Justify="RIGHT" ApplyPad="ANYCONTEXT" Fill="BEFORE"><PadValue>0</PadValue>
    <PaddedToFixedSize Length="3"/>
    </PadNumber>
    <IntegerFormatString>{######}</IntegerFormatString>
    </CharInt>
    <Western CharSet="NATIVE"/>
    <ValueRestrictions IgnoreCase="NO" Rule="INCLUDE"></ValueRestrictions>
    </CharNumber>
    </ITEM>
    <ITEM SimpleTypeName="DATA_ELEMENT6" CategoryOrItemParent="Field CopyBook" Description="03 DATA-ELEMENT6 PIC 9(1)." partition="NO" OrderSubtypes="ASCENDING" ImpliedDefaultValue="0"><CharNumber><CharInt><TotalDigits Min="0" Max="1"/>
    <PadNumber Justify="RIGHT" ApplyPad="ANYCONTEXT" Fill="BEFORE"><PadValue>0</PadValue>
    <PaddedToFixedSize Length="1"/>
    </PadNumber>
    <IntegerFormatString>{######}</IntegerFormatString>
    </CharInt>
    <Western CharSet="NATIVE"/>
    <ValueRestrictions IgnoreCase="NO" Rule="INCLUDE"></ValueRestrictions>
    </CharNumber>
    </ITEM>
    <ITEM SimpleTypeName="DATA_ELEMENT7" CategoryOrItemParent="Field CopyBook" Description="03 DATA-ELEMENT7 PIC 9(4)." partition="NO" OrderSubtypes="ASCENDING" ImpliedDefaultValue="0"><CharNumber><CharInt><TotalDigits Min="0" Max="4"/>
    <PadNumber Justify="RIGHT" ApplyPad="ANYCONTEXT" Fill="BEFORE"><PadValue>0</PadValue>
    <PaddedToFixedSize Length="4"/>
    </PadNumber>
    <IntegerFormatString>{######}</IntegerFormatString>
    </CharInt>
    <Western CharSet="NATIVE"/>
    <ValueRestrictions IgnoreCase="NO" Rule="INCLUDE"></ValueRestrictions>
    </CharNumber>
    </ITEM>
    <ITEM SimpleTypeName="DATA_ELEMENT8" CategoryOrItemParent="Field CopyBook" Description="03 DATA-ELEMENT8 PIC 9(3)." partition="NO" OrderSubtypes="ASCENDING" ImpliedDefaultValue="0"><CharNumber><CharInt><TotalDigits Min="0" Max="3"/>
    <PadNumber Justify="RIGHT" ApplyPad="ANYCONTEXT" Fill="BEFORE"><PadValue>0</PadValue>
    <PaddedToFixedSize Length="3"/>
    </PadNumber>
    <IntegerFormatString>{######}</IntegerFormatString>
    </CharInt>
    <Western CharSet="NATIVE"/>
    <ValueRestrictions IgnoreCase="NO" Rule="INCLUDE"></ValueRestrictions>
    </CharNumber>
    </ITEM>
    <ITEM SimpleTypeName="DATA_ELEMENT9" CategoryOrItemParent="Field CopyBook" Description="03 DATA-ELEMENT9 PIC 9(2)." partition="NO" OrderSubtypes="ASCENDING" ImpliedDefaultValue="0"><CharNumber><CharInt><TotalDigits Min="0" Max="2"/>
    <PadNumber Justify="RIGHT" ApplyPad="ANYCONTEXT" Fill="BEFORE"><PadValue>0</PadValue>
    <PaddedToFixedSize Length="2"/>
    </PadNumber>
    <IntegerFormatString>{######}</IntegerFormatString>
    </CharInt>
    <Western CharSet="NATIVE"/>
    <ValueRestrictions IgnoreCase="NO" Rule="INCLUDE"></ValueRestrictions>
    </CharNumber>
    </ITEM>
    <ITEM SimpleTypeName="HDDR_ID" CategoryOrItemParent="Field CopyBook" Description="Fields are components of Groups and Records" partition="NO" OrderSubtypes="ASCENDING"><CharTextWestern><Size Min="0" Max="4"/>
    <PadText Justify="LEFT" ApplyPad="ANYCONTEXT"><PadValue><SP></PadValue>
    <PaddedToFixedSize Length="4"/>
    </PadText>
    <Western CharSet="NATIVE"/>
    <ValueRestrictions IgnoreCase="NO" Rule="INCLUDE"></ValueRestrictions>
    </CharTextWestern>
    </ITEM>
    <ITEM SimpleTypeName="NUM_RECS" CategoryOrItemParent="Field CopyBook" Description="Fields are components of Groups and Records" partition="NO" OrderSubtypes="ASCENDING"><CharNumber><CharInt><TotalDigits Min="0" Max="8"/>
    <PadNumber Justify="RIGHT" ApplyPad="ANYCONTEXT"><PadValue>0</PadValue>
    <PaddedToFixedSize Length="8"/>
    </PadNumber>
    <IntegerFormatString>{######}</IntegerFormatString>
    </CharInt>
    <Western CharSet="NATIVE"/>
    <ValueRestrictions IgnoreCase="NO" Rule="INCLUDE"></ValueRestrictions>
    </CharNumber>
    </ITEM>
    <ITEM SimpleTypeName="SECT1_CNT" CategoryOrItemParent="Field CopyBook" Description="02 SECT1-CNT PIC 9(2)." partition="NO" OrderSubtypes="ASCENDING" ImpliedDefaultValue="0"><CharNumber><CharInt><TotalDigits Min="0" Max="2"/>
    <PadNumber Justify="RIGHT" ApplyPad="ANYCONTEXT" Fill="BEFORE"><PadValue>0</PadValue>
    <PaddedToFixedSize Length="2"/>
    </PadNumber>
    <IntegerFormatString>{######}</IntegerFormatString>
    </CharInt>
    <Western CharSet="NATIVE"/>
    <ValueRestrictions IgnoreCase="NO" Rule="INCLUDE"></ValueRestrictions>
    </CharNumber>
    </ITEM>
    <ITEM SimpleTypeName="SECT2_CNT" CategoryOrItemParent="Field CopyBook" Description="02 SECT2-CNT PIC 9(2)." partition="NO" OrderSubtypes="ASCENDING" ImpliedDefaultValue="0"><CharNumber><CharInt><TotalDigits Min="0" Max="2"/>
    <PadNumber Justify="RIGHT" ApplyPad="ANYCONTEXT" Fill="BEFORE"><PadValue>0</PadValue>
    <PaddedToFixedSize Length="2"/>
    </PadNumber>
    <IntegerFormatString>{######}</IntegerFormatString>
    </CharInt>
    <Western CharSet="NATIVE"/>
    <ValueRestrictions IgnoreCase="NO" Rule="INCLUDE"></ValueRestrictions>
    </CharNumber>
    </ITEM>
    <ITEM SimpleTypeName="TRLR_ID" CategoryOrItemParent="Field CopyBook" Description="Fields are components of Groups and Records" partition="NO" OrderSubtypes="ASCENDING"><CharTextWestern><Size Min="0" Max="4"/>
    <PadText Justify="LEFT" ApplyPad="ANYCONTEXT"><PadValue><SP></PadValue>
    <PaddedToFixedSize Length="4"/>
    </PadText>
    <Western CharSet="NATIVE"/>
    <ValueRestrictions IgnoreCase="NO" Rule="INCLUDE"></ValueRestrictions>
    </CharTextWestern>
    </ITEM>
    <CATEGORY SimpleTypeName="File" CategoryParent="CopyBook" Description="COBOL CopyBook imported on 11/01/06 13:53:38" OrderSubtypes="ASCENDING"><Sequence partition="NO"><Implicit/></Sequence>
    <CharTextWestern><Size Min="0" Max="S"/>
    <Western CharSet="NATIVE"/>
    <ValueRestrictions IgnoreCase="NO" Rule="INCLUDE"></ValueRestrictions>
    </CharTextWestern>
    </CATEGORY>
    <GROUP SimpleTypeName="File" CategoryOrGroupParent="File CopyBook" Description="COBOL CopyBook imported on 11/01/06 13:53:38" OrderSubtypes="ASCENDING"><Sequence partition="NO"><Implicit/><SequenceComponent><RelativeTypeName>HDDR Record</RelativeTypeName>
    <Range Min="1" Max="1"/>
    </SequenceComponent>
    <SequenceComponent><RelativeTypeName>RECORD Record</RelativeTypeName>
    <Range Min="0" Max="S"/>
    </SequenceComponent>
    <SequenceComponent><RelativeTypeName>TRLR Record</RelativeTypeName>
    <Range Min="1" Max="1"/>
    </SequenceComponent>
    </Sequence>
    </GROUP>
    <CATEGORY SimpleTypeName="Filler" CategoryParent="CopyBook" Description="Fillers are components of Groups and Records" OrderSubtypes="ASCENDING"><Sequence partition="NO"><Implicit/></Sequence>
    <CharTextWestern><Size Min="0" Max="S"/>
    <Western CharSet="NATIVE"/>
    <ValueRestrictions IgnoreCase="NO" Rule="INCLUDE"></ValueRestrictions>
    </CharTextWestern>
    </CATEGORY>
    <ITEM SimpleTypeName="#10" CategoryOrItemParent="Filler CopyBook" Description="03 FILLER PIC X(5)." partition="NO" OrderSubtypes="ASCENDING"><CharTextWestern><Size Min="0" Max="5"/>
    <PadText Justify="LEFT" ApplyPad="ANYCONTEXT"><PadValue><SP></PadValue>
    <PaddedToFixedSize Length="5"/>
    </PadText>
    <Western CharSet="NATIVE"/>
    <NONE RequiredOnInput="YES"> </NONE>
    <ValueRestrictions IgnoreCase="NO" Rule="INCLUDE"></ValueRestrictions>
    </CharTextWestern>
    </ITEM>
    <ITEM SimpleTypeName="FILLER37" CategoryOrItemParent="Filler CopyBook" Description="Fillers are components of Groups and Records" partition="NO" OrderSubtypes="ASCENDING"><CharTextWestern><Size Min="0" Max="37"/>
    <PadText Justify="LEFT" ApplyPad="ANYCONTEXT"><PadValue><SP></PadValue>
    <PaddedToFixedSize Length="37"/>
    </PadText>
    <Western CharSet="NATIVE"/>
    <ValueRestrictions IgnoreCase="NO" Rule="INCLUDE"></ValueRestrictions>
    </CharTextWestern>
    </ITEM>
    <ITEM SimpleTypeName="tenchars" CategoryOrItemParent="Filler CopyBook" Description="Fillers are components of Groups and Records" partition="NO" OrderSubtypes="ASCENDING"><CharTextWestern><Size Min="0" Max="10"/>
    <PadText Justify="LEFT" ApplyPad="ANYCONTEXT"><PadValue><SP></PadValue>
    <PaddedToFixedSize Length="10"/>
    </PadText>
    <Western CharSet="NATIVE"/>
    <ValueRestrictions IgnoreCase="NO" Rule="INCLUDE"></ValueRestrictions>
    </CharTextWestern>
    </ITEM>
    <CATEGORY SimpleTypeName="Group" CategoryParent="CopyBook" Description="Groups are components of other Groups and Records" OrderSubtypes="ASCENDING"><Sequence partition="NO"><Implicit/><SequenceComponent><RelativeTypeName>Field</RelativeTypeName>
    <Range Min="0" Max="S"/>
    </SequenceComponent>
    <SequenceComponent><RelativeTypeName>Filler</RelativeTypeName>
    <Range Min="0" Max="S"/>
    </SequenceComponent>
    </Sequence>
    <CharTextWestern><Size Min="0" Max="S"/>
    <Western CharSet="NATIVE"/>
    <ValueRestrictions IgnoreCase="NO" Rule="INCLUDE"></ValueRestrictions>
    </CharTextWestern>
    </CATEGORY>
    <GROUP SimpleTypeName="SECTION_1" CategoryOrGroupParent="Group CopyBook" Description="02 SECTION-1 OCCURS 24 TIMES." OrderSubtypes="ASCENDING"><Sequence partition="NO"><Implicit/><SequenceComponent><RelativeTypeName>DATA_ELEMENT4 Field</RelativeTypeName>
    <Range Min="1" Max="1"/>
    </SequenceComponent>
    <SequenceComponent><RelativeTypeName>DATA_ELEMENT5 Field</RelativeTypeName>
    <Range Min="1" Max="1"/>
    </SequenceComponent>
    <SequenceComponent><RelativeTypeName>#10 Filler</RelativeTypeName>
    <Range Min="1" Max="1"/>
    </SequenceComponent>
    </Sequence>
    </GROUP>
    <GROUP SimpleTypeName="SECTION_2" CategoryOrGroupParent="Group CopyBook" Description="02 SECTION-2 OCCURS 24 TIMES REDEFINES SECTION-1." OrderSubtypes="ASCENDING"><Sequence partition="NO"><Implicit/><SequenceComponent><RelativeTypeName>DATA_ELEMENT6 Field</RelativeTypeName>
    <Range Min="1" Max="1"/>
    </SequenceComponent>
    <SequenceComponent><RelativeTypeName>DATA_ELEMENT7 Field</RelativeTypeName>
    <Range Min="1" Max="1"/>
    </SequenceComponent>
    <SequenceComponent><RelativeTypeName>DATA_ELEMENT8 Field</RelativeTypeName>
    <Range Min="1" Max="1"/>
    </SequenceComponent>
    <SequenceComponent><RelativeTypeName>DATA_ELEMENT9 Field</RelativeTypeName>
    <Range Min="1" Max="1"/>
    </SequenceComponent>
    </Sequence>
    </GROUP>
    <CATEGORY SimpleTypeName="Record" CategoryParent="CopyBook" Description="Records are components of files" OrderSubtypes="ASCENDING"><Sequence partition="NO"><Implicit/><SequenceComponent><RelativeTypeName>Group</RelativeTypeName>
    <Range Min="0" Max="S"/>
    </SequenceComponent>
    <SequenceComponent><RelativeTypeName>Field</RelativeTypeName>
    <Range Min="0" Max="S"/>
    </SequenceComponent>
    <SequenceComponent><RelativeTypeName>Filler</RelativeTypeName>
    <Range Min="0" Max="S"/>
    </SequenceComponent>
    </Sequence>
    <CharTextWestern><Size Min="0" Max="S"/>
    <Western CharSet="NATIVE"/>
    <ValueRestrictions IgnoreCase="NO" Rule="INCLUDE"></ValueRestrictions>
    </CharTextWestern>
    </CATEGORY>
    <GROUP SimpleTypeName="HDDR" CategoryOrGroupParent="Record CopyBook" Description="Records are components of files" OrderSubtypes="ASCENDING"><TypeSyntax><TERMINATOR><Literal IgnoreCase="NO"><Western CharSet="NATIVE"/>
    <LiteralValue><CR><LF></LiteralValue>
    </Literal>
    </TERMINATOR>
    </TypeSyntax>
    <Sequence partition="NO"><Implicit/><SequenceComponent IDENTIFIER="ON"><RelativeTypeName>HDDR_ID Field</RelativeTypeName>
    <Range Min="1" Max="1"/>
    <Rule>$="HDDR"</Rule>
    </SequenceComponent>
    <SequenceComponent><RelativeTypeName>CREATE_DATE Field</RelativeTypeName>
    <Range Min="1" Max="1"/>
    </SequenceComponent>
    <SequenceComponent><RelativeTypeName>FILLER37 Filler</RelativeTypeName>
    <Range Min="1" Max="1"/>
    </SequenceComponent>
    </Sequence>
    </GROUP>
    <GROUP SimpleTypeName="RECORD" CategoryOrGroupParent="Record CopyBook" Description="01 RECORD." OrderSubtypes="ASCENDING"><TypeSyntax><TERMINATOR><Literal IgnoreCase="NO"><Western CharSet="NATIVE"/>
    <LiteralValue><CR><LF></LiteralValue>
    </Literal>
    </TERMINATOR>
    </TypeSyntax>
    <Sequence partition="NO"><Implicit/><SequenceComponent><RelativeTypeName>DATA_ELEMENT1 Field</RelativeTypeName>
    <Range Min="1" Max="1"/>
    </SequenceComponent>
    <SequenceComponent><RelativeTypeName>DATA_ELEMENT2 Field</RelativeTypeName>
    <Range Min="1" Max="1"/>
    </SequenceComponent>
    <SequenceComponent><RelativeTypeName>DATA_ELEMENT3 Field</RelativeTypeName>
    <Range Min="1" Max="1"/>
    </SequenceComponent>
    <SequenceComponent><RelativeTypeName>SECT1_CNT Field</RelativeTypeName>
    <Range Min="1" Max="1"/>
    </SequenceComponent>
    <SequenceComponent><RelativeTypeName>SECT2_CNT Field</RelativeTypeName>
    <Range Min="1" Max="1"/>
    </SequenceComponent>
    <SequenceComponent><RelativeTypeName>SECTION_1 Group</RelativeTypeName>
    <Range Min="0" Max="24"/>
    <Rule>INDEX($) <= SECT1_CNT Field</Rule>
    </SequenceComponent>
    <SequenceComponent><RelativeTypeName>SECTION_2 Group</RelativeTypeName>
    <Range Min="0" Max="24"/>
    <Rule>INDEX($) <= SECT2_CNT Field</Rule>
    </SequenceComponent>
    <SequenceComponent><RelativeTypeName>tenchars Filler</RelativeTypeName>
    <Range Min="0" Max="24"/>
    <Rule>INDEX($) <= 24 - SECT1_CNT Field - SECT2_CNT Field</Rule>
    </SequenceComponent>
    </Sequence>
    </GROUP>
    <GROUP SimpleTypeName="TRLR" CategoryOrGroupParent="Record CopyBook" Description="Records are components of files" OrderSubtypes="ASCENDING"><TypeSyntax><TERMINATOR><Literal IgnoreCase="NO"><Western CharSet="NATIVE"/>
    <LiteralValue><CR><LF></LiteralValue>
    </Literal>
    </TERMINATOR>
    </TypeSyntax>
    <Sequence partition="NO"><Implicit/><SequenceComponent IDENTIFIER="ON"><RelativeTypeName>TRLR_ID Field</RelativeTypeName>
    <Range Min="1" Max="1"/>
    <Rule>$="TRLR"</Rule>
    </SequenceComponent>
    <SequenceComponent><RelativeTypeName>NUM_RECS Field</RelativeTypeName>
    <Range Min="1" Max="1"/>
    </SequenceComponent>
    <SequenceComponent><RelativeTypeName>FILLER37 Filler</RelativeTypeName>
    <Range Min="1" Max="1"/>
    </SequenceComponent>
    </Sequence>
    </GROUP>
    </NEWTREE>
    </TTMAKER>
    [/code]
    #DataExchange
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender


  • 28.  Re: COBOL Copybook - process header, unkown number of record detail, trailer - newbie question

    Posted Fri November 03, 2006 08:17 AM

    Originally posted by: SystemAdmin


    Jan,

    I created a .mts and copied the code in. I ran the Type Tree Maker and tried to import it Type Tree Designer and I get this message "Error 2 reference 0: Invalid syntax in command line." What do you think it is?

    I've also tried to simplify the task with the following and can not get an output.

    Copy Book:
    01 TEST2-Record.
    05 ITEM1-CNT PIC 9(2).
    05 ITEM2-CNT PIC 9(2).
    05 ITEM1-SECT OCCURS 10 TIMES.
    10 ITEM1 PIC X(2).
    05 ITEM2-SECT OCCURS 10 TIMES.
    10 ITEM2 PIC X(1).
    10 ITEM3 PIC 9(1).

    Input Data w/<CR><LF>:

    0202aabbA1B1
    0505zzyyxxwwvvA9B8C7D6E5
    mts:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE TTMAKER SYSTEM "ttmaker60.dtd">
    <?ANALYZE?><TTMAKER Version="6.0"><NEWTREE Filename="C:\TestMsgs\TEST\Test2\test2.mtt"><ROOT SimpleTypeName="CopyBook" Description="COBOL CopyBook imported on 11/03/06 07:12:35" SetUpProperties="DEFAULT" SetUpComponents="DELETE" OrderSubtypes="ASCENDING"><Sequence partition="NO"><Implicit/></Sequence>
    <CharTextWestern><Size Min="0" Max="S"/>
    <Western CharSet="NATIVE"/>
    <ValueRestrictions IgnoreCase="NO" Rule="INCLUDE"></ValueRestrictions>
    </CharTextWestern>
    </ROOT>
    <CATEGORY SimpleTypeName="Field" CategoryParent="CopyBook" Description="Fields are components of Groups and Records" OrderSubtypes="ASCENDING"><Sequence partition="NO"><Implicit/></Sequence>
    <CharTextWestern><Size Min="0" Max="S"/>
    <Western CharSet="NATIVE"/>
    <ValueRestrictions IgnoreCase="NO" Rule="INCLUDE"></ValueRestrictions>
    </CharTextWestern>
    </CATEGORY>
    <ITEM SimpleTypeName="ITEM1" CategoryOrItemParent="Field CopyBook" Description="10 ITEM1 PIC X(2)." partition="NO" OrderSubtypes="ASCENDING"><CharTextWestern><Size Min="0" Max="2"/>
    <PadText Justify="LEFT" ApplyPad="ANYCONTEXT"><PadValue><SP></PadValue>
    <PaddedToFixedSize Length="2"/>
    </PadText>
    <Western CharSet="ASCII"/>
    <NONE RequiredOnInput="YES"> </NONE>
    <ValueRestrictions IgnoreCase="NO" Rule="INCLUDE"></ValueRestrictions>
    </CharTextWestern>
    </ITEM>
    <ITEM SimpleTypeName="ITEM1_CNT" CategoryOrItemParent="Field CopyBook" Description="05 ITEM1-CNT PIC 9(2)." partition="NO" OrderSubtypes="ASCENDING" ImpliedDefaultValue="0"><CharNumber><CharInt><TotalDigits Min="0" Max="2"/>
    <PadNumber Justify="RIGHT" ApplyPad="ANYCONTEXT"><PadValue>0</PadValue>
    <PaddedToFixedSize Length="2"/>
    </PadNumber>
    <IntegerFormatString>{######}</IntegerFormatString>
    </CharInt>
    <Western CharSet="ASCII"/>
    <ValueRestrictions IgnoreCase="NO" Rule="INCLUDE"></ValueRestrictions>
    </CharNumber>
    </ITEM>
    <ITEM SimpleTypeName="ITEM2" CategoryOrItemParent="Field CopyBook" Description="10 ITEM2 PIC X(1)." partition="NO" OrderSubtypes="ASCENDING"><CharTextWestern><Size Min="0" Max="1"/>
    <PadText Justify="LEFT" ApplyPad="ANYCONTEXT"><PadValue><SP></PadValue>
    <PaddedToFixedSize Length="1"/>
    </PadText>
    <Western CharSet="ASCII"/>
    <NONE RequiredOnInput="YES"> </NONE>
    <ValueRestrictions IgnoreCase="NO" Rule="INCLUDE"></ValueRestrictions>
    </CharTextWestern>
    </ITEM>
    <ITEM SimpleTypeName="ITEM2_CNT" CategoryOrItemParent="Field CopyBook" Description="05 ITEM2-CNT PIC 9(2)." partition="NO" OrderSubtypes="ASCENDING" ImpliedDefaultValue="0"><CharNumber><CharInt><TotalDigits Min="0" Max="2"/>
    <PadNumber Justify="RIGHT" ApplyPad="ANYCONTEXT"><PadValue>0</PadValue>
    <PaddedToFixedSize Length="2"/>
    </PadNumber>
    <IntegerFormatString>{######}</IntegerFormatString>
    </CharInt>
    <Western CharSet="ASCII"/>
    <ValueRestrictions IgnoreCase="NO" Rule="INCLUDE"></ValueRestrictions>
    </CharNumber>
    </ITEM>
    <ITEM SimpleTypeName="ITEM3" CategoryOrItemParent="Field CopyBook" Description="Fields are components of Groups and Records" partition="NO" OrderSubtypes="ASCENDING"><CharNumber><CharInt><TotalDigits Min="0" Max="1"/>
    <PadNumber Justify="RIGHT" ApplyPad="FIXEDGROUP"><PadValue><SP></PadValue>
    <PaddedToFixedSize Length="1"/>
    </PadNumber>
    <IntegerFormatString>{######}</IntegerFormatString>
    </CharInt>
    <Western CharSet="NATIVE"/>
    <ValueRestrictions IgnoreCase="NO" Rule="INCLUDE"></ValueRestrictions>
    </CharNumber>
    </ITEM>
    <ITEM SimpleTypeName="ITEM99" CategoryOrItemParent="Field CopyBook" Description="Fields are components of Groups and Records" partition="NO" OrderSubtypes="ASCENDING"><CharTextWestern><Size Min="0" Max="2"/>
    <PadText Justify="LEFT" ApplyPad="FIXEDGROUP"><PadValue><SP></PadValue>
    <PaddedToFixedSize Length="2"/>
    </PadText>
    <Western CharSet="NATIVE"/>
    <ValueRestrictions IgnoreCase="NO" Rule="INCLUDE"></ValueRestrictions>
    </CharTextWestern>
    </ITEM>
    <GROUP SimpleTypeName="FULLFILE" CategoryOrGroupParent="CopyBook" Description="COBOL CopyBook imported on 11/03/06 07:12:35" OrderSubtypes="ASCENDING"><Sequence partition="NO"><Implicit/><SequenceComponent><RelativeTypeName>TEST2_Record Record</RelativeTypeName>
    <Range Min="0" Max="S"/>
    </SequenceComponent>
    </Sequence>
    </GROUP>
    <CATEGORY SimpleTypeName="Group" CategoryParent="CopyBook" Description="Groups are components of other Groups and Records" OrderSubtypes="ASCENDING"><Sequence partition="NO"><Implicit/><SequenceComponent><RelativeTypeName>Field</RelativeTypeName>
    <Range Min="0" Max="S"/>
    </SequenceComponent>
    </Sequence>
    <CharTextWestern><Size Min="0" Max="S"/>
    <Western CharSet="NATIVE"/>
    <ValueRestrictions IgnoreCase="NO" Rule="INCLUDE"></ValueRestrictions>
    </CharTextWestern>
    </CATEGORY>
    <GROUP SimpleTypeName="ITEM1_SECT" CategoryOrGroupParent="Group CopyBook" Description="05 ITEM1-SECT OCCURS 10 TIMES." OrderSubtypes="ASCENDING"><Sequence partition="NO"><Implicit/><SequenceComponent><RelativeTypeName>ITEM1 Field</RelativeTypeName>
    <Range Min="1" Max="1"/>
    </SequenceComponent>
    </Sequence>
    </GROUP>
    <GROUP SimpleTypeName="ITEM2_SECT" CategoryOrGroupParent="Group CopyBook" Description="05 ITEM2-SECT OCCURS 10 TIMES." OrderSubtypes="ASCENDING"><Sequence partition="NO"><Implicit/><SequenceComponent><RelativeTypeName>ITEM2 Field</RelativeTypeName>
    <Range Min="1" Max="1"/>
    </SequenceComponent>
    <SequenceComponent><RelativeTypeName>ITEM3 Field</RelativeTypeName>
    <Range Min="1" Max="1"/>
    </SequenceComponent>
    </Sequence>
    </GROUP>
    <CATEGORY SimpleTypeName="Record" CategoryParent="CopyBook" Description="Records are components of files" OrderSubtypes="ASCENDING"><Sequence partition="NO"><Implicit/><SequenceComponent><RelativeTypeName>Group</RelativeTypeName>
    <Range Min="0" Max="S"/>
    </SequenceComponent>
    <SequenceComponent><RelativeTypeName>Field</RelativeTypeName>
    <Range Min="0" Max="S"/>
    </SequenceComponent>
    </Sequence>
    <CharTextWestern><Size Min="0" Max="S"/>
    <Western CharSet="NATIVE"/>
    <ValueRestrictions IgnoreCase="NO" Rule="INCLUDE"></ValueRestrictions>
    </CharTextWestern>
    </CATEGORY>
    <GROUP SimpleTypeName="TEST2_Record" CategoryOrGroupParent="Record CopyBook" Description="01 TEST2-Record." OrderSubtypes="ASCENDING"><TypeSyntax><TERMINATOR><Literal IgnoreCase="NO"><Western CharSet="NATIVE"/>
    <LiteralValue><CR><LF></LiteralValue>
    </Literal>
    </TERMINATOR>
    </TypeSyntax>
    <Sequence partition="NO"><Implicit/><SequenceComponent><RelativeTypeName>ITEM1_CNT Field</RelativeTypeName>
    <Range Min="1" Max="1"/>
    </SequenceComponent>
    <SequenceComponent><RelativeTypeName>ITEM2_CNT Field</RelativeTypeName>
    <Range Min="1" Max="1"/>
    </SequenceComponent>
    <SequenceComponent><RelativeTypeName>ITEM1_SECT Group</RelativeTypeName>
    <Range Min="0" Max="10"/>
    <Rule>INDEX($)<=ITEM1_CNT Field</Rule>
    </SequenceComponent>
    <SequenceComponent><RelativeTypeName>ITEM2_SECT Group</RelativeTypeName>
    <Range Min="0" Max="10"/>
    <Rule>INDEX($)<=ITEM2_CNT Field</Rule>
    </SequenceComponent>
    <SequenceComponent><RelativeTypeName>ITEM99 Field</RelativeTypeName>
    <Range Min="0" Max="10"/>
    <Rule>INDEX($)< ((10 - ITEM1_CNT Field) - ITEM2_CNT Field)</Rule>
    </SequenceComponent>
    </Sequence>
    </GROUP>
    </NEWTREE>
    </TTMAKER>
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender
    #DataExchange


  • 29.  Re: COBOL Copybook - process header, unkown number of record detail, trailer - newbie question

    Posted Fri November 03, 2006 08:43 AM

    Originally posted by: janhess


    The problem with my posted xml is that escaped characters sych as < & > are translated to the original characters so if you copy and paste into a file you get the wrong xml.
    Can you post your question at http://www.dsxchange.com/viewforum.php?f=43. It allows responses where HTML is disabled.
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender
    #DataExchange


  • 30.  Re: COBOL Copybook - process header, unkown number of record detail, trailer - newbie question

    Posted Fri November 03, 2006 09:19 AM

    Originally posted by: janhess


    Your input data doesn't match the type tree and the file def is different from the original in that the second occurs 10 doesn't redefine the first.
    If you want to register on dsxchange I'll send you the exports in proper format or you could risk posting your email address.
    #DataExchange
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender


  • 31.  Re: COBOL Copybook - process header, unkown number of record detail, trailer - newbie question

    Posted Fri November 03, 2006 10:33 AM

    Originally posted by: SystemAdmin


    I have the same UID on dsxchange. The title of the post is "Just Learning - COBOL example of real life issue"

    Thanks Jan.
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender
    #DataExchange