Sometimes you may want to have some special routines to apply similar changes to GUI controls of one or more screen programs. You can do this by passing the handle of the control, defined in the calling program, to a called program which would then modify the control.
For example, let's say you have a combo-box that shows the names of the days of the week on multiple screen programs. You want a routine to fill the combo-box with the days of the week for any screen program that requires it rather than having the same code in each program. The code for that could be as follows:
WORKING-STORAGE SECTION. ... 77 cb1-handle handle of combo-box. ... SCREEN SECTION. 01 screen-1. 03 CB1 Combo-box ...
Then in Procedure Division:
... set cb1-handle to handle of cb1. call "filldays" using cb1-handle. ...
In the calling program:
LINKAGE SECTION. 77 cb1-handle handle of combo-box. PROCEDURE DIVISION USING cb1-handle. MAIN. modify cb1-handle item-to-add "Monday" item-to-add "Tuesday" item-to-add "Wednesday" item-to-add "Thursday" item-to-add "Friday" item-to-add "Saturday" item-to-add "Sunday". ...
Attached you can find two sample programs that fully illustrate this sample case.
Article ID: 315
Created: December 4, 2020
Last Updated: December 23, 2025
Author: Support KB Author
Online URL: https://support.veryant.com/phpkb/article.php?id=315