Skip to main content

Hi,

I have a requirement where I need to call a form from another form after successful login.

The steps which need to happen is as follows

1) A Cobol program is executed and it open a win forms which is a login screen.

2) After providing you inputs the form should pass the values to calling Cobol Program without closing the form

3) The Cobol program should do your validation or checks and if success it should return to form with a message e.g. "initializing..... please wait" and then 4 & 5 step should happen. If not successful it should return with another message e.e. "invalid user/pass" and should again wait for user input.

4) The control should go back to the calling program for further process

5) After successful processing it should close the login form and display  the next form to the user

so it means that there is basically 1 cobol program which is driving the whole flow.

Can anyone help me to achieve this?

Thanks in advance


#FormVisualCobol
#COBOLVISUALCOBOLMIGRATION

Hi,

I have a requirement where I need to call a form from another form after successful login.

The steps which need to happen is as follows

1) A Cobol program is executed and it open a win forms which is a login screen.

2) After providing you inputs the form should pass the values to calling Cobol Program without closing the form

3) The Cobol program should do your validation or checks and if success it should return to form with a message e.g. "initializing..... please wait" and then 4 & 5 step should happen. If not successful it should return with another message e.e. "invalid user/pass" and should again wait for user input.

4) The control should go back to the calling program for further process

5) After successful processing it should close the login form and display  the next form to the user

so it means that there is basically 1 cobol program which is driving the whole flow.

Can anyone help me to achieve this?

Thanks in advance


#FormVisualCobol
#COBOLVISUALCOBOLMIGRATION

I have attached a new sample which shows a typical method of handling this type of flow but as this is a Windows Forms application it uses a main class instead of a COBOL program to control the flow.

In this demo the main method simply displays a login Dialog Box which accept user credentials and then validates them and returns an OK result if they are valid or a Cancel result if they are not.

If the user is validated then it will invoke a method that will display a message to the user and simulate initialization by simply putting the current thread to sleep for 5 seconds.

After initialization it will close the message and then display the main application form for processing.

There are other ways that this can be done but this is a pretty basic one. You may want to move the display of the message into the Application Run and then process the main screen in its Closing event after initialization has been completed.

Main class:

      $set ilusing"System.Threading" 
       class-id LogintoMenuSample2.Main.
       working-storage section.
       method-id Main static
           attribute System.STAThread.
       local-storage section.
       01 loginForm type LogintoMenuSample2.LoginForm.
       01 mainForm type LogintoMenuSample2.Form1.
       procedure division.
           
           set loginForm to new LogintoMenuSample2.LoginForm
           invoke loginForm::ShowDialog
           if loginForm::DialogResult = type DialogResult::OK
              invoke InitializeApp
              invoke type System.Windows.Forms.Application::EnableVisualStyles()
              set mainForm to new LogintoMenuSample2.Form1()
              invoke type System.Windows.Forms.Application::Run(mainForm)
           end-if
           goback.
       
       end method.
       method-id InitializeApp private static.
       procedure division.
           declare msgForm = new type LogintoMenuSample2.MessageForm 
           invoke msgForm::Show
           invoke type Thread::Sleep(5000)
           invoke msgForm::Close
           goback.
       end method.
       end class.

Hi,

I have a requirement where I need to call a form from another form after successful login.

The steps which need to happen is as follows

1) A Cobol program is executed and it open a win forms which is a login screen.

2) After providing you inputs the form should pass the values to calling Cobol Program without closing the form

3) The Cobol program should do your validation or checks and if success it should return to form with a message e.g. "initializing..... please wait" and then 4 & 5 step should happen. If not successful it should return with another message e.e. "invalid user/pass" and should again wait for user input.

4) The control should go back to the calling program for further process

5) After successful processing it should close the login form and display  the next form to the user

so it means that there is basically 1 cobol program which is driving the whole flow.

Can anyone help me to achieve this?

Thanks in advance


#FormVisualCobol
#COBOLVISUALCOBOLMIGRATION

Thanks Chris for sharing the demo app I have tried with the same concept but the requirement is cobol program will be the driver not win forms


Hi,

I have a requirement where I need to call a form from another form after successful login.

The steps which need to happen is as follows

1) A Cobol program is executed and it open a win forms which is a login screen.

2) After providing you inputs the form should pass the values to calling Cobol Program without closing the form

3) The Cobol program should do your validation or checks and if success it should return to form with a message e.g. "initializing..... please wait" and then 4 & 5 step should happen. If not successful it should return with another message e.e. "invalid user/pass" and should again wait for user input.

4) The control should go back to the calling program for further process

5) After successful processing it should close the login form and display  the next form to the user

so it means that there is basically 1 cobol program which is driving the whole flow.

Can anyone help me to achieve this?

Thanks in advance


#FormVisualCobol
#COBOLVISUALCOBOLMIGRATION

Perhaps if you could explain the actual concept behind this requirement I could make recommendations here. You could certainly change the main class here to be a non-console based COBOL program and it would work the same way but if you are working with the forms classes anyway it seems to make more sense to make this a Windows Form application.

Do you wish to have some sort of mixed character mode/GUI application?


Hi,

I have a requirement where I need to call a form from another form after successful login.

The steps which need to happen is as follows

1) A Cobol program is executed and it open a win forms which is a login screen.

2) After providing you inputs the form should pass the values to calling Cobol Program without closing the form

3) The Cobol program should do your validation or checks and if success it should return to form with a message e.g. "initializing..... please wait" and then 4 & 5 step should happen. If not successful it should return with another message e.e. "invalid user/pass" and should again wait for user input.

4) The control should go back to the calling program for further process

5) After successful processing it should close the login form and display  the next form to the user

so it means that there is basically 1 cobol program which is driving the whole flow.

Can anyone help me to achieve this?

Thanks in advance


#FormVisualCobol
#COBOLVISUALCOBOLMIGRATION

yes we have some mixed kind of requirement that's fine we will see to make the change as suggested by you. "Making win forms as the drivers"

Thanks a lot


Hi,

I have a requirement where I need to call a form from another form after successful login.

The steps which need to happen is as follows

1) A Cobol program is executed and it open a win forms which is a login screen.

2) After providing you inputs the form should pass the values to calling Cobol Program without closing the form

3) The Cobol program should do your validation or checks and if success it should return to form with a message e.g. "initializing..... please wait" and then 4 & 5 step should happen. If not successful it should return with another message e.e. "invalid user/pass" and should again wait for user input.

4) The control should go back to the calling program for further process

5) After successful processing it should close the login form and display  the next form to the user

so it means that there is basically 1 cobol program which is driving the whole flow.

Can anyone help me to achieve this?

Thanks in advance


#FormVisualCobol
#COBOLVISUALCOBOLMIGRATION

Hi Chris,

The main form will open the second form using threading on button 1 click . On button 2 click I will open a 3rd form using thread.

so basically my 1st form is having 2 button and 1 text box

Now I want form1 text box text to be populated from click of button in 3rd form.

if I will directly do this it will say cross threading error how could  I achieve this.


Hi,

I have a requirement where I need to call a form from another form after successful login.

The steps which need to happen is as follows

1) A Cobol program is executed and it open a win forms which is a login screen.

2) After providing you inputs the form should pass the values to calling Cobol Program without closing the form

3) The Cobol program should do your validation or checks and if success it should return to form with a message e.g. "initializing..... please wait" and then 4 & 5 step should happen. If not successful it should return with another message e.e. "invalid user/pass" and should again wait for user input.

4) The control should go back to the calling program for further process

5) After successful processing it should close the login form and display  the next form to the user

so it means that there is basically 1 cobol program which is driving the whole flow.

Can anyone help me to achieve this?

Thanks in advance


#FormVisualCobol
#COBOLVISUALCOBOLMIGRATION

I was able to figure out the solution.

I added a timer control and used thread to open the form with timer,

Thanks Chris for all your help