06
Sun, Oct
2 New Articles

Creating Program-style Menus

CL
Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

Don't settle for wimpy 1-2-3 menus only because SDA makes them easy.

Brief: Creating your own program-style menus doesn't have to be difficult! Our sample program paves the way, so all that's left is a little customization on your part. Before you know it you'll be exploiting the expanded power and versatility of the program menu.

If there's anything at all you can do to improve the AS/400 user interface, it's creating menus for your end users. Menus are easy to use because the user sees all the options available and can select one by keying in an option number and pressing Enter.

The AS/400 offers two types of menus: display file menus and program menus. Chances are that you've been designing display file menus because SDA makes it easy and convenient. SDA creates display file menus in a snap. In contrast, program menus require more work-but they give you complete control over what the menu looks like and what you can do with it, including making it multi- page.

This article gets you started in the design of program menus. After reading it, you'll see that program menus deliver more power and flexibility to your applications.

Definition of Menu

A menu can be defined in many ways depending on whom you're speaking with. For our purposes, a menu is a panel that shows a list of available options, sometimes identified with a code (usually a number). The user selects an option by keying in the option code and pressing the Enter key, or by highlighting it and signaling to the computer that the selection has been made. Notice that this definition covers both the AS/400 menus and microcomputer-style pull-down menus.

On the AS/400, in particular, menus must also satisfy the following conditions:

The user must be able to access the menu by running the GO command.

The security administrator must be able to give the menu to a user, so that the user sees it when signing on, by using the Initial Menu (INLMNU) parameter in either the Create User Profile (CRTUSRPRF) or Change User Profile (CHGUSRPRF) command.

Pseudo-menus

Many programmers, especially those with a System/38 background, create menus by designing a display file that lists the options and provides an input field for the user to type the option number, and a CL program that runs behind the scenes. The user then CALLs this CL program in order to display the menu.

This is not a true menu. The user cannot access it with the GO command, and the security administrator would have to change the user profile's initial program (INLPGM) parameter-not INLMNU.

Display File Menus

As I mentioned earlier, the first true menu type is the display file menu. This is the easiest type of menu you can create. All you need to do is use SDA's support to create menus, and SDA will take you by the hand. When you're done, SDA will have created a display file menu.

This simplicity has a trade-off: you lose a considerable amount of flexibility. Display file menus must follow a particular format from which you cannot deviate. You cannot define your own function keys-these are defined for you and there's nothing you can do about them.

Furthermore, display file menus can have only one page. There is no way to provide for the Roll keys if you have more options than would fit on a single screen. And finally, all option codes are numeric. You cannot have a menu option like A or B.

When SDA creates the display file menu, you'll have three objects on your system: a display file (*FILE), a message file (*MSGF) and a menu (*MENU). It's the *MENU object you access when you run the GO command.

You can obtain additional information about display file menus in the SDA manual. In this article, we'll concentrate on expanded control with program menus.

Program Menus

Program menus are created differently. You need to create two objects yourself: a display file (*FILE) and a program (*PGM). When you're done, you run the Create Menu (CRTMNU) command to create the *MENU object that ties the display file and the program together.

The biggest advantage of program menus is that you have complete control over them. You can design the display file any way you see fit and you can make your program do anything you want. The option descriptions can be printed "Chinese-style" (top to bottom) if you want and if your users can read it. Also, options can be identified by letters if you'd rather do it that way. Furthermore, the menu can have more than one page!

Figures 1a and 1b show the pages of a sample program menu that we'll use throughout the rest of the article. The user would press the Roll Up key to go from the first to the second page, or Roll Down to go back.

For starters, notice that I have included the system date and time in the top- left corner. I have also included the system name, user profile name (MALERN is my own) and display station name in the top-right corner.

My display file doesn't provide F16 to display the main help menu, F13 for user support, or F24 for more keys-I don't want the user to do any of those. Now notice that the first page shows the ubiquitous "More..." (hey, there's another page following this one), while the second page shows "Bottom" (no more pages, buddy).

Finally, the bottom-right corner has two input fields that I have thrown in just to give you an idea of what you could do. If the user changes the values in the input fields, the system runs the Change Job (CHGJOB) command to change the output queue used in the job. User friendly? You bet.

The Display File

2 shows the DDS for the display file. It uses the message subfile technique to communicate to the user all messages issued by the system as a result of taking menu options or pressing keys. See my article "Easy and Powerful Message Presentation" in the April 1992 issue, which explains the message subfile technique in great detail.

Figure 2 shows the DDS for the display file. It uses the message subfile technique to communicate to the user all messages issued by the system as a result of taking menu options or pressing keys. See my article "Easy and Powerful Message Presentation" in the April 1992 issue, which explains the message subfile technique in great detail.

You'll see that the figure has certain areas shaded in pink. You should remove the code contained in the shaded areas if you don't want your users to enjoy the benefits of a command line in the menu. The CL program listed in 3 also has shaded areas for the same reason. Yank them out if you don't want to support a command line.

You'll see that the figure has certain areas shaded in pink. You should remove the code contained in the shaded areas if you don't want your users to enjoy the benefits of a command line in the menu. The CL program listed in Figure 3 also has shaded areas for the same reason. Yank them out if you don't want to support a command line.

The display file is simple enough-it's a very commonplace display file, as it turns out. The "More..." and "Bottom" indicators are actually hard-coded text, since each page of the menu is a different record format. There's no hocus-pocus or surprises.

Field CMDLIN is the input-capable command line field. It's defined as input/output, since the command typed in it must be redisplayed if it is in error, in order to emulate the AS/400's behavior. It also has CHECK(LC) so that the user's input goes in lowercase. It doesn't have to be that way-I did it only because IBM menus do that too.

Before you get to the CL program listing, notice that the menu pages are two separate record formats, named PAGE_1 and PAGE_2 for simplicity. Now let's move on to the CL program.

The CL Program

The program you use in your menu (whether it's written in CL or in another language like RPG/400) must accept three parameters. These parameters let your program be used with the GO command. They are:

The name of the menu (10 characters).

The name of the library (10 characters).

A return code (two characters if you use CL, or a short binary number if you use another language).

The return code tells the system how the user exited the menu (did he press F3 or F12?). You must code your program so that the return code is set to -1 if the user presses F3. In CL, the return code must be set to x'FFFF'. If the user presses F12, the return code must have -2 (x'FFFE' in CL). A value of -4 (or x'FFFC') is supposed to mean that the user pressed the Home key, but since practically no one uses Home to exit menus, I haven't included it in the sample menu. Many users don't know there is a Home key at all.

Here's How It Works

First, the program needs to declare the display file and set the &PGMQ variable to the name of the CL program in order to activate the message subfile support. CL and RPG/400 are two different birds; in RPG/400 you can set the PGMQ variable to an asterisk (*) to activate the message subfile support. For some reason, that trick doesn't work in CL; CL insists on the actual name. Since my CL program example is named #EM001CL, that's the value I move into &PGMQ. You'll have to use different values when you create your own program menus.

For illustration purposes only, I have included several Override with Database File (OVRDBF) and Open Database File (OPNDBF) commands at the beginning of the program, as if the options in this menu required those files. Of course for the sample they don't, but your application probably will. Having files open with their open data paths shared will cut down the time it takes to launch an application program, although your application will have to make sure the right records are processed. The Reclaim Resources (RCLRSC) command is used later to close these files automatically.

The RTVJOBA command that follows the file commands retrieves the job's name (which is the display station name) and the names of the output queue and output queue library. These last two are placed in the display file's variables so that they show when the menu is presented to the user.

To present the menu, I write the message control record first, then the appropriate page of the menu. Since &PAGE has a value of 1 initially, it shows record PAGE_1. Later, when the user presses Roll Up, &PAGE will change to a value of 2, making the program present record PAGE_2.

When the user presses a key, the CL program removes all messages from the program message queue-which clears the message subfile presented in line 24. This way, new messages won't be mixed with other messages already seen by the user.

If the user presses either Roll key, variable &PAGE changes and the menu is presented again without performing any other task.

The program then checks to see if the user has pressed F3 or F12. If he has, it sets the return code to the correct value and ends the program. If the user presses F5, the menu is redisplayed without doing anything and, since F5 is coded in the display file with CA05, all input the user may have entered is ignored. If I had used CF05, the input-capable fields would have changed values. As you can see in 2, the only function key I have coded as a CFxx is F4=Prompt, because the program needs to know what command the user entered.

The program then checks to see if the user has pressed F3 or F12. If he has, it sets the return code to the correct value and ends the program. If the user presses F5, the menu is redisplayed without doing anything and, since F5 is coded in the display file with CA05, all input the user may have entered is ignored. If I had used CF05, the input-capable fields would have changed values. As you can see in Figure 2, the only function key I have coded as a CFxx is F4=Prompt, because the program needs to know what command the user entered.

Pressing F9 to Retrieve

I must confess that I took the easy way out with the F9 key. Supporting the F9 key requires creating a dynamic array of unlimited size, capable of holding an entire command string (perhaps as long as 3,000 characters) in each element of the array. Well, there was no way I was going to do that! So, instead, I redefined F9 so that it retrieves only the last command executed by the user.

But even this presents a problem of a different nature. When the user types a command on the command line and presses Enter, the command string is easy to identify: it's whatever the user typed. However, the user can also press F4 to prompt for the command. When he presses F4, the system builds the command string for you-and it can end up being a very long string indeed, one that would go beyond the 150 characters I allocated for it on the display file.

IBM must have come across the same problem. Their solution is elegant, so I adopt it. They keep the command string in an internal variable (one that's long enough), and write to the display file as much of it as it will fit, putting an ellipsis (...) at the end. It's a way of saying "this is not all- there's more to this command."

To support a last command retrieval function key, I store the last command (full length, 3,000 characters) in variable &LASTCMD. When the user presses F9 to retrieve it, I need to know if I have to put the ellipsis on the screen or not. So I check for characters beyond position 150. If I find anything, I move the first 147 characters to the display file command line, concatenated with an ellipsis. That completes the 150 characters. If there's nothing beyond position 150, it's a straightforward copy. Either way, the menu is redisplayed.

Changing the Output Queue

At this point, I check if the user has changed the output queue fields. Since the display file uses the CHANGE keyword to sense user input into these fields, all I do is check indicators 51 and 52. If either one is on, the user has made changes. The code that follows decides between two possible formats for the CHGJOB command.

To choose between the two CHGJOB formats, we need to determine if the user has entered a special value in &OUTQ (such as *DEV); in this case, the CHGJOB command cannot have a qualifying output queue library name or the CHGJOB command will fail. On the other hand, if the user entered an actual name, we want to make sure that the name is qualified or we may access the wrong output queue. If the user blanked out the &OUTQLIB field, the program assumes *LIBL.

Notice that after the CHGJOB command has been executed, the program does not redisplay the menu-it continues processing. This way, the user can type both a new output queue name and a command-and press either F4 or Enter-and the program will honor both requests.

Responding to F4 for Prompt

If the user presses the F4 key, the program should present the command prompter for whatever command is in the menu's command line. If the command line is empty, my program sends a diagnostic message and redisplays the menu. An OS/400 menu would have shown the MAJOR menu, but I didn't want mine to emulate IBM that far.

The "long command" and "visible command" duo haunts us here for the second time. I am going to use the &LONGCMD variable to invoke the command prompter, since the user could have pressed F4 immediately after F9-and F9 could have brought back a command so long that it ends in an ellipsis (...).

To invoke the command prompter, I put a question mark before the command string and call QCMDCHK. QCMDCHK may fail if the command on the command line doesn't exist or has an invalid syntax, or because the user pressed F3 or F12 from the prompter. All such occurrences are reported by monitoring for CPF0000 and redisplaying the menu. Since the menu has the message subfile, it doesn't have to do anything special to display the messages! If the command fails, only the command is returned to the command line-no entries made through the prompter are returned.

If everything went okay, I call QCMDEXC to execute the command. Again, monitoring for CPF0000 traps any errors that may occur during execution time (perhaps the user wants to delete a file, but the file doesn't exist); in this case, the menu is redisplayed.

If all goes well during execution, I save the command line in variable &LASTCMD for future use if the user presses F9. Then I erase the menu command line (&CMDLIN) and redisplay the menu.

Processing the Enter Key

Finally, we come to the section of the program that deals with the Enter key (it's about time). If the command line is not empty, it compares the first two characters against 1, 2, 3, 4, 11, 12, 13, or 90-the options listed on the menu-and executes the appropriate command in each case.

If none of the options listed has been selected, we assume the user has entered a command at the command line and pressed Enter. For the third time we need to deal with the long command and visible command duo in order to feed the correct one to QCMDEXC, which executes the command. Monitoring for CPF0000 traps any errors produced during execution of the command (including "command not found"); in this case, the menu is redisplayed and the error message appears on line 24.

Creating the Menu

To create the program menu, you need to enter the source listed in Figures 2 and 3, and compile them (in that order) as indicated at the bottom of each figure. Then run the following command:

 CRTMNU MENU(xxx/SAMPLE) + TYPE(*PGM) + DSPF(xxx/#EM001DF) + PGM(xxx/#EM001CL) 

You can then display the menu by executing GO SAMPLE (or GO xxx/SAMPLE if you have another menu called SAMPLE).

The Change Menu (CHGMNU) command lets you change certain attributes of the menu, and the Display Menu Attributes (DSP-MNUA) is pretty self-explanatory.

Menus have a neat feature. They can change your current library or your product library for as long as the menu is active (that is, until you exit it). For example you could change menu SAMPLE to CURLIB(QGPL). Whenever you display menu SAMPLE, your job's current library will change to QGPL. When you exit the menu (F3 or F12), your job's current library returns to its original value. How's that for convenience?

Create Your Own!

Is this too much work? Perhaps it is. Display file menus are so much simpler to create, but they don't provide as much functionality (and flexibility) as program menus. Besides, I have done most of the work for you! All you need to do is design your display file, copy my program and change the areas I have shaded in green, which are different for every menu. These green areas are:

The name of the display file in the DCLF statement.

The name of the program, in the very first CHGVAR statement.

The names of the record formats in the SNDRCVF statements.

The segments that process each menu option.

The OPNDBF and OVRDBF commands at the beginning of the program.

Program menus do give you flexibility. Perhaps you can use them in those applications that require the added flexibility, and use display file menus everywhere else. At least you have a choice! Either way, your users will love you for making their lives easier.


Creating Program-style Menus

Figure 1A Image of menu, page 1

 Figure 1a: Image of Menu, Page 1 6/03/92 14:16:11 Sample Menu MC_PGMR MALERN Select one of the following: EDTDSP05S1 1. Go to the Command Entry panel 2. Start PDM 3. Display QSYSOPR messages 4. Work with active jobs 90. Sign off More... Your option: ===> __________________________________________________________________________ ____________________________________________________________________________ F3=Exit F4=Prompt F5=Refresh F9=Last command F12=Cancel Output queue: MGTLIB____ / PGMROUTQ__ 
Creating Program-style Menus

Figure 1B Image of menu, page 2

 Figure 1b: Image of Menu, Page 2 6/03/92 14:16:24 Sample Menu MC_PGMR MALERN Select one of the following: EDTDSP05S1 11. End all subsystems 12. Send a break message 13. Power down the system 90. Sign off Bottom Your option: ===> __________________________________________________________________________ ____________________________________________________________________________ F3=Exit F4=Prompt F5=Refresh F9=Last command F12=Cancel Output queue: MGTLIB____ / PGMROUTQ__ 
Creating Program-style Menus

Figure 2 Display file #EM001DF

 A DSPSIZ(24 80 *DS3) A PRINT A CA03(03 'Exit') A CF04(04 'Prompt') A CA05(05 'Refresh') A CA09(09 'Last command') A CA12(12 'Cancel') * * The following two record formats define the message subfile. A R MSGRCD SFL A SFLMSGRCD(24) A MSGKEY SFLMSGKEY A PGMQ SFLPGMQ * A R MSGCTL SFLCTL(MSGRCD) A SFLDSP A SFLDSPCTL A SFLINZ A N81 SFLEND A SFLSIZ(0020) A SFLPAG(0001) A PGMQ SFLPGMQ * * This record format defines the first page of the menu. A R PAGE_1 A ROLLUP(31 'Display second page') A BLINK A OVERLAY A 1 2DATE A EDTCDE(Y) A 1 12TIME A 1 35'Sample Menu' A DSPATR(HI) A 1 71SYSNAME A 2 71USER A 3 2'Select one of the following:' A COLOR(BLU) A DSPNAM 10A O 3 71 A 5 8'1. Go to the Command Entry panel' A 6 8'2. Start PDM' A 7 8'3. Display QSYSOPR messages' A 8 8'4. Work with active jobs' A 10 7'90. Sign off' A 17 74'More...' A DSPATR(HI) A 18 2'Your option:' A 19 2'===>' A CMDLIN 150A B 19 7CHECK(LC) A 22 2'F3=Exit F4=Prompt F5=Refresh - A F9=Last command' A COLOR(BLU) A 23 2'F12=Cancel' A COLOR(BLU) A 23 43'Output queue:' A OUTQLIB 10A B 23 57CHANGE(51) A 23 68'/' A OUTQ 10A B 23 70CHANGE(52) * * This record format defines the second page of the menu. A R PAGE_2 A ROLLDOWN(32 'Display first page') A BLINK A OVERLAY A 1 2DATE A EDTCDE(Y) A 1 12TIME A 1 35'Sample Menu' A DSPATR(HI) A 1 71SYSNAME A 2 71USER A 3 2'Select one of the following:' A COLOR(BLU) A DSPNAM 10A O 3 71 A 5 7'11. End all subsystems' A 6 7'12. Send a break message' A 7 7'13. Power down the system' A 9 7'90. Sign off' A 17 74'Bottom' A DSPATR(HI) A 18 2'Your option:' A 19 2'===>' A CMDLIN 150A B 19 7CHECK(LC) A 22 2'F3=Exit F4=Prompt F5=Refresh - A F9=Last command' A COLOR(BLU) A 23 2'F12=Cancel' A COLOR(BLU) A 23 43'Output queue:' A OUTQLIB 10A B 23 57CHANGE(51) A 23 68'/' A OUTQ 10A B 23 70CHANGE(52) 
Creating Program-style Menus

Figure 3 CL program #EM001CL

 #EM001CL: + PGM PARM(&MNU &MNULIB &RTNCDE) DCL VAR(&DSPNAM) TYPE(*CHAR) LEN(10) DCL VAR(&LASTCMD) TYPE(*CHAR) LEN(3000) DCL VAR(&LONGCMD) TYPE(*CHAR) LEN(3000) DCL VAR(&MNU) TYPE(*CHAR) LEN(10) DCL VAR(&MNULIB) TYPE(*CHAR) LEN(10) DCL VAR(&PAGE) TYPE(*DEC) LEN(1 0) VALUE(1) DCL VAR(&RTNCDE) TYPE(*CHAR) LEN(2) VALUE(' ') DCLF FILE(#EM001DF) /* The following CHGVAR statements activates the message subfile */ CHGVAR VAR(&PGMQ) VALUE('#EM001CL') /* Obtain the display station name and the current output queue + setting */ RTVJOBA JOB(&DSPNAM) OUTQ(&OUTQ) OUTQLIB(&OUTQLIB) /* Show menu */ AGAIN: + SNDF RCDFMT(MSGCTL) IF COND(&PAGE *EQ 1) THEN(SNDRCVF RCDFMT(PAGE_1)) ELSE CMD(SNDRCVF RCDFMT(PAGE_2)) RMVMSG PGMQ(*SAME) CLEAR(*ALL) /* Change menu page as requested by Roll keys */ IF COND(&IN31 *OR &IN32) THEN(DO) IF COND(&IN31) THEN(CHGVAR VAR(&PAGE) VALUE(2)) IF COND(&IN32) THEN(CHGVAR VAR(&PAGE) VALUE(1)) CHGVAR VAR(&IN31) VALUE('0') CHGVAR VAR(&IN32) VALUE('0') GOTO CMDLBL(AGAIN) ENDDO /* If F3=Exit, set return code to x'FFFF' and exit program */ IF COND(&IN03) THEN(DO) CHGVAR VAR(&RTNCDE) VALUE(X'FFFF') RETURN ENDDO /* If F12=Cancel, set return code to x'FFFE' and exit program */ IF COND(&IN12) THEN(DO) CHGVAR VAR(&RTNCDE) VALUE(X'FFFE') RETURN ENDDO /* If F4=Prompt, prompt for command */ IF COND(&IN04) THEN(DO) /* Ignore request if no command has been entered */ IF COND(&CMDLIN *EQ ' ') THEN(DO) SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA('No command + entered; F4=Prompt ignored') TOPGMQ(*SAME) MSGTYPE(*DIAG) GOTO CMDLBL(AGAIN) ENDDO /* If the menu's command line doesn't end in '...', use the + menu's command line instead of the internal variable + &LONGCMD to build the command string */ IF COND(%SST(&CMDLIN 148 3) *NE '...') THEN(DO) CHGVAR VAR(&LONGCMD) VALUE(&CMDLIN) ENDDO /* Append the command string after a question mark and call + QCMDCHK to activate the command prompter */ CHGVAR VAR(&LONGCMD) VALUE('?' *CAT &LONGCMD) CALL PGM(QCMDCHK) PARM(&LONGCMD 3000) MONMSG MSGID(CPF0000) EXEC(GOTO CMDLBL(AGAIN)) /* If an error + occurs (even pressing F3/F12 from the prompter), redisplay + the menu */ /* Execute the command */ CALL PGM(QCMDEXC) PARM(&LONGCMD 3000) MONMSG MSGID(CPF0000) EXEC(GOTO CMDLBL(AGAIN)) /* If an error + occurs during execution, redisplay menu */ /* Save command string for F9=Retrieve use, and clear the + menu's command line */ CHGVAR VAR(&LASTCMD) VALUE(&LONGCMD) CHGVAR VAR(&CMDLIN) VALUE(' ') GOTO CMDLBL(AGAIN) ENDDO /* IF F5=Refresh, simply redisplay the PANEL record */ IF COND(&IN05) THEN(GOTO CMDLBL(AGAIN)) /* If F9=Retrieve, retrieve last command */ IF COND(&IN09) THEN(DO) /* If the command string is longer than 150 characters, show + the first 147 characters of &LASTCMD followed by '...' */ IF COND(%SST(&LASTCMD 151 2850) *NE ' ') THEN(DO) CHGVAR VAR(&CMDLIN) VALUE(%SST(&LASTCMD 1 147) *CAT '...') ENDDO /* Otherwise, simply retrieve the last command saved */ ELSE CMD(DO) CHGVAR VAR(&CMDLIN) VALUE(&LASTCMD) ENDDO GOTO CMDLBL(AGAIN) ENDDO /* Enter key: if user has entered a new output queue name, + change job accordingly */ IF COND(&IN51 *OR &IN52) THEN(DO) /* If &OUTQ has special value, don't qualify it in the CHGJOB + command to avoid syntax errors */ IF COND(&OUTQ *EQ '*SAME' *OR &OUTQ *EQ '*USRPRF' *OR &OUTQ + *EQ '*DEV' *OR &OUTQ *EQ '*WRKSTN') THEN(DO) CHGVAR VAR(&OUTQLIB) VALUE(' ') CHGJOB OUTQ(&OUTQ) MONMSG MSGID(CPF0000) EXEC(GOTO CMDLBL(AGAIN)) ENDDO /* If &OUTQ has specific name, qualify with &OUTQLIB */ ELSE CMD(DO) /* If &OUTQLIB not entered, assume *LIBL */ IF COND(&OUTQLIB *EQ ' ') THEN(CHGVAR VAR(&OUTQLIB) + VALUE(*LIBL)) CHGJOB OUTQ(&OUTQLIB/&OUTQ) MONMSG MSGID(CPF0000) EXEC(GOTO CMDLBL(AGAIN)) ENDDO ENDDO /* Enter key: if user has entered anything at the command line, + process it */ IF COND(&CMDLIN *NE ' ') THEN(DO) /* Option 1 selected */ IF COND(%SST(&CMDLIN 1 2) *EQ '1 ') THEN(DO) CALL PGM(QSYS/QCMD) CHGVAR VAR(&CMDLIN) VALUE(' ') GOTO CMDLBL(AGAIN) ENDDO /* Option 2 selected */ IF COND(%SST(&CMDLIN 1 2) *EQ '2 ') THEN(DO) ? WRKMBRPDM MONMSG MSGID(CPF0000) CHGVAR VAR(&CMDLIN) VALUE(' ') GOTO CMDLBL(AGAIN) ENDDO /* Option 3 selected */ IF COND(%SST(&CMDLIN 1 2) *EQ '3 ') THEN(DO) DSPMSG MSGQ(*SYSOPR) CHGVAR VAR(&CMDLIN) VALUE(' ') GOTO CMDLBL(AGAIN) ENDDO /* Option 4 selected */ IF COND(%SST(&CMDLIN 1 2) *EQ '4 ') THEN(DO) WRKACTJOB OUTPUT(*) SBS(*ALL) CHGVAR VAR(&CMDLIN) VALUE(' ') GOTO CMDLBL(AGAIN) ENDDO /* Option 11 selected */ IF COND(%SST(&CMDLIN 1 2) *EQ '11') THEN(DO) ? ENDSBS MONMSG MSGID(CPF0000) CHGVAR VAR(&CMDLIN) VALUE(' ') GOTO CMDLBL(AGAIN) ENDDO /* Option 12 selected */ IF COND(%SST(&CMDLIN 1 2) *EQ '12') THEN(DO) ? SNDBRKMSG MONMSG MSGID(CPF0000) CHGVAR VAR(&CMDLIN) VALUE(' ') GOTO CMDLBL(AGAIN) ENDDO /* Option 13 selected */ IF COND(%SST(&CMDLIN 1 2) *EQ '13') THEN(DO) ? PWRDWNSYS MONMSG MSGID(CPF0000) CHGVAR VAR(&CMDLIN) VALUE(' ') GOTO CMDLBL(AGAIN) ENDDO /* Option 90 selected */ IF COND(%SST(&CMDLIN 1 2) *EQ '90') THEN(DO) SIGNOFF ENDDO /* None of the numeric options selected. Assume the user has + entered a command string in the command line. If the last + 3 characters are not '...', the menu's command line + contains the complete command string to be executed. + Otherwise, use internal variable &LONGCMD */ IF COND(%SST(&CMDLIN 148 3) *NE '...') THEN(DO) CHGVAR VAR(&LONGCMD) VALUE(&CMDLIN) ENDDO /* Execute command */ CALL PGM(QCMDEXC) PARM(&CMDLIN 150) MONMSG MSGID(CPF0000) EXEC(GOTO CMDLBL(AGAIN)) /* Redisplay + the menu if any errors found at execution time */ /* Save command for F9=Retrieve use, blank out the menu's + command line, and redisplay menu */ CHGVAR VAR(&LASTCMD) VALUE(&CMDLIN) CHGVAR VAR(&CMDLIN) VALUE(' ') GOTO CMDLBL(AGAIN) ENDDO /* Redisplay menu in all other cases */ GOTO CMDLBL(AGAIN) ENDPGM 
BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$

Book Reviews

Resource Center

  • SB Profound WC 5536 Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application. You can find Part 1 here. In Part 2 of our free Node.js Webinar Series, Brian May teaches you the different tooling options available for writing code, debugging, and using Git for version control. Brian will briefly discuss the different tools available, and demonstrate his preferred setup for Node development on IBM i or any platform. Attend this webinar to learn:

  • SB Profound WP 5539More than ever, there is a demand for IT to deliver innovation. Your IBM i has been an essential part of your business operations for years. However, your organization may struggle to maintain the current system and implement new projects. The thousands of customers we've worked with and surveyed state that expectations regarding the digital footprint and vision of the company are not aligned with the current IT environment.

  • SB HelpSystems ROBOT Generic IBM announced the E1080 servers using the latest Power10 processor in September 2021. The most powerful processor from IBM to date, Power10 is designed to handle the demands of doing business in today’s high-tech atmosphere, including running cloud applications, supporting big data, and managing AI workloads. But what does Power10 mean for your data center? In this recorded webinar, IBMers Dan Sundt and Dylan Boday join IBM Power Champion Tom Huntington for a discussion on why Power10 technology is the right strategic investment if you run IBM i, AIX, or Linux. In this action-packed hour, Tom will share trends from the IBM i and AIX user communities while Dan and Dylan dive into the tech specs for key hardware, including:

  • Magic MarkTRY the one package that solves all your document design and printing challenges on all your platforms. Produce bar code labels, electronic forms, ad hoc reports, and RFID tags – without programming! MarkMagic is the only document design and print solution that combines report writing, WYSIWYG label and forms design, and conditional printing in one integrated product. Make sure your data survives when catastrophe hits. Request your trial now!  Request Now.

  • SB HelpSystems ROBOT GenericForms of ransomware has been around for over 30 years, and with more and more organizations suffering attacks each year, it continues to endure. What has made ransomware such a durable threat and what is the best way to combat it? In order to prevent ransomware, organizations must first understand how it works.

  • SB HelpSystems ROBOT GenericIT security is a top priority for businesses around the world, but most IBM i pros don’t know where to begin—and most cybersecurity experts don’t know IBM i. In this session, Robin Tatam explores the business impact of lax IBM i security, the top vulnerabilities putting IBM i at risk, and the steps you can take to protect your organization. If you’re looking to avoid unexpected downtime or corrupted data, you don’t want to miss this session.

  • SB HelpSystems ROBOT GenericCan you trust all of your users all of the time? A typical end user receives 16 malicious emails each month, but only 17 percent of these phishing campaigns are reported to IT. Once an attack is underway, most organizations won’t discover the breach until six months later. A staggering amount of damage can occur in that time. Despite these risks, 93 percent of organizations are leaving their IBM i systems vulnerable to cybercrime. In this on-demand webinar, IBM i security experts Robin Tatam and Sandi Moore will reveal:

  • FORTRA Disaster protection is vital to every business. Yet, it often consists of patched together procedures that are prone to error. From automatic backups to data encryption to media management, Robot automates the routine (yet often complex) tasks of iSeries backup and recovery, saving you time and money and making the process safer and more reliable. Automate your backups with the Robot Backup and Recovery Solution. Key features include:

  • FORTRAManaging messages on your IBM i can be more than a full-time job if you have to do it manually. Messages need a response and resources must be monitored—often over multiple systems and across platforms. How can you be sure you won’t miss important system events? Automate your message center with the Robot Message Management Solution. Key features include:

  • FORTRAThe thought of printing, distributing, and storing iSeries reports manually may reduce you to tears. Paper and labor costs associated with report generation can spiral out of control. Mountains of paper threaten to swamp your files. Robot automates report bursting, distribution, bundling, and archiving, and offers secure, selective online report viewing. Manage your reports with the Robot Report Management Solution. Key features include:

  • FORTRAFor over 30 years, Robot has been a leader in systems management for IBM i. With batch job creation and scheduling at its core, the Robot Job Scheduling Solution reduces the opportunity for human error and helps you maintain service levels, automating even the biggest, most complex runbooks. Manage your job schedule with the Robot Job Scheduling Solution. Key features include:

  • LANSA Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.

  • LANSAWhen it comes to creating your business applications, there are hundreds of coding platforms and programming languages to choose from. These options range from very complex traditional programming languages to Low-Code platforms where sometimes no traditional coding experience is needed. Download our whitepaper, The Power of Writing Code in a Low-Code Solution, and:

  • LANSASupply Chain is becoming increasingly complex and unpredictable. From raw materials for manufacturing to food supply chains, the journey from source to production to delivery to consumers is marred with inefficiencies, manual processes, shortages, recalls, counterfeits, and scandals. In this webinar, we discuss how:

  • The MC Resource Centers bring you the widest selection of white papers, trial software, and on-demand webcasts for you to choose from. >> Review the list of White Papers, Trial Software or On-Demand Webcast at the MC Press Resource Center. >> Add the items to yru Cart and complet he checkout process and submit

  • Profound Logic Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application.

  • SB Profound WC 5536Join us for this hour-long webcast that will explore:

  • Fortra IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn: