I need to ask what is the problem in this my menu program,when i call another program
by tapping 1 or 2, and when the program called i could not go back to my menu program,
can you help me please how can i get back to my menu when i press Esc key,or does
my Call statment is wrong.
this is the code for my menu program.
LINKAGE SECTION.
01 MY-PROG1 PIC X.
01 MY-PROG2 PIC X.
......
......
......
MAIN.
DISPLAY MENU-HEADER ERROR-MESSAGE.
PERFORM ENTRY-MENU UNTIL CHOICE = 3.
STOP RUN.
ENTRY-MENU.
ACCEPT MENU-SELECT.
PERFORM INPUT-CHOICE UNTIL CHOICE = 3.
STOP RUN.
INPUT-CHOICE.
IF CHOICE = 1
CALL 'MY-PROGRAM1' USING MY-PROG1
ELSE IF CHOICE =2
CALL 'MY-PROGRAM2' USING MY-PROG2
ELSE
MOVE "INVALID INPUT....." TO ERRMSG
DISPLAY ERROR-MESSAGE.
this is MY-PROGRAM1.COB this is how i call back the menu program when i press Esc key
LINKAGE SECTION.
01 MY-PROG1 PIC X.
01 MY-MENU PIC X.
......
......
......
MAIN.
.......
.......
STOP RUN.
ENTER-BIRTHDATE.
ACCEPT...
.......
IF ESC-KEY
DISPLAY CLEAR-SCREEN
CALL 'MENU'
ELSE IF F10
.....
.....
You should replace the
STOP RUNstatement in the called programm withGOBACK.This is the general rules of using
STOP RUNandGOBACK:At the end of this link you can find a nice schema that represent all those relations.
Edit : (from an old Microsoft Cobol documentation)