About cookies on this site Our websites require some cookies to function properly (required). In addition, other cookies may be used with your consent to analyze site usage, improve the user experience and for advertising. For more information, please review your options. By visiting our website, you agree to our processing of information as described in IBM’sprivacy statement. To provide a smooth navigation, your cookie preferences will be shared across the IBM web domains listed here.
Troubleshooting
Problem
This document incudes an example of a drop-down menu using the MNUBAR keyword. It also illustrates the use of CHCCTL with a PULLDOWN menu.
Resolving The Problem
This document incudes an example of a drop-down menu using the MNUBAR keyword. It also illustrates the use of CHCCTL with a PULLDOWN menu.
DDS display file "MNUBARF":
RPG ILE program:
**NOTE** The documentation for CHCCTL shows the following:
"The control-field parameter is required and it specifies the name of a 1-byte numeric hidden field that, on output, contains the control value for the choice."
For the workstation to know the values supplied to CHCCTL, a WRITE to the record containing those variables is required prior to the EXFMT of the menu bar.
-----------------------------------------------
The example allows you to select an option in the drop down:

If you select ONE in the FILE drop-down, you will see the following screen:

If you select TWO in the FILE drop-down, you will see the following screen:

DDS display file "MNUBARF":
A MNUCNL(CA12)
A
A R MB MNUBAR
A MNUFLD 2Y 0B 1 2
A MNUBARCHC(1 PULLFILE +
A '>FILE' )
A MNUBARCHC(2 PULLEDIT +
A '>EDIT' )
A MNUBARSEP((*COLOR WHT) +
A (*CHAR '.'))
A
A R RECORD MNUBARDSP(MB &MNUCHC &PULL)
A CF03(03 'EXIT')
A 10 3'THIS IS THE APPLICATION RECORD'
A FLD1 10 B 11 3
A FLD2 10 B 12 3
A MNUCHC 2Y 0H
A PULL 2S 0H
A
A R PULLFILE PULLDOWN
A F1 2Y 0B 1 02SNGCHCFLD(*AUTOENT)
A CHOICE(1 '>ONE')
A CHCCTL(1 &C1 MSG0001 XZY1337)
A CHOICE(2 '>TWO')
A CHCCTL(2 &C2 &MSG1 &LIB/&MSGF)
A CHOICE(3 '>THREE')
A CHCCTL(3 &C3)
A C1 1Y 0H
A C2 1Y 0H
A C3 1Y 0H
A MSG1 7A P
A LIB 10A P
A MSGF 10A P
A
A R PULLEDIT PULLDOWN
A F1 2Y 0B 1 02SNGCHCFLD
A CHOICE(1 '>ONE')
A CHCCTL(1 &C21)
A CHOICE(2 '>TWO')
A CHCCTL(2 &C22)
A CHOICE(3 '>THREE')
A CHCCTL(3 &C23)
A C21 1Y 0H
A C22 1Y 0H
A C23 1Y 0H
A
A R R1
A 3 30'YOU PICKED OPTION'
A 6 35'11111'
A 7 34'111111'
A 8 33'1111111'
A 9 36'1111'
A 10 36'1111'
A 11 36'1111'
A 12 36'1111'
A 13 36'1111'
A 14 36'1111'
A 15 36'1111'
A 16 36'1111'
A 17 33'1111111111'
A 18 33'1111111111'
A R R2
A 2 30'YOU PICKED OPTION'
A 6 34'2222222222'
A 7 33'222222222222'
A 8 32'2222'
A 8 42'2222'
A 9 41'2222'
A 10 40'2222'
A 11 39'2222'
A 12 38'2222'
A 13 37'2222'
A 14 36'2222'
A 18 32'22222222222222'
A 19 32'22222222222222'
A 17 33'2222'
A 15 35'2222'
A 16 34'2222'
A R R3
A 2 30'YOU PICKED OPTION'
A 7 30'33333333333333333'
A 12 30' 333333333333333'
A 18 30'33333333333333333'
A 6 31'333333333333333'
A 19 31'333333333333333'
A 14 44'3333'
A 15 45'3333'
A 17 44'3333'
A 13 30' 333333333333333'
A 8 44'3333'
A 10 45'3333'
A 11 44'3333'
A 9 45'3333'
A 16 45'3333'
RPG ILE program:
FMNUBARF CF E WORKSTN
C MOVE *BLANKS FLD1
C MOVE *BLANKS FLD2
DOW *IN03 = '0';
C Z-ADD 4 C3
WRITE PULLFILE;
EXFMT RECORD;
IF *IN03 = '0';
IF PULL > 0;
IF PULL = 1;
EXFMT R1;
ELSE;
IF PULL = 2;
EXFMT R2;
ELSE;
IF PULL = 3;
EXFMT R3;
ENDIF;
ENDIF;
ENDIF;
ENDIF;
ENDIF;
ENDDO;
C SETON LR
**NOTE** The documentation for CHCCTL shows the following:
"The control-field parameter is required and it specifies the name of a 1-byte numeric hidden field that, on output, contains the control value for the choice."
For the workstation to know the values supplied to CHCCTL, a WRITE to the record containing those variables is required prior to the EXFMT of the menu bar.
-----------------------------------------------
The example allows you to select an option in the drop down:

If you select ONE in the FILE drop-down, you will see the following screen:

If you select TWO in the FILE drop-down, you will see the following screen:

[{"Type":"MASTER","Line of Business":{"code":"LOB68","label":"Power HW"},"Business Unit":{"code":"BU070","label":"IBM Infrastructure"},"Product":{"code":"SWG60","label":"IBM i"},"ARM Category":[{"code":"a8m0z0000000CHtAAM","label":"Programming ILE Languages"}],"ARM Case Number":"","Platform":[{"code":"PF012","label":"IBM i"}],"Version":"All Versions"}]
Historical Number
595780217
Was this topic helpful?
Document Information
More support for:
IBM i
Component:
Programming ILE Languages
Software version:
All Versions
Operating system(s):
IBM i
Document number:
685443
Modified date:
20 January 2025
UID
nas8N1011591
Manage My Notification Subscriptions