Creating an XML Handler using an XML Instance


   This tutorial will help you to understand:



 

 

1.        Launch XML Thunder

2.        The welcome screen will appear and give you two different options, one to Create a New XML Handler  and one to Open existing handlers.  (If you disabled the welcome screen, please click  toolbar or choose XML Handler -> New from main menu.).
For now, click the first option.





3.        If the wizard starts with the Begin panel, click Next.





4.        On the Source panel, choose XML Instance from the list, click Next.



5.        On the next panel, type in the path to the tutorial Schema example BAXML.xml or click  to locate it. Click Next.





6.        On the Names panel you should see the following screen. Leave the names unchanged. Click Next.





7.        On The IDS Design panel, choose the option to always keep the IDS and the XML design In-Sync





8.        On the Design View panel choose the IDS and XML design panes together option.





9.    On the Finish panel, review the information and click Finish.





10.     After few moments, the XML Handler design window will be displayed.





11.     Now, let's modify the ACCOUNT element, change the “Max Occ” to 40. Click OK.



We can observe the effect of this change on the following image:




12.     Modify the ACCOUNT-Comment: Change the data node property length to 4000 and check the box variable length.







13.     The Logical IDS should look like:





14.     Before code generation, we will set the XML buffer size. Click XML Handler – Properties, switch to General pane and type 32000 in Buffer Size entry field. Click OK.





15.     Click Generate or select Tools -> Generate… from the main menu.



16.     On the Generation dialog, adjust settings to generate a Writer, set the Program ID/Source Name to BAXMLW, set the output folder, set the Language to COBOL, check the Generate IDS, set its Source Name to BAXMLWC and click Generate .





17.     Upon normal completion, adjust settings to generate a Reader, set the Program ID/Source Name to BAXMLR, change the IDS Source Name to BAXMLRC option and click Generate



18.     At the destination folder, you should now have BAXMLW.cbl, BAXMLR.cbl, BAXSDWC.cpy and BAXSDRC.cpy files, the XML Writer, Reader, Writer IDS and Reader IDS respectively. Main test programs BAXMLW_test.cbl and  BAXMLR_test.cbl  (located at Installation Folder/TutorTX/Main Test Programs) copy BAXMLWC and BAXMLRC and call BAXMLW and BAXMLR to demonstrate how an XML Writer and Reader can be used within a COBOL main program.



19.     Copy the following files to a temp folder:

BAXMLW_test.cbl
BAXMLR_test.cbl
BAXMLW.cbl
BAXMLR.cbl
BAXMLWC.cpy
BAXMLRC.cpy

20.     Launch your favorite COBOL IDE, load these files, compile them and run BAXMLW_test. It should produce BAXML.xml. Now let’s analyze the most important sections of the BAXMLW_test.cbl program






21.     The generated XML file will look like:





22.     Run BAXMLR_test.cbl. It will read back the XML file. Let's take a look at the main section of this program.