legacy software migration

Example Application

Example Application

Here you'll find a sample application that demonstrate how Yumasoft works. Dialog System has the concept of pushing and popping screensets. This PUSH-POP example shows how push and pop screensets on the desktop, so that multiple screensets can be visible at any one time. You will find the original Dialog System PUSH-POP application in the %ProgramFiles%\Micro Focus\Net Express 5.1\Examples\Dialog System\PUSH-POP folder. There are the following original source files:

  • FILEMGR.CPB
  • FILEMGR.GS
  • PRINTMGR.CPB
  • PRINTMGR.GS
  • PUSH-POP.APP
  • PUSH-POP.CBL
  • PUSHMAIN.CPB
  • PUSHMAIN.GS

The migration creates a Visual Studio 2008 solution containing the following source files:

  • FilemgrScreenset\FilemgrDataBlock.cbl
  • FilemgrScreenset\FilemgrGlobalScript.cs
  • FilemgrScreenset\FileMgrWin.cs
  • FilemgrScreenset\FileMgrWin.Designer.cs
  • FilemgrScreenset\Hidden.cs
  • FilemgrScreenset\Hidden.Designer.cs
  • PrintmgrScreenset\Hidden.cs
  • PrintmgrScreenset\Hidden.Designer.cs
  • PrintmgrScreenset\PrintmgrDataBlock.cbl
  • PrintmgrScreenset\PrintmgrGlobalScript.cs
  • PrintmgrScreenset\PrintMgrWin.cs
  • PrintmgrScreenset\PrintMgrWin.Designer.cs
  • PushmainScreenset\MainWin.cs
  • PushmainScreenset\MainWin.Designer.csvPushmainScreenset\PushmainDataBlock.cbl
  • PushmainScreenset\PushmainGlobalScript.cs


The following code snippet shows the data block class FilemgrDataBlock.cbl converted to COBOL:

Code example: FilemgrScreenset\FilemgrDataBlock.cbl
class-id. FilemgrDataBlock as "FilemgrScreenset.FilemgrDataBlock".
object.
working-storage section.
01 dataBlockPointer pointer to DataBlockType.

method-id. get property "Dummy".
local-storage section.
    01 strTemp string.

procedure division returning return-item as string.
    set dataBlockPointer to type "ds4net.Framework.Block.BlockProvider"::"DataBlockAddress"
    if dataBlockPointer <> null then

        set strTemp to FILEMGR-DUMMY at dataBlockPointer
        set return-item to strTemp::"Trim"

     else
        set return-item to ""
    end-if
end method.

method-id. set property "Dummy".
procedure division using by value #value as string.
set dataBlockPointer to type "ds4net.Framework.Block.BlockProvider"::"DataBlockAddress"

    if dataBlockPointer <> null then
        set FILEMGR-DUMMY at dataBlockPointer to #value
    end-if

end method.

end object.

end class FilemgrDataBlock.

Code example: FilemgrScreenset\FilemgrGlobalScript.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;

using System.Data;
using System.Drawing;
using System.Text;

using System.Windows.Forms;
using ds4net.Framework;
using ds4net.Framework.Block;

using ds4net.Framework.Scripting;

namespace FilemgrScreenset {

    public class FilemgrGlobalScript : GlobalScript {

        private FilemgrDataBlock filemgrDataBlock;

        public FilemgrGlobalScript() {
            this.filemgrDataBlock = new FilemgrDataBlock();

        }

        private FilemgrForms FilemgrForms {
            get {
                return ((FilemgrForms)(this.Forms));

            }
        }

        // Global script event: ESC
        public virtual void ScriptEvent_Esc(object sender, EventArgs e) {

            if ((DSGRun.Retc(null) == false)) {
                return;

            }
        }

        // Global script event: CLOSED-WINDOW
        public override void ScriptEvent_ClosedWindow(object sender, EventArgs e) {

            if ((DSGRun.Retc(null) == false)) {
                return;

            }
        }
    }
}

Code example: FilemgrScreenset\FileMgrWin.cs
using System;

using System.Collections.Generic;
using System.ComponentModel;
using System.Data;

using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace FilemgrScreenset
{
    public partial class FileMgrWin : Form
    {

        private FilemgrDataBlock filemgrDataBlock;
        private ScreenSet screenSet;
        private DSControlBlock controlBlock;

        protected static string parent = "Desktop";

        /// <summary>

        /// Initializes a new instance of the <see cref="FileMgrWin"/> class.
        /// </summary>
        public FileMgrWin ()

        {
            this.InitializeComponent();
            this.controlBlock = new DSControlBlock();

            this.filemgrDataBlock = new FilemgrDataBlock();
        }

        /// <summary>

        /// Gets or sets the screenset class.
        /// </summary>
        /// <value>The screenset class.</value>
        public ScreenSet ScreenSet
        {

            get
            {
                return this.screenSet;
            }
            set

            {
                this.screenSet = value;
            }
        }

        /// <summary>
        /// Gets the forms class.
        /// </summary>
        /// <value>The forms class.</value>

        private FilemgrForms FilemgrForms
        {
            get
            {
                return ((FilemgrForms)(this.ScreenSet.Forms));

            }
        }

        /// <summary>
        /// Gets the global script class.
        /// </summary>

        /// <value>The global script class.</value>
        public FilemgrGlobalScript FilemgrGlobalScript
        {
            get
            {

                return ((FilemgrGlobalScript)(this.ScreenSet.GlobalScript));
            }
        }

        // FileMgrWin control event: KeyDown
        protected void FileMgrWin_ControlEvent_KeyDown (object sender, KeyEventArgs e)

        {
            Keys keyCode = e.KeyCode;
            bool controlPressed = e.Control;

            bool shiftPressed = e.Shift;
            bool altPressed = e.Alt;

            if (((keyCode == Keys.Escape) &&
                ((controlPressed == false) &&

                ((shiftPressed == false) &&
                (altPressed == false)))))
            {

                this.FilemgrGlobalScript.ScriptEvent_Esc(sender, e);
                return;

            }
        }

        // toolStripMenuItemExit control event: Click
        protected void toolStripMenuItemExit_ControlEvent_Click (object sender, EventArgs e)

        {
            this.ScriptMenuEvent_Exit(sender, e);
        }

        // FileMgrWin script event: WINDOW-CREATED
        public void ScriptEvent_WindowCreated (object sender, EventArgs e)

        {
            this.FilemgrGlobalScript.ScriptEvent_WindowCreated(sender, e);
        }

        // FileMgrWin script event: CLOSED-WINDOW
        public void ScriptEvent_ClosedWindow (object sender, EventArgs e)

        {
            this.FilemgrGlobalScript.ScriptEvent_ClosedWindow(sender, e);
        }

        // FileMgrWin script menu event: @EXIT
        public bool ScriptMenuEvent_Exit (object sender, EventArgs e)

        {
            if ((DSGRun.Retc(this) == false))

            {
                return false;
            }
            return true;
        }

    }
}

Code example: FilemgrScreenset\FileMgrWin.Designer.cs
namespace FilemgrScreenset {
    public partial class FileMgrWin : System.Windows.Forms.Form {

        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components;

        private System.Windows.Forms.BindingSource bindingSource1;
        public DevExpress.XtraEditors.LabelControl labelControl1;

        public DevExpress.XtraEditors.LabelControl labelControl2;
        public DevExpress.XtraEditors.LabelControl labelControl3;

        public DevExpress.XtraEditors.LabelControl labelControl4;
        public DevExpress.XtraEditors.LabelControl labelControl5;

        public DevExpress.XtraEditors.LabelControl labelControl6;
        public System.Windows.Forms.MenuStrip menuStrip1;

        public System.Windows.Forms.ToolStripMenuItem toolStripMenuItem1;
        public System.Windows.Forms.ToolStripMenuItem toolStripMenuItemExit;

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>

        private void InitializeComponent() {
            this.components = new System.ComponentModel.Container();

            FilemgrScreenset.FilemgrDataBlock filemgrDataBlock1 = new FilemgrScreenset.FilemgrDataBlock();
            this.bindingSource1 = new System.Windows.Forms.BindingSource(this.components);

            this.labelControl1 = new DevExpress.XtraEditors.LabelControl();
            this.labelControl2 = new DevExpress.XtraEditors.LabelControl();

            this.labelControl3 = new DevExpress.XtraEditors.LabelControl();
            this.labelControl4 = new DevExpress.XtraEditors.LabelControl();

            this.labelControl5 = new DevExpress.XtraEditors.LabelControl();
            this.labelControl6 = new DevExpress.XtraEditors.LabelControl();

            this.menuStrip1 = new System.Windows.Forms.MenuStrip();

            this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();

            this.toolStripMenuItemExit = new System.Windows.Forms.ToolStripMenuItem();

            ((System.ComponentModel.ISupportInitialize) (this.bindingSource1)).BeginInit();
            this.menuStrip1.SuspendLayout();

            this.SuspendLayout();
            //
            // bindingSource1
            //
            filemgrDataBlock1.Dummy = "";

            this.bindingSource1.DataSource = filemgrDataBlock1;
            this.bindingSource1.Position = 0;

            //
            // labelControl1
            //
            this.labelControl1.Appearance.Font = new System.Drawing.Font("MS Sans Serif", 10F);

            this.labelControl1.Appearance.Options.UseFont = true;
            this.labelControl1.Location = new System.Drawing.Point(8, 171);

            this.labelControl1.Name = "labelControl1";
            this.labelControl1.Size = new System.Drawing.Size(304, 16);

            this.labelControl1.TabIndex = 4;
            this.labelControl1.Text = "NOTE: the parent of this window is a \"hidden\"";

            //
            // labelControl2
            //
            this.labelControl2.Appearance.Font = new System.Drawing.Font("MS Sans Serif", 10F);

            this.labelControl2.Appearance.Options.UseFont = true;
            this.labelControl2.Location = new System.Drawing.Point(16, 91);

            this.labelControl2.Name = "labelControl2";
            this.labelControl2.Size = new System.Drawing.Size(258, 16);

            this.labelControl2.TabIndex = 1;
            this.labelControl2.Text = "File Management functions. Select Exit";

            //
            // labelControl3
            //
            this.labelControl3.Appearance.Font = new System.Drawing.Font("MS Sans Serif", 10F);

            this.labelControl3.Appearance.Options.UseFont = true;
            this.labelControl3.Location = new System.Drawing.Point(16, 123);

            this.labelControl3.Name = "labelControl3";
            this.labelControl3.Size = new System.Drawing.Size(70, 16);

            this.labelControl3.TabIndex = 3;
            this.labelControl3.Text = "screenset.";

            //
            // labelControl4
            //
            this.labelControl4.Appearance.Font = new System.Drawing.Font("MS Sans Serif", 10F);

            this.labelControl4.Appearance.Options.UseFont = true;
            this.labelControl4.Location = new System.Drawing.Point(16, 75);

            this.labelControl4.Name = "labelControl4";
            this.labelControl4.Size = new System.Drawing.Size(293, 16);

            this.labelControl4.TabIndex = 0;
            this.labelControl4.Text = "This screenset would contain the necessary";

            //
            // labelControl5
            //
            this.labelControl5.Appearance.Font = new System.Drawing.Font("MS Sans Serif", 10F);

            this.labelControl5.Appearance.Options.UseFont = true;
            this.labelControl5.Location = new System.Drawing.Point(8, 187);

            this.labelControl5.Name = "labelControl5";
            this.labelControl5.Size = new System.Drawing.Size(177, 16);

            this.labelControl5.TabIndex = 5;
            this.labelControl5.Text = "Dialog Box forcing modality";

            //
            // labelControl6
            //
            this.labelControl6.Appearance.Font = new System.Drawing.Font("MS Sans Serif", 10F);

            this.labelControl6.Appearance.Options.UseFont = true;
            this.labelControl6.Location = new System.Drawing.Point(16, 107);

            this.labelControl6.Name = "labelControl6";
            this.labelControl6.Size = new System.Drawing.Size(297, 16);

            this.labelControl6.TabIndex = 2;
            this.labelControl6.Text = "from the File pull-down to return to the main";

            //
            // menuStrip1
            //
            this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {

            this.toolStripMenuItem1});
            this.menuStrip1.Location = new System.Drawing.Point(0, 0);

            this.menuStrip1.Name = "menuStrip1";
            this.menuStrip1.Size = new System.Drawing.Size(389, 24);

            this.menuStrip1.TabIndex = 6;
            this.menuStrip1.Text = "menuStrip1";

            //
            // toolStripMenuItem1
            //
            this.toolStripMenuItem1.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {

            this.toolStripMenuItemExit});
            this.toolStripMenuItem1.Name = "toolStripMenuItem1";

            this.toolStripMenuItem1.Size = new System.Drawing.Size(35, 20);

            this.toolStripMenuItem1.Text = "&File";
            //
            // toolStripMenuItemExit

            //
            this.toolStripMenuItemExit.Name = "toolStripMenuItemExit";
            this.toolStripMenuItemExit.ShortcutKeys = System.Windows.Forms.Keys.F3;

            this.toolStripMenuItemExit.Size = new System.Drawing.Size(111, 22);

            this.toolStripMenuItemExit.Text = "E&xit";
            this.toolStripMenuItemExit.Click += new System.EventHandler(this.toolStripMenuItemExit_ControlEvent_Click);

            //
            // FileMgrWin
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);

            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;

            this.ClientSize = new System.Drawing.Size(389, 211);

            this.Controls.Add(this.labelControl1);
            this.Controls.Add(this.labelControl2);

            this.Controls.Add(this.labelControl3);
            this.Controls.Add(this.labelControl4);

            this.Controls.Add(this.labelControl5);
            this.Controls.Add(this.labelControl6);

            this.Controls.Add(this.menuStrip1);
            this.Font = new System.Drawing.Font("MS Sans Serif", 10F);

            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;

            this.Location = new System.Drawing.Point(49, 51);

            this.MainMenuStrip = this.menuStrip1;
            this.MaximizeBox = false;

            this.MinimizeBox = false;
            this.Name = "FileMgrWin";

            this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;

            this.Text = "File Manager: ScreenSet Two";
            this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.FileMgrWin_ControlEvent_KeyDown);

            ((System.ComponentModel.ISupportInitialize) (this.bindingSource1)).EndInit();
            this.menuStrip1.ResumeLayout(false);

            this.menuStrip1.PerformLayout();
            this.ResumeLayout(false);
            this.PerformLayout();

        }
        #endregion

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>

        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing) {

            if (disposing) {
                if ((components != null)) {

                    this.components.Dispose();
                }
            }
            base.Dispose(disposing);

        }
    }
}