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.