WebSphere Transformation Extender - Debruinconsulting

Transcription

WebSphere Transformation ExtenderLAB 7Creating a Validation Map and Using a Trace FileIn this lab we’ll be using the following materials:WTX Version(s):v8.3.0.4Text Files:data.txt,subscriber data.txtfixed length flat file.mttType Tree:Description:The first step after creating a Type Tree is to build a validation map to test the tree’sability to parse and validate a sample data file. A prerequisite, of course, is to obtain atest file that meets the requirements of your project. For this lab we have a file nameddata.txt that matches the requirements provided in our fixed length flat file.cpycopybook file. 2014 Copyright DeBruin Consulting. Do not reproduce. Not for distribution.1

Steps1.We begin by right clicking on the Map Files folder in our WTX Demo project andselecting New Map Source: 2014 Copyright DeBruin Consulting. Do not reproduce. Not for distribution.2

2.Select the WTX Demo project as the location of the new map:3.A “help” window may appear telling us the next step. Select OK: 2014 Copyright DeBruin Consulting. Do not reproduce. Not for distribution.3

4.Click the New Map icon as shown below:A window will appear asking for a name for you map. Use WTX Demo:5.We can see the map name in the Outline View below in the Map Navigator in the lowerleft corner of the WTX perspective. You’ll notice that the map is blue in color. When weadd inputs and outputs to the map, the map will turn purple telling us this is a top level,executable map: 2014 Copyright DeBruin Consulting. Do not reproduce. Not for distribution.4

6. Create an input card by click on the new input card icon: 2014 Copyright DeBruin Consulting. Do not reproduce. Not for distribution.5

7.You will need to populate four boxes below: CardName, TypeTree, Type, and FilePath.: 2014 Copyright DeBruin Consulting. Do not reproduce. Not for distribution.6

9.Give the card the name Validation:10.Select a Type Tree by clicking theicon to the right of the Type Tree box: 2014 Copyright DeBruin Consulting. Do not reproduce. Not for distribution.7

2014 Copyright DeBruin Consulting. Do not reproduce. Not for distribution.8

11.Select the fixed length flat file.mtt Type Tree: 2014 Copyright DeBruin Consulting. Do not reproduce. Not for distribution.9

12.Select the Type in your tree that represents the entire input file which for this lab will bethe group named FILE: 2014 Copyright DeBruin Consulting. Do not reproduce. Not for distribution.10

13.The last step is to select your input file name. This can be done by either searching foryour file by clicking theicon or simply typing the filename into the FilePath box:14.Click OK to finish the creation of the input card. 2014 Copyright DeBruin Consulting. Do not reproduce. Not for distribution.11

15.Our validation map should appear as shown below: 2014 Copyright DeBruin Consulting. Do not reproduce. Not for distribution.12

16.In order to validate the data we need to Build and Run the map. Use the build iconand run iconto build and run the map:17.Click the Build icon to build your map. Make sure the executable map is highlighted. Youwill see a window open and close very quickly which has any build warnings or errors.Since we don’t have any error this window closes right away:18.Click on the Run icon to validate your data: 2014 Copyright DeBruin Consulting. Do not reproduce. Not for distribution.13

19.We see that our data is invalid. If we open the data in UltraEdit and add a carriage returnline feed to the last line of the file (press the enter key) you should see the map completesuccessfully:20.To be sure we have the Type Tree set up correctly we need to run another file throughthe validation map. This time we’ll use the file named subsciber data.txt which has twoaccounts that have multiple transactions.Our subscriber data.txt input file appears as follows:21.Modify the input card as shown below: 2014 Copyright DeBruin Consulting. Do not reproduce. Not for distribution.14

22.Save, Build, and Run the Map. 2014 Copyright DeBruin Consulting. Do not reproduce. Not for distribution.15

23.The map appears to be validating our data correctly since the map completedsuccessfully. However, if we turn Trace on we’ll see that we have an issue.24.Turn on Trace by selecting Map Map Settings:25.Expand Map Trace and turn the Switch to ON and select All for the InputContent Trace: 2014 Copyright DeBruin Consulting. Do not reproduce. Not for distribution.16

26.Build and Run you map.27.Open the Trace file which has a MTR extension:28.Review the trace file and notice it does not appear to be an intuitive report, but more of astep-by-step processing log of every parsing event during the map execution. 2014 Copyright DeBruin Consulting. Do not reproduce. Not for distribution.17

29.Count the number of “KEY 5 Field CopyBook” objects in the trace file:30.We see that we appear to have a problem with our tree handling a file that contains amore complex looping structure having multiple subscribers. We should have a total of 2KEY 5 Field CopyBook objects in the trace file and not 1 object.The reason is that the tree only recognizes the first record as a SUBSCRIBER andassumes the remaining records are DEPENDENT’s.So, how do we force the tree to recognize the beginning and end of SUBSCRIBER andDEPENDENT objects? 2014 Copyright DeBruin Consulting. Do not reproduce. Not for distribution.18

31.To fix this issue we need to add more information to the tree to help WTX parse andvalidate the file. We know that the issue is that WTX only sees the first SUBSCRIBERand then assumes all other records are DEPENDENT’s.In order to distinguish the first SUBSCRIBER from the second SUBSCRIBER in the filewe can add a Restriction and an Identifier.Look at the data and notice HDR is at the beginning of each Account and DTL is at thebeginning of each record or line in the file:32.Open the tree and open the item Key 5. Add a restriction of HDR as shown below: 2014 Copyright DeBruin Consulting. Do not reproduce. Not for distribution.19

Be sure to press the enter key after entering the HDR restriction. 2014 Copyright DeBruin Consulting. Do not reproduce. Not for distribution.20

33.Open the item Key 10 and add the restriction DTL as show below:Close both Item edit windows by clicking the X and save them: 2014 Copyright DeBruin Consulting. Do not reproduce. Not for distribution.21

34.Open the SUBSCRIBER group and add an Identifier to the Key 5 Item. To do this rightclick on Key 5 and select Identifier:35.Open the Transaction group and add an Identifier to the Key 10 Item and save bothgroups: 2014 Copyright DeBruin Consulting. Do not reproduce. Not for distribution.22

36.Analyze, save, and close your Type Tree:37.You will be asked to update your map. Select Yes:38.Your map will be updated with the modified Type Tree. Save, Build, and Run your map.Your map should complete successfully as shown below: 2014 Copyright DeBruin Consulting. Do not reproduce. Not for distribution.23

39.Now count the number of Key 5 objects in your trace file. You should now see 2 asshown below: 2014 Copyright DeBruin Consulting. Do not reproduce. Not for distribution.24

WebSphere Transformation Extender LAB 7 Creating a Validation Map and Using a Trace File In this lab we’ll be using the following materials: WTX Version(s): v8.3.0.4 Text Files: data.txt, subscriber_da