You are beginning to see how to create the different pieces of a
complete system. You have written queries that display and print data,
you know how to view printed data and you have written several small
programs that can change data.
After this topic, you will learn to write programs to display and change
data interactively - data maintenance, entry, update and display.
In this topic, you will use yet another three letter acronym, SDA, as a
tool. You will also make a couple of changes to your user profile. The
end result will be a user interface that you could use as an entry point
to an application system. The user would sign on to the AS/400 and
immediately see the user menu. The user would never see the AS/400
programmer and operator menus.
In summary, here is the task:
Hit ENTER again and you see the following template menu.
1) Create a menu named STARTMEN that will let the user: Run the display query that you wrote in Topic 6 Run query to print a report from Topic 6 Run the program to change the address line in the CUST file Display the CUST file using RUNQRY Display Print Spool files Sign Off 2) Change your user profile so that when you sign on, you see this new menu. 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. Start SDA with the command STRSDA. You will see that SDA has three functions: 1) Design Screens 2) Design Menus 3) Test Display FilesYou'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. Your screen should look like:
Design Menus Type choices, press Enter. Source file . . . . . . . . QDDSSRC Name, F4 for list Library . . . . . . . . . user999 Name, *LIBL, *CURLIB Menu . . . . . . . . . . . startmen Name, F4 for listOf course, replace USER999 with your user library name. When you hit ENTER you will see:
Specify Menu Functions File . . . . . . : QDDSSRC Menu . . . . . . . : STARTMEN Library . . . . : USER999 Type choices, press Enter. Work with menu image and commands . . . . . . Y Y=Yes, N=No Work with menu help . . . . . . . . . . . . . N Y=Yes, N=NoThe AS/400 even fills in the "Y" to indicate that you want to work with menu images and commands.
Hit ENTER again and you see the following template menu.
STARTMEN STARTMEN Menu Select one of the following: 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. Selection or commandSDA 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. Avoid keying in "insert" mode since that will shift all text on the screen. To remove text, just space over it. So, key on the screen so that it looks like:
STARTMEN STARTMEN Menu Select one of the following: 1. Run Customer Query 2. Print Customer Query 3. Change Addresses in Customer file 4. Show Customer file 5. Work with Print files 6. 7. 8. 9. 10. Sign OffWhen you hit enter, SDA uses your screen to build literals in a display file. F20 (Shift and F8) 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. After hitting F10, you should see:
Define Menu Commands Menu . . . . . . : STARTMEN Position to menu option . . Type commands, press Enter. Option Command 01 02 03 04 05 06 07Here, you enter the commands associated with each selection. So enter the commands like this:
Define Menu Commands Menu . . . . . . : STARTMEN Position to menu option . Type commands, press Enter. Option Command 01 runqry csq001 02 runqry csq002 03 call tutr005 04 RUNQRY QRYFILE(CUST) 05 wrksplf 06 07Then, hit page down so you can enter SIGNOFF as the command for selection 10. 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. Hit F3 a few times to exit. When you exit SDA, check the "object library" name. This is where your compiled menu objects will go. Your screen should look like:
Exit SDA Menus File . . . . . . : QDDSSRC DDS member . . . . . : STARTMEN Library . . . . : USER999 Commands member . . . : STARTMENQQ Type choices, press Enter. Save new or updated menu source . . . . Y Y=Yes, N=No For choice Y=Yes: Source file . . . . . . . . . . . . QDDSSRC Name, F4 for list Library . . . . . . . . . . . . . USER999 Name, *LIBL, *CURLI Text . . . . . . . . . . . . . . . . Replace menu members . . . . . . . . Y Y=Yes, N=No Create menu objects . . . . . . . . . . Y Y=Yes, N=No For choice Y=Yes: Prompt for parameters . . . . . . . N Y=Yes, N=No Object library . . . . . . . . . . . USER999 Name, *CURLIB Replace menu objects . . . . . . . . Y Y=Yes, N=NoWait! Let me say again - the value near the bottom of the screen - Object Library - must be your user library. Otherwise you will create your menu somewhere else. 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 command to change your profile,CHGPRF. From a command line key CHGPRF and hit F4. You should see a screen like:
Change Profile (CHGPRF) Type choices, press Enter. Assistance level . . . . . . . . *SYSVAL *SAME, *SYSVAL, *BASIC... Current library . . . . . . . . *crtdft Name, *SAME, *CRTDFT Initial program to call . . . . SOC000 Name, *SAME, *NONE Library . . . . . . . . . . . SOLIB Name, *LIBL, *CURLIB Initial menu . . . . . . . . . . MAIN Name, *SAME, *SIGNOFF Library . . . . . . . . . . . *LIBL Name, *LIBL, *CURLIB Text 'description' . . . . . . . 'your email address'When you sign on to the AS/400, these values tell the operator what your current library should be and what menu is your default menu. Presently, your current library is probably *CRTDFT which is a system value that means "NONE". Your initial menu is named MAIN. This is the menu you have gotten accustomed to seeing when you sign on. Change your current library from *CRTDFT to your user library. Also change your initial menu to STARTMEN. Make the LIBRARY value under your initial menu your user library. Your screen should look like:
Change Profile (CHGPRF) Type choices, press Enter. Assistance level . . . . . . . . *SYSVAL *SAME, *SYSVAL, *BASIC Current library . . . . . . . . USER999 Name, *SAME, *CRTDFT Initial program to call . . . . SOC000 Name, *SAME, *NONE Library . . . . . . . . . . . SOLIB Name, *LIBL, *CURLIB Initial menu . . . . . . . . . . STARTMEN Name, *SAME, *SIGNOFF Library . . . . . . . . . . . USER999 Name, *LIBL, *CURLIB Text 'description' . . . . . . . 'your email address'If you sign off and sign back on, you will see your new menu. By the way, if you set it up wrong, you may have to e-mail me to reset your profile. For example, if you changed your profile to run the menu ABCDEF as the initial menu, the AS/400 won't know what to do (since there is no ABCDEF menu). If you want to see the familiar sign on screen, key in the command GO MAIN. It's that easy to customize the screen selections for a user.
Tidak ada komentar:
Posting Komentar