Visual Cobol Linkage

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.

  • Verified Answer

    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.

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

    I am moving forward steadily...