Home » 2022 » July » 9 » How to create Menu driven interface in UNIBASIC / UNIDATA programming

8:35 PM
How to create Menu driven interface in UNIBASIC / UNIDATA programming

Unibasic programming provides two ways to run programs or commands. 

  • Command based (on TCL prompt)
  • Menu driven interface

With UniData MENUS, you can transform the UniData command line interface into a menu driven interface.

Menu driven option is a better option to run any command PROC or sentence in Unibasic.

The advantage of menu driven :

You can use a menu to support database security. For example, you can provide menus for users to access data entry programs and reports, while denying them access to the UniData prompt.

All menus are stored in MENUFILE , each UV account usually has a MENUFILE created when the new UV Account is created. 
If MENUFILE is not present , you can create a menu file using the CREATE-FILE command.

:CT VOC MENUFILE
VOC:

MENUFILE:
F
MENUFILE
D_MENUFILE
:

To see all the menus present in MENUFILE,
SORT MENUFILE 17:34:06 Jul 09 2022 1
MENUFILE..

ABC
SHAN.MENU
2 records listed

To start a menu , JUST type menu name and press <Enter> on TCL prompt

                  MENUS BY SHANKAR                   17:34:18 Jul 09 2022

 1 SHOW DATE
 2 IT SHOWS THE CURRENT SYSTEM DATE

Enter Selection:

To start MENU maintenance screen to create/modify delete a menu, run MENUS on TCL prompt   

 MENU Maintenance     17:32:47 Jul 09 2022

 1= Enter/Modify   a MENU
 2= Enter/Modify   a formatted MENU
 3= Display        a summary of all MENUs on a MENU file
 4= Display        the contents of a MENU
 5= Enter/Modify   a VOC MENU selector
 6= Enter/Modify   a VOC stored sentence item
 7= Display        all MENU selector item on the VOC file
 8= Display        all stored sentence items on the VOC file
 9= Display        the dictionary of a file
10= Print          a summary of all MENUs on a MENU file
11= Print          the contentes of a MENU
12= Print          the dictionary of a file
13= Enter/Modify   a VOC stored paragraph item


which would you like? (1 - 13)=

Note:
If menus don't hold up when selected and executed,

check UDT.OPTIONS 37 and turn it ON

29  U_DW_SUNDAY7      OFF
30  U_BK_VLINE_SUP    OFF
31  U_VLINE_FMT       OFF
32  U_PI_PRINT_AT     OFF
33  U_RAW_DATA        OFF
34  U_HEADING_DATE    OFF
35  U_EXEC_LOCK       OFF
36  U_QPRINT_ON       OFF
37  U_MENUPAUSE       OFF
38  U_BREAKTOECL      OFF
39  U_CNAME_ALL       OFF
40  U_NOEXECCHAIN     OFF
41  U_UDT_SERVER      OFF
42  U_CHECKREMOTE     OFF
43  U_PRM_DETSUP       OFF
44  U_ERR_JRNL_SUS    OFF
45  U_PROMPTDATA      OFF
46  U_UNFLUSHDATA     ON
Enter <New line> to continue...Q
:UDT.OPTIONS 37 ON
:
:SHAN.MENU
                 MENUS BY SHANKAR                   17:42:12 Jul 09 2022

 1 SHOW DATE
 2 IT SHOWS THE CURRENT SYSTEM DATE
Enter Selection: 1
17:42:14 Jul 09 2022

Enter <New line> to continue...

To create a new menu, run MENUS and select option 1 to create simple menu

      MENU Maintenance     17:49:28 Jul 09 2022

 1= Enter/Modify   a MENU
 2= Enter/Modify   a formatted MENU
 3= Display        a summary of all MENUs on a MENU file
 4= Display        the contents of a MENU
 5= Enter/Modify   a VOC MENU selector
 6= Enter/Modify   a VOC stored sentence item
 7= Display        all MENU selector item on the VOC file
 8= Display        all stored sentence items on the VOC file
 9= Display        the dictionary of a file
10= Print          a summary of all MENUs on a MENU file
11= Print          the contentes of a MENU
12= Print          the dictionary of a file
13= Enter/Modify   a VOC stored paragraph item


which would you like? (1 - 13)=1
enter following details

FILE NAME=MENUFILE
id(MENU NAME)=SHAN.NEW.MENU
Title=THIS IS DEMO PURPOSE MENU
Desc=RUN WHO
Action=WHO
Exp=THIS WILL RUN WHO AND SHOW THE CURRENT USER ID
** from here it will prompt for another menu choice
Desc=LIST CLIENTS WITH NAME starting with Paul...
Action=LIST CLIENTS WITH NAME LIKE Paul...
Exp=THIS WILL LIST ALL THE CLEINTS WITH NAME Paul FROM CLIENTS FILE
**AGAIN another menu option starts here
Desc=
just press enter to end crating menu options, here it will allow you to add more details
to menu like PROMPT,EXITS

Prompt=
 1   MENU NAME=SHAN.NEW.MENU
 2   TITLE=THIS IS DEMO PURPOSE MENU
 3   PROMPT=
 4   EXITS=
 5   STOPS=
 6   DESC ACTION EXP
CHANGE=

 

  • JUST press enter if you want to proceed without any further updates

Now check if the menu is created or not
sort MENUFILE 17:56:28 Jul 09 2022 1
MENUFILE..

ABC
SHAN.MENU
SHAN.NEW.MENU
3 records listed

  • But you can not run it unless you make an entry in VOC.


:SHAN.NEW.MENU
Not a verb
 SHAN.NEW.MENU

  • You can add entry into VOC by 2 ways.


1. Using editor : ED VOC SHAN.NEW.MENU
2.Using MENUS maintenance screen, OPTION # 5
     MENU Maintenance     20:27:23 Jul 09 2022

 1= Enter/Modify   a MENU
 2= Enter/Modify   a formatted MENU
 3= Display        a summary of all MENUs on a MENU file
 4= Display        the contents of a MENU
 5= Enter/Modify   a VOC MENU selector
 6= Enter/Modify   a VOC stored sentence item  
 7= Display        all MENU selector item on the VOC file
 8= Display        all stored sentence items on the VOC file
 9= Display        the dictionary of a file
10= Print          a summary of all MENUs on a MENU file
11= Print          the contents of a MENU
12= Print          the dictionary of a file
13= Enter/Modify   a VOC stored paragraph item


which would you like? (1 - 13)=5
MENU NAME=SHAN.NEW.MENU
DESC=THIS IS A MENU FOR DEMO PURPOSE
MENU FILE NAME=MENUFILE
RECORD NAME IN MENU FILE=SHAN.NEW.MENU
 1 MENU NAME=SHAN.NEW.MENU
 2 TYPE=M
 3 DESC= THIS IS A MENU FOR DEMO PURPOSE
 4 MENU FILE NAME=MENUFILE
 5 RECORD NAME IN MENU FILE=SHAN.NEW.MENU
CHANGE=
Just press <ENTER> , to continue


Now you can see that the VOC ENTRY is present

:CT VOC SHAN.NEW.MENU
VOC:

SHAN.NEW.MENU:
M THIS IS A MENU FOR DEMO PURPOSE
MENUFILE
SHAN.NEW.MENU
:

Now try running it by just typing the menu name on TCL:

:SHAN.NEW.MENU

              THIS IS DEMO PURPOSE MENU              20:30:11 Jul 09 2022

 1 RUN WHO
 2 LIST CLIENTS WITH NAME starting with Paul...
Enter Selection: 1

SHANKY          Console     17:20:55 Jul 09 2022

Enter <New line> to continue...
   THIS IS DEMO PURPOSE MENU              20:34:07 Jul 09 2022

 1 RUN WHO
 2 LIST CLIENTS WITH NAME JOHN
Enter Selection: 2
LIST CLIENTS WITH NAME LIKE Paul... NAME COMPANY ADDRESS CITY STATE ZIP COUNTRY PHONE PHONE_TYPE 20:38:43 Jul 09 2022 1
CLIENTS                 9999
Name              Paul Castiglione
Company Name      Chez Paul
Address           45, reu de Rivoli
City              Paris
State/Territory
Postal Code             75008
Country           France
Phone Number      (33) (4) 24-25-54-4
                  (33) (4) 26-64-85-7
Phone Category    Work
                  Fax

CLIENTS                10005
Name              Pauline Pappas
Company Name      Pacific Interior
Address           62 Logan St.
City              Stanton
State/Territory   IA
Postal Code             40258
Country           USA
Phone Number            (712) 589-6325
Enter <New line> to continue...

  • To make an update to an existing MENU item

which would you like? (1 - 13)=2
FILE NAME=MENUFILE
id(MENU NAME)=SHAN.NEW.MENU
 1   MENU NAME=SHAN.NEW.MENU
 2   TITLE=THIS IS DEMO PURPOSE MENU
 3   PROMPT=
 4   EXITS=
 5   STOPS=
 6   DESC ACTION EXP
CHANGE=6
  1 DESC=RUN WHO
  1 ACTION=WHO
  1 EXP=THIS WILL RUN WHO AND SHOW THE CURRENT USER ID
  2 DESC=LIST CLIENTS WITH NAME JOHN
  2 ACTION=LIST CLIENTS WITH NAME "JOHN"
  2 EXP=THIS WILL LIST ALL THE CLEINTS WITH NAME JOHN FROM CLIENTS FILE
  3    

Enter (D)elete to delete,(I)nsert to insert or line number to change=2
DESC=LIST CLIENTS WITH NAME starting with Paul
ACTION=LIST CLIENTS WITH NAME LIKE Paul...
EXP=THIS WILL LIST ALL THE CLEINTS WITH NAME Paul FROM CLIENTS FILE
  1 DESC=RUN WHO
  1 ACTION=WHO
  1 EXP=THIS WILL RUN WHO AND SHOW THE CURRENT USER ID
  2 DESC=LIST CLIENTS WITH NAME starting with Paul
  2 ACTION=LIST CLIENTS WITH NAME LIKE Paul...
  2 EXP=THIS WILL LIST ALL THE CLEINTS WITH NAME Paul FROM CLIENTS FILE
  3

Enter (D)elete to delete,(I)nsert to insert or line number to change=

  • You can also view/edit MENU entries using CT/ED

:CT MENUFILE SHAN.NEW.MENU
MENUFILE:

SHAN.NEW.MENU:
THIS IS DEMO PURPOSE MENU
RUN WHO²LIST CLIENTS WITH NAME starting with Paul
WHO²LIST CLIENTS WITH NAME LIKE Paul...
THIS WILL RUN WHO AND SHOW THE CURRENT USER ID²THIS WILL LIST ALL THE CLEINTS WITH NAME Paul FROM CLIENTS FILE


FOR any menus option if you need help, you can type option # followed by ?

            THIS IS DEMO PURPOSE MENU              20:48:34 Jul 09 2022

 1 RUN WHO
 2 LIST CLIENTS WITH NAME starting with Paul
Enter Selection: 2?
THIS WILL LIST ALL THE CLEINTS WITH NAME Paul FROM CLIENTS FILE
LIST CLIENTS WITH NAME LIKE Paul...
Enter return to continue

The default prompt will be "Enter selection"
You can always change it using the MENUS, option # 3


which would you like? (1 - 13)=2
FILE NAME=MENUFILE
id(MENU NAME)=SHAN.NEW.MENU
 1   MENU NAME=SHAN.NEW.MENU
 2   TITLE=THIS IS DEMO PURPOSE MENU
 3   PROMPT=
 4   EXITS=
 5   STOPS=
 6   DESC ACTION EXP
CHANGE=3
 PROMPT=Hey, what do you want to do?
 1   MENU NAME=SHAN.NEW.MENU
 2   TITLE=THIS IS DEMO PURPOSE MENU
 3   PROMPT=Hey, what do you want to do?
 4   EXITS=
 5   STOPS=
 6   DESC ACTION EXP
CHANGE=
press <ENTER> to continue

CHECK THE CHANGES
:SHAN.NEW.MENU

     THIS IS DEMO PURPOSE MENU              20:54:30 Jul 09 2022

 1 RUN WHO
 2 LIST CLIENTS WITH NAME starting with Paul
Hey, what do you want to do?

  • TO ADD A NEW MENU option

which would you like? (1 - 13)=2
FILE NAME=MENUFILE
id(MENU NAME)=SHAN.NEW.MENU
 1   MENU NAME=SHAN.NEW.MENU
 2   TITLE=THIS IS DEMO PURPOSE MENU
 3   PROMPT=Hey, what do you want to do?
 4   EXITS=
 5   STOPS=
 6   DESC ACTION EXP
CHANGE=6
  1 DESC=RUN WHO
  1 ACTION=WHO
  1 EXP=THIS WILL RUN WHO AND SHOW THE CURRENT USER ID
  2 DESC=LIST CLIENTS WITH NAME starting with Paul
  2 ACTION=LIST CLIENTS WITH NAME LIKE Paul...
  2 EXP=THIS WILL LIST ALL THE CLEINTS WITH NAME Paul FROM CLIENTS FILE
  3

Enter (D)elete to delete,(I)nsert to insert or line number to change=3
DESC=REVERSE A STRING
ACTION=RUN BP REVERSESTRING
EXP=THIS WILL REVERSE A GIVEN STRING
  1 DESC=RUN WHO
  1 ACTION=WHO
  1 EXP=THIS WILL RUN WHO AND SHOW THE CURRENT USER ID
  2 DESC=LIST CLIENTS WITH NAME starting with Paul
  2 ACTION=LIST CLIENTS WITH NAME LIKE Paul...
  2 EXP=THIS WILL LIST ALL THE CLEINTS WITH NAME Paul FROM CLIENTS FILE
  3 DESC=REVERSE A STRING
  3 ACTION=RUN BP REVERSESTRING
  3 EXP=THIS WILL REVERSE A GIVEN STRING
  4

Enter (D)elete to delete,(I)nsert to insert or line number to change=

Just press enter twice

 

  • Check the updated menu:

To see all the options of a menu, use option # 4

which would you like? (1 - 13)=4
FILE NAME=MENUFILE
id(MENU NAME)=SHAN.NEW.MENU
  MENU NAME=SHAN.NEW.MENU
  TITLE=THIS IS DEMO PURPOSE MENU
  DESC=RUN WHO
  ACTION=WHO
  EXP=THIS WILL RUN WHO AND SHOW THE CURRENT USER ID

  DESC=LIST CLIENTS WITH NAME starting with Paul
  ACTION=LIST CLIENTS WITH NAME LIKE Paul...
  EXP=THIS WILL LIST ALL THE CLEINTS WITH NAME Paul FROM CLIENTS FILE

  DESC=REVERSE A STRING
  ACTION=RUN BP REVERSESTRING
  EXP=THIS WILL REVERSE A GIVEN STRING

  PROMPT=Hey, what do you want to do?
  EXITS=
  STOPS=


:SHAN.NEW.MENU
   THIS IS DEMO PURPOSE MENU              21:13:11 Jul 09 2022

 1 RUN WHO
 2 LIST CLIENTS WITH NAME starting with Paul
 3 REVERSE A STRING
Hey, what do you want to do?3
?SHANKARBHAGAT.COM
MOC.TAGAHBRAKNAHS
Enter <New line> to continue...

1= Enter/Modify   a MENU
 2= Enter/Modify   a formatted MENU
 3= Display        a summary of all MENUs on a MENU file
 4= Display        the contents of a MENU
 5= Enter/Modify   a VOC MENU selector
 6= Enter/Modify   a VOC stored sentence item
 7= Display        all MENU selector item on the VOC file
 8= Display        all stored sentence items on the VOC file
 9= Display        the dictionary of a file
10= Print          a summary of all MENUs on a MENU file
11= Print          the contentes of a MENU
12= Print          the dictionary of a file
13= Enter/Modify   a VOC stored paragraph item


which would you like? (1 - 13)=7
File Name = VOC
name        =abc
type+description=M
menu file name  =
menu name       =

name        =ABC
type+description=M MENUS 2ND
menu file name  =MENUFILE
menu name       =ABC

name        =SHAN.MENU
type+description=MMENUS BY SHANKAR
menu file name  =MENUFILE
menu name       =SHAN.MENU

name        =SHAN.NEW.MENU
type+description=M THIS IS A MENU FOR DEMO PURPOSE
menu file name  =MENUFILE
menu name       =SHAN.NEW.MENU

Enter return to continue

We shall see further more concepts about MENUS in coming blogs, stay tuned..

Please like comment and share!!

 

 
 

Category: Programming Languages | Views: 742 | Added by: shanky | Tags: sb+, universe, uv, unidata, programming, unibasic | Rating: 5.0/1

Related blogs


You may also like to see:



Total comments: 0
ComForm">
avatar