The ISPF Dialog Manager is the core component that handles panel invocation, display, and navigation. Dialog Manager services enable programs to invoke panels programmatically, display interactive dialogs, collect user input, and control panel navigation. Understanding Dialog Manager services is essential for building interactive ISPF applications with REXX, CLIST, and other programming languages. This tutorial covers Dialog Manager architecture, panel invocation mechanisms, SELECT_PANEL and DISPLAY_PANEL services, panel navigation, and building interactive applications.
Dialog Manager services provide the interface between your programs and ISPF panels. When you call DISPLAY PANEL from REXX, the Dialog Manager locates the panel, displays it, processes user input, and returns control to your program. Learning to use Dialog Manager services enables you to create sophisticated interactive applications that leverage ISPF's panel-driven interface. This tutorial provides comprehensive guidance for using Dialog Manager services programmatically.
The Dialog Manager is ISPF's component responsible for panel management and invocation.
The Dialog Manager:
The Dialog Manager architecture includes:
The Dialog Manager sits between your programs and ISPF panels, translating service calls into panel operations.
The Dialog Manager locates panels by searching the panel library concatenation:
Panel libraries are specified in ISPF settings or via LMINIT/LMOPEN services. The Dialog Manager automatically searches these libraries when you invoke a panel.
Panels can be invoked through several mechanisms.
Direct invocation uses DISPLAY PANEL service:
123456789101112/*REXX*/ address ispexec 'DISPLAY PANEL(MYPANEL)' if rc = 0 then do /* User pressed Enter */ say 'User entered data' end else do /* User pressed PF3 or other exit */ say 'User cancelled' end exit 0
This example:
Panels can pass variables to and from your program:
1234567891011121314/*REXX*/ address ispexec /* Set input variables */ username = 'JOHN' 'VPUT (USERNAME) PROFILE' /* Display panel */ 'DISPLAY PANEL(USERINPUT)' if rc = 0 then do /* Get output variables */ 'VGET (USERNAME RESULT) PROFILE' say 'Username:' username say 'Result:' result end exit 0
This example:
You can conditionally invoke panels based on logic:
1234567891011121314/*REXX*/ parse arg action address ispexec select when action = 'ADD' then 'DISPLAY PANEL(ADDRECORD)' when action = 'EDIT' then 'DISPLAY PANEL(EDITRECORD)' when action = 'DELETE' then 'DISPLAY PANEL(DELRECORD)' otherwise 'DISPLAY PANEL(MAINMENU)' end exit 0
This example shows how to invoke different panels based on application logic, enabling dynamic panel navigation.
SELECT_PANEL selects or switches panel context without displaying.
SELECT_PANEL:
SELECT_PANEL usage:
12345678910/*REXX*/ address ispexec /* Select panel context */ 'SELECT PGM(ISR@PRIM)' if rc <> 0 then do say 'Error selecting panel' exit 8 end /* Panel context is now set */ exit 0
SELECT_PANEL is less commonly used than DISPLAY_PANEL, but is useful when you need to change panel context programmatically without immediate display.
Key differences:
Most applications use DISPLAY_PANEL for interactive panels, while SELECT_PANEL is used for special navigation scenarios.
DISPLAY_PANEL is the primary service for displaying panels programmatically.
DISPLAY_PANEL:
Basic usage:
12345678910111213/*REXX*/ address ispexec 'DISPLAY PANEL(MYINPUT)' if rc = 0 then do say 'User pressed Enter' end else if rc = 8 then do say 'User pressed PF3 (End)' end else do say 'User pressed other key, RC=' rc end exit 0
Return codes indicate how the user exited:
DISPLAY_PANEL supports various options:
123456789/*REXX*/ address ispexec /* Display with cursor positioning */ 'DISPLAY PANEL(MYINPUT) CURSOR(USERNAME)' /* Display with message */ 'DISPLAY PANEL(MYINPUT) MSG(ISRZ001)' /* Display with shared variables */ 'DISPLAY PANEL(MYINPUT) SHARED' exit 0
Options include:
DISPLAY_PANEL processes panel variables:
1234567891011121314151617181920/*REXX*/ address ispexec /* Set variables before display */ username = 'JOHN' password = '' 'VPUT (USERNAME PASSWORD) PROFILE' /* Display panel */ 'DISPLAY PANEL(LOGIN)' if rc = 0 then do /* Get variables after display */ 'VGET (USERNAME PASSWORD) PROFILE' /* Process login */ if password <> '' then do say 'Login successful for' username end else do say 'Password required' end end exit 0
Variables flow between your program and the panel, enabling data exchange.
Dialog Manager services enable sophisticated panel navigation.
You can chain panels sequentially:
123456789101112/*REXX*/ address ispexec /* Step 1: Get user information */ 'DISPLAY PANEL(STEP1)' if rc <> 0 then exit 8 'VGET (NAME EMAIL) PROFILE' /* Step 2: Confirm information */ 'DISPLAY PANEL(STEP2)' if rc <> 0 then exit 8 /* Step 3: Process */ 'DISPLAY PANEL(STEP3)' exit 0
This creates a multi-step wizard flow where each panel collects part of the information.
Navigation can be conditional based on user input:
123456789101112131415161718192021/*REXX*/ address ispexec /* Main menu */ 'DISPLAY PANEL(MAINMENU)' if rc <> 0 then exit 8 'VGET (OPTION) PROFILE' /* Navigate based on option */ select when option = '1' then do 'DISPLAY PANEL(OPTION1)' end when option = '2' then do 'DISPLAY PANEL(OPTION2)' end when option = '3' then do 'DISPLAY PANEL(OPTION3)' end otherwise say 'Invalid option' end exit 0
This enables menu-driven navigation where user choices determine which panel displays next.
You can implement retry logic for error handling:
1234567891011121314151617/*REXX*/ address ispexec retry = 'YES' do while retry = 'YES' 'DISPLAY PANEL(USERINPUT)' if rc <> 0 then exit 8 'VGET (INPUTDATA RETRY) PROFILE' /* Validate input */ if inputdata = '' then do 'SETMSG MSG(ISRZ002)' retry = 'YES' end else do retry = 'NO' end end exit 0
This allows panels to be redisplayed with error messages until valid input is provided.
Dialog Manager services enable building complete interactive applications.
A typical interactive application structure:
123456789101112131415161718192021222324252627282930/*REXX*/ address ispexec /* Initialize */ 'CONTROL ERRORS RETURN' /* Main loop */ do forever 'DISPLAY PANEL(MAINMENU)' if rc <> 0 then leave 'VGET (OPTION) PROFILE' /* Process option */ select when option = '1' then call process_option1 when option = '2' then call process_option2 when option = 'X' then leave otherwise 'SETMSG MSG(ISRZ001)' end end exit 0 process_option1: 'DISPLAY PANEL(OPT1PANEL)' return process_option2: 'DISPLAY PANEL(OPT2PANEL)' return
This structure provides a main menu loop with option processing and subroutines for different functions.
Validate user input before processing:
1234567891011121314151617181920212223/*REXX*/ address ispexec valid = 'NO' do while valid = 'NO' 'DISPLAY PANEL(DATAENTRY)' if rc <> 0 then exit 8 'VGET (USERDATA) PROFILE' /* Validate */ if userdata = '' then do 'SETMSG MSG(ISRZ002)' valid = 'NO' end else if length(userdata) < 5 then do 'SETMSG MSG(ISRZ003)' valid = 'NO' end else do valid = 'YES' end end /* Process valid data */ say 'Processing:' userdata exit 0
This ensures data quality before processing, improving application reliability.
Display appropriate error messages:
1234567891011121314/*REXX*/ address ispexec 'DISPLAY PANEL(MYINPUT)' if rc = 0 then do 'VGET (INPUTDATA) PROFILE' /* Validate and set messages */ if inputdata = '' then 'SETMSG MSG(ISRZ002)' /* Required field */ else if verify(inputdata, '0123456789') > 0 then 'SETMSG MSG(ISRZ004)' /* Numeric only */ else say 'Valid input:' inputdata end exit 0
Error messages guide users to correct input, improving user experience.
Dialog Manager locates panels through panel library management.
Panel libraries are searched in concatenation order:
You can specify panel libraries programmatically:
12345678910111213141516/*REXX*/ address ispexec /* Initialize library access */ 'LMINIT DATASETID(id) DATASET(MY.PANEL.LIB)' if rc <> 0 then do say 'Error initializing library' exit 8 end /* Open library */ 'LMOPEN DATASETID(id) OPTION(INPUT)' /* Display panel from library */ 'DISPLAY PANEL(MYPANEL)' /* Cleanup */ 'LMCLOSE DATASETID(id)' 'LMFREE DATASETID(id)' exit 0
This allows your application to use custom panel libraries.
Understanding return codes is essential for proper error handling.
Common DISPLAY_PANEL return codes:
Standard error handling pattern:
1234567891011121314151617181920212223242526272829303132/*REXX*/ address ispexec 'CONTROL ERRORS RETURN' 'DISPLAY PANEL(MYPANEL)' select when rc = 0 then do /* Normal completion */ 'VGET (USERDATA) PROFILE' /* Process data */ end when rc = 8 then do /* User cancelled */ say 'Operation cancelled' exit 0 end when rc = 12 then do /* User cancelled with PF12 */ say 'Operation cancelled' exit 0 end when rc = 16 then do /* Panel not found */ say 'Panel MYPANEL not found' exit 8 end otherwise do /* Other error */ say 'Error displaying panel, RC=' rc exit 8 end end exit 0
This pattern handles all common scenarios appropriately.
Advanced Dialog Manager techniques for sophisticated applications.
Select panels dynamically based on runtime conditions:
123456789101112131415/*REXX*/ address ispexec parse arg panelname /* Validate panel name */ if panelname = '' then do say 'Panel name required' exit 8 end /* Display panel dynamically */ 'DISPLAY PANEL('panelname')' if rc <> 0 then do say 'Error displaying panel' panelname exit 8 end exit 0
This enables flexible panel invocation based on runtime parameters.
Maintain state across multiple panels:
12345678910111213/*REXX*/ address ispexec /* Initialize state */ step = 1 total_steps = 3 'VPUT (STEP TOTAL_STEPS) PROFILE' /* Chain panels */ do step = 1 to total_steps 'VPUT (STEP) PROFILE' 'DISPLAY PANEL(STEP'step')' if rc <> 0 then leave end exit 0
This maintains application state across a series of panels.
Invoke panels from within panel processing:
12345678910111213141516/*REXX*/ address ispexec /* Main panel */ 'DISPLAY PANEL(MAIN)' if rc = 0 then do 'VGET (ACTION) PROFILE' if action = 'HELP' then do /* Nested panel for help */ 'DISPLAY PANEL(HELP)' end else if action = 'OPTIONS' then do /* Nested panel for options */ 'DISPLAY PANEL(OPTIONS)' end end exit 0
This enables hierarchical panel structures with nested dialogs.
Imagine ISPF Dialog Manager services like a restaurant ordering system:
When you call DISPLAY_PANEL, it's like asking the waiter (Dialog Manager) to bring you a menu (panel). You look at the menu, make choices, and give it back. The waiter takes your order (variables) to the kitchen (your program), which processes it. The Dialog Manager makes sure you get the right menu from the menu library and handles the whole ordering process!
Follow these best practices when using Dialog Manager services:
Avoid these common mistakes:
Practice using Dialog Manager services:
1. What is the primary service for displaying panels programmatically?
2. What address is used for Dialog Manager services?
3. What does SELECT_PANEL do?
4. How does Dialog Manager locate panels?
5. What return code indicates user pressed Enter?