Highlighted
Absent Member.
Absent Member.
1617 views

Visual Cobol Linkage

Jump to solution

Hello Everyone,

Does any one have a short example on to pass a data field to a visual managed windows cobol form and then update that data in the "called" program which is also of the same type and have it return the updated data to the original program...Both programs are windows managed forms... I have no problem seeing the data in the called program.... I seem to be unable to see the updated data when the called program terminates. I know I can use a common file to pass data back and forth.... Any help is appreciated....

Calling Code

Working-Storage Section.

01 ws-custid-linkage     pic x(06).

method-id TbxCustId_KeyDown final private.
       Local-storage section.
       01 my-custsearchlist    type MPSSYSMAIN.CUSTSEARCHLISTForm1.

       
       procedure division using by value sender as object e as type System.Windows.Forms.KeyEventArgs.
       
              if e::"KeyCode"= type "System.Windows.Forms.Keys"::"Escape"
                     set my-custsearchlist to new CUSTSEARCHLISTForm1(ws-custid-linkage)
                     invoke my-custsearchlist::ShowDialog(self)
........................................................................................................................................................................................................

.

Called Program

Working-Storage Section.

01 ws-custid-linkage     pic x(06).

       method-id NEW.
       procedure division using in-custid-linkage as STRING.
           invoke self::InitializeComponent
           SET ws-custid-linkage to in-custid-linkage(1:6)
           goback.
       end method.
.....

       method-id ButExit_Click final private.
       procedure division using by value sender as object e as type System.EventArgs.
       set ws-custid-linkage to TexBoxSearch::Text
       invoke self::Close()
       end method.

0 Likes
1 Solution

Accepted Solutions
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: Visual Cobol Linkage

Jump to solution

Instead of passing data back and forth it might be best to define the data item as a property in the called program and then you can set and retrieve its value from either program using the property get/set syntax.

Example"

Calling Code

Working-Storage Section.
01 ws-custid-linkage     pic x(06).
method-id TbxCustId_KeyDown final private.
      Local-storage section.
      01 my-custsearchlist    type MPSSYSMAIN.CUSTSEARCHLISTForm1.
      procedure division using by value sender as object e as type System.Windows.Forms.KeyEventArgs.
             if e::"KeyCode"= type "System.Windows.Forms.Keys"::"Escape"
                     set my-custsearchlist to new CUSTSEARCHLISTForm1
                     set mycustsearchlist::custidproperty to ws-custid-linkage
                     invoke my-custsearchlist::ShowDialog(self)
               end-if
           *> after second form closed you can retrieve value using following
               set ws-custid-linkage to mycustsearchlist::custidproperty

Called Program

Working-Storage Section.
01 custidproperty     pic x(06) property.
      method-id NEW.
      procedure division..
          invoke self::InitializeComponent
          goback.

      end method.

      method-id ButExit_Click final private.
      procedure division using by value sender as object e as type System.EventArgs.
          set custidproperty to TexBoxSearch::Text
          invoke self::Close()
      end method.

View solution in original post

0 Likes
2 Replies
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: Visual Cobol Linkage

Jump to solution

Instead of passing data back and forth it might be best to define the data item as a property in the called program and then you can set and retrieve its value from either program using the property get/set syntax.

Example"

Calling Code

Working-Storage Section.
01 ws-custid-linkage     pic x(06).
method-id TbxCustId_KeyDown final private.
      Local-storage section.
      01 my-custsearchlist    type MPSSYSMAIN.CUSTSEARCHLISTForm1.
      procedure division using by value sender as object e as type System.Windows.Forms.KeyEventArgs.
             if e::"KeyCode"= type "System.Windows.Forms.Keys"::"Escape"
                     set my-custsearchlist to new CUSTSEARCHLISTForm1
                     set mycustsearchlist::custidproperty to ws-custid-linkage
                     invoke my-custsearchlist::ShowDialog(self)
               end-if
           *> after second form closed you can retrieve value using following
               set ws-custid-linkage to mycustsearchlist::custidproperty

Called Program

Working-Storage Section.
01 custidproperty     pic x(06) property.
      method-id NEW.
      procedure division..
          invoke self::InitializeComponent
          goback.

      end method.

      method-id ButExit_Click final private.
      procedure division using by value sender as object e as type System.EventArgs.
          set custidproperty to TexBoxSearch::Text
          invoke self::Close()
      end method.

View solution in original post

0 Likes
Highlighted
Absent Member.
Absent Member.

RE: Visual Cobol Linkage

Jump to solution

Thanks Chris... This old procedural programmer thanks you for your rapid response and it works !!

I am moving forward steadily...

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.