<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to CodeGen Example 1</title><link>https://sourceforge.net/p/jrecord/wiki/CodeGen%2520Example%25201/</link><description>Recent changes to CodeGen Example 1</description><atom:link href="https://sourceforge.net/p/jrecord/wiki/CodeGen%20Example%201/feed" rel="self"/><language>en</language><lastBuildDate>Sun, 21 Jul 2019 01:37:25 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/jrecord/wiki/CodeGen%20Example%201/feed" rel="self" type="application/rss+xml"/><item><title>CodeGen Example 1 modified by Bruce Martin</title><link>https://sourceforge.net/p/jrecord/wiki/CodeGen%2520Example%25201/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v1
+++ v2
@@ -44,11 +44,15 @@

 ## Generating using the RecordEditor

-* Select the **Generate &amp;gt;&amp;gt;&amp;gt; Java JRecord code for Cobol** Option
+* Select the **Generate &amp;gt;&amp;gt;&amp;gt; Java JRecord code for Cobol** 
+![](https://sourceforge.net/p/jrecord/wiki/CodeGen%20Example%201/attachment/Mdt01.png)
 * Select the Cobol copybook and click the **Generte JRecord Button**
+![](https://sourceforge.net/p/jrecord/wiki/CodeGen%20Example%201/attachment/Mdt02.png)
 * Enter the directory holding the template directories. So if directory structure is
 **/MyTemplates/MdtTemplate** you would enter **MyTemplates** in this field and the **MdtTemplate** + any other Template directories
 in the *MyTemplates* will be listed in the Template Combo box below it.
+![](https://sourceforge.net/p/jrecord/wiki/CodeGen%20Example%201/attachment/Mdt03.png)
+

 ## Generating CodeGen

&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Bruce Martin</dc:creator><pubDate>Sun, 21 Jul 2019 01:37:25 -0000</pubDate><guid>https://sourceforge.net2624a38137f5b14af547b7779a99b91397982b35</guid></item><item><title>CodeGen Example 1 modified by Bruce Martin</title><link>https://sourceforge.net/p/jrecord/wiki/CodeGen%2520Example%25201/</link><description>&lt;div class="markdown_content"&gt;&lt;h2 id="codegen-templates"&gt;CodeGen Templates&lt;/h2&gt;
&lt;p&gt;A codeGen Template is a directory with&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Generate.properties&lt;/strong&gt; control file&lt;/li&gt;
&lt;li&gt;An Xml file listing the Velocity templates and there output names&lt;/li&gt;
&lt;li&gt;One or more Velocity templates&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="mdt-template"&gt;Mdt Template&lt;/h2&gt;
&lt;p&gt;The MDT template is for Cobol copybooks where every logical field consists of&lt;br/&gt;
2 logical fields:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A Mdt field that indicates if the Field is present&lt;/li&gt;
&lt;li&gt;The Data field&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;So in the &lt;em&gt;AAA-MDT&lt;/em&gt; is the flag indicates if the &lt;strong&gt;AAA&lt;/strong&gt; is present or not&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c"&gt;      &lt;/span&gt;   &lt;span class="mi"&gt;20  &lt;/span&gt;&lt;span class="nv"&gt;AAA-MDT&lt;/span&gt;     &lt;span class="kt"&gt;PIC X(01)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;
&lt;span class="c"&gt;      &lt;/span&gt;   &lt;span class="mi"&gt;20  &lt;/span&gt;&lt;span class="nv"&gt;AAA&lt;/span&gt;         &lt;span class="kt"&gt;PIC X(03)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;
&lt;span class="c"&gt;      &lt;/span&gt;   &lt;span class="mi"&gt;20  &lt;/span&gt;&lt;span class="nv"&gt;BBB-MDT&lt;/span&gt;     &lt;span class="kt"&gt;PIC X(01)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;
&lt;span class="c"&gt;      &lt;/span&gt;   &lt;span class="mi"&gt;20  &lt;/span&gt;&lt;span class="nv"&gt;BBB&lt;/span&gt;         &lt;span class="kt"&gt;PIC X(03)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;The &lt;em&gt;Mdt Template&lt;/em&gt; generates a "field* for each logical field.&lt;br/&gt;
The above will generate&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="n"&gt;IStringField&lt;/span&gt; &lt;span class="nf"&gt;getAAA&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt; &lt;span class="o"&gt;...&lt;/span&gt; &lt;span class="o"&gt;}&lt;/span&gt;
    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="n"&gt;IStringField&lt;/span&gt; &lt;span class="nf"&gt;getBBB&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt; &lt;span class="o"&gt;...&lt;/span&gt; &lt;span class="o"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;h2 id="mdt-template-principles"&gt;Mdt Template principles&lt;/h2&gt;
&lt;p&gt;One of the principles is to keep the &lt;em&gt;Velocity Templates&lt;/em&gt; as simple as possible and move as much&lt;br/&gt;
code as possible into support classes.&lt;br/&gt;
The Support code is in the &lt;a class="" href="../SupportJavaSource"&gt;SupportJavaSource&lt;/a&gt; directory&lt;/p&gt;
&lt;h2 id="support-code"&gt;Support Code&lt;/h2&gt;
&lt;p&gt;Some important classes&lt;/p&gt;
&lt;h2 id="generating-using-the-recordeditor"&gt;Generating using the RecordEditor&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Select the &lt;strong&gt;Generate &amp;gt;&amp;gt;&amp;gt; Java JRecord code for Cobol&lt;/strong&gt; Option&lt;/li&gt;
&lt;li&gt;Select the Cobol copybook and click the &lt;strong&gt;Generte JRecord Button&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Enter the directory holding the template directories. So if directory structure is&lt;br/&gt;
&lt;strong&gt;/MyTemplates/MdtTemplate&lt;/strong&gt; you would enter &lt;strong&gt;MyTemplates&lt;/strong&gt; in this field and the &lt;strong&gt;MdtTemplate&lt;/strong&gt; + any other Template directories&lt;br/&gt;
in the &lt;em&gt;MyTemplates&lt;/em&gt; will be listed in the Template Combo box below it.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="generating-codegen"&gt;Generating CodeGen&lt;/h2&gt;
&lt;p&gt;if you download the standalone version of &lt;a class="" href="https://sourceforge.net/projects/jrecord/files/jrecord_CodeGen/"&gt;CodeGen&lt;/a&gt;&lt;br/&gt;
you can generate the skel using bat/shell script:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;java -jar ../lib/JRecordCodeGen.jar  &lt;span class="se"&gt;^&lt;/span&gt;
&lt;span class="se"&gt; &lt;/span&gt;             -TemplateDirectory  CodeGenExample &lt;span class="se"&gt;^&lt;/span&gt;
&lt;span class="se"&gt; &lt;/span&gt;             -Template           MdtTemplate &lt;span class="se"&gt;^&lt;/span&gt;
&lt;span class="se"&gt; &lt;/span&gt;             -Schema             LKSA310I_Opp101_RequestFormat.cbl  &lt;span class="se"&gt;^&lt;/span&gt;
&lt;span class="se"&gt; &lt;/span&gt;             -Package            MdtTest.code  &lt;span class="se"&gt;^&lt;/span&gt;
&lt;span class="se"&gt; &lt;/span&gt;             -outputDirectory    MdtOut
&lt;/pre&gt;&lt;/div&gt;

&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Bruce Martin</dc:creator><pubDate>Sun, 21 Jul 2019 01:30:45 -0000</pubDate><guid>https://sourceforge.net65d141ed03757f0bd70a8c8737065317f2bcf4b9</guid></item></channel></rss>