Showcase Article - Creating Menu's using SDA

The AS/400 has so many capabilities and options that it is easy to get overwhelmed with choices. Learning the basic skills will help you apply your experience by using the built in features of the AS/400. Each month, we will introduce you to essential AS/400 skills that are powerful and easy to learn. Here we will look at the user friendly Screen Design Aid, SDA.

One of the most intuitive development tools on the AS/400 is SDA, Screen Design Aid. With it, you build display screens and menus in a WYSIWYG (what you see is what you get) mode. We're going to look at how easy it is to create a user menu.

Suppose a user says, "My department does only a few things on the AS/400 but the canned software package that we have makes me navigate through too many screens. I'm training a new hire and I wish you could make a special menu with only 6 selections:
1) Run the on-line Customer Maintenance program that is in our canned application
2) Submit the job to print all new orders
3) Run the query you wrote last week to display all back ordered parts
4) Run the query to print the customer service summary
5) Work with spool files to see if our reports are printing
6) Go to the Main "Customer Service Menu"

In only a few minutes, you can build a custom menu for your user. Start SDA with the command STRSDA. You will see that SDA has three functions:
1) Design Screens
2) Design Menus
3) Test Display Files

You'll want to experiment with each of these later. For now, use selection 2 to design a menu. Enter the name of your new menu, where you want to store the source (usually QDDSSRC) and the library that it will be in. SDA will look for that menu and since it can't find it, it will create it.

SDA creates a template for you that has the menu name and a list of ten selections. On this screen, you list the selections for the user. On a separate screen, you list the commands associated with each selection. Enter the prompts for your user, see Figure 1. Also, add a selection 99 to signoff. Avoid keying in "insert" mode since that will shift all text on the screen. To remove text, just space over it.

When you hit enter, SDA uses your screen to build literals in a display file. F20 provides a way to display the text blocks that SDA will use. Each text block is preceded by a hidden character that contains the display attribute for that string of text. If you key an "H" right in front of a block of text, SDA will display that text in high intensity or white characters. An "R" will display the text in reverse image. "D" will delete the text.

Next, define the commands for each selection. Hit F10 to enter the commands. You now can key in the commands for selections 1 through 99.

Suppose your on-line Customer Maintenance program is run by calling the program, "CUSR000". Tell SDA that you want selection 1 to "CALL CUSR000", see Figure 2. Suppose the job to print all new orders is "ORDC110". You enter the command, "SBMJOB CMD(CALL ORDC110)" on line 2. Now, when the user selects 2, the job "ORDC110" will be submitted to run as a batch job.

You can enter any command that you want the user to run. You can run queries, submit print queries to run in batch and use standard utility commands such as "Work with Spool Files", WRKSPLF. Finally, you can help the user navigate to another menu with the "GO" command used for selection 6.

When you exit SDA, check the "object library" name. This is where your compiled menu objects will go. Hit enter and the AS/400 will compile your source code and your menu will be ready to run. SDA creates three objects, all with the same name: the commands, the display file and a message file for the menu.

If you want some added fun, go back to the menu source using SDA and this time make the selection to "work with menu help". Here you can define help screens that will display if your user enters the selection number and hits F1.

Now you can tie this menu to your new employee's user profile. Use the work with user profile command, WRKUSRPRF to change the new employee's profile. Put the new menu name in the field, "first menu" at the bottom of the screen. Now, the user will see the MRCM001 menu when he signs on the AS/400.

It's that easy to customize the screen selections for a user.

You can also use SDA to test and design display files. With the "Test Display Files" selection of SDA, you can see the fields and presentation of a display file. This works even if you don't have the source code.

The "Design Screens" selection of SDA is for building display files. You can reference the fields in database files, move text and fields around the screen and modify the display attributes. Knowing how to use SDA to design display files is an essential AS/400 skill but is beyond the scope of this article. See IBM's "Screen Design Aid, User's Guide and Reference" for complete coverage of SDA.

Figure 1 - Custom Menu Designed Using SDA

MRCM001                        Special Customer Service Menu                          
 Select one of the following:                                             
      1.  Online Customer Maintenance                                      
      2.  Print all orders                                                
      3.  Display backordered items                                        
      4.  Print customer service summary report                          
      5.  Work with reports                                                
      6.  Customer Service Menu                                            
     99. Sign Off                                                        
 Selection or command                                                      

Figure 2 - SDA Commands for Special Customer Service Menu

                               Define Menu Commands                               
 Menu . . . . . . :   MRCM001            Position to menu option . . . . .      
 Type commands, press Enter.                                                    
 Option   Command                                                               
   01     CALL CUSR000                                                          
   02     SBMJOB CMD(CALL PGM(ORDC110))                                         
   03     RUNQRY QRY(PARQ020)                                                   
   04     SBMJOB CMD(RUNQRY QRY(CSVQ100))                                       
   05     WRKSPLF                                                               
   06     GO CSVM000                                                            
   99     signoff                                                               
   F3=Exit        F11=Show all options         F12=Cancel         F24=More keys

Figure 3 - User Profile for New Employee

                                  Change User                             
 User  . . . . . . . . . :   JQSAMPLE                                     
 Type choices below, then press Enter.                                    
 User description  . . . .   New Customer Service Person                  
 Password  . . . . . . . .   *SAME            Characters                  
 Type of user  . . . . . .   *USER            Type, F4 for list           
 User group  . . . . . . .   *NONE            Name, F4 for list           
 Restrict command line use   N                Y=Yes, N=No                 
 Uses OfficeVision/400 . .   N                Y=Yes, N=No                 
 Default library . . . . .                    Name                        
 Default printer . . . . .                    Name, *WRKSTN, F4 for list  
 Sign on program . . . . .   *NONE            Name, *NONE                 
   Library . . . . . . . .                    Name                        
 First menu  . . . . . . .   MRCM001          Name                        
   Library . . . . . . . .     *LIBL          Name 

Back to Showcase Articles   |    Back to Main Page    |   Contact Info