13
Wed, Nov
5 New Articles

Selective Command Prompting

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

Brief: CL commands provide the basic interface to OS/400 functions. Unfortunately, commands sometimes force you to navigate through more parameters than are actually required. Learn how you can selectively control parameter prompting to make commands more efficient to use.

great feature of OS/400 CL commands is the command prompter. It's activated by keying the command name and pressing the F4 (Prompt) key or by placing a question mark (?) in front of the command name. (The latter method can also be used within a program.)

Rather than remember parameter keywords, values, and positions, a user can activate the prompter and obtain a customized data-entry panel. The panels typically contain parameter descriptions, entry fields, default values, and valid choice values. This type of prompting, referred to as command prompting, is performed at the command level.

Another (often overlooked) level of command prompting, known as selective prompting, allows you to selectively control which parameters are displayed and which ones can be modified. With selective prompting, you can control command parameter prompting to provide a more efficient and secure command interface for users.

You can use selective prompting to:

 o Select the parameters for which prompting is required. o Protect parameters. o Omit parameters. 

Why Use Selective Prompting?

Many commands prompt the user for more parameters than needed to perform a task. For example, let's say you frequently use the Create RPG Program (CRTRPGPGM) command. Besides the program name and source file parameters, you would like to be prompted for the ignore decimal data error (IGNDECERR) parameter. Unfortunately, each time you change IGNDECERR, you have to page through two screens of parameter prompts to get to it. Selective prompting can easily solve this problem by allowing you to present only the parameters required.

Another use of selective prompting is relevant if your operations staff does not have access to the system command line. In this case, you must provide menus, menu options, programs, and prompt screens for every task that operators need to perform.

If the user selects a menu option that activates the command prompter, selective prompting can contribute to a more secure environment.

Operators frequently perform the task of initializing tapes, using one of two common methods. With the first method, the operator keys in the Initialize Tape (INZTAP) command on a command line. He then presses F4 and fills in the necessary parameters. The disadvantage of this method is primarily a security issue. If the operator has a command line, what other commands can he enter? Which libraries and objects on the system are not adequately protected from operator error by object author-ity? In addition to the security issue, the operator may enter different parameter values or may be confused by seeing more parameters than necessary.

The second common method, often used to avoid the security issue, entails writing a program. You must create a prompt screen that displays only the information that the operator needs to see and allows only required entries to be made. The program is called from a menu option, thus eliminating the security concerns caused by allowing access to the command line. Validation performed by the program ensures that all tapes are initialized with the correct parameter values.

The disadvantage of this method is that you probably do not have time to write programs for every task performed by your operators. In this case, your operations environment will opt for the first method by default.

A Better Solution

Selective prompting of CL commands offers an alternative solution. For example, by using selective prompting for the INZTAP command, you can prompt the operator for only the parameters he needs, such as tape device (DEV) and volume identifier (VOL).

This control over parameter prompting simplifies the use of commands and requires very little programming effort. The operator can access the prompted command using a menu option. Selective prompting can be used during interactive prompting (e.g., with user-defined PDM options) or in source statements of interactive programs.

How It Works

Selective prompting requires that two special characters precede the keyword of each parameter you want to control. The first character-always a question mark (?)-simply indicates that you want to control this parameter. The second character specifies how you want the parameter controlled. It can be one of six different characters. For example, ?? before a parameter causes that parameter to be displayed and allows the operator to enter a value. The combination of ?* causes the parameter to be displayed but disables input from the operator. The ?- before the parameter prevents that parameter from being displayed; however, the value for that parameter is still passed to the command-processing program (CPP). The table in 1 briefly describes the selective prompting characters.

Selective prompting requires that two special characters precede the keyword of each parameter you want to control. The first character-always a question mark (?)-simply indicates that you want to control this parameter. The second character specifies how you want the parameter controlled. It can be one of six different characters. For example, ?? before a parameter causes that parameter to be displayed and allows the operator to enter a value. The combination of ?* causes the parameter to be displayed but disables input from the operator. The ?- before the parameter prevents that parameter from being displayed; however, the value for that parameter is still passed to the command-processing program (CPP). The table in Figure 1 briefly describes the selective prompting characters.

You can press F5 while using selective prompting to refresh the values initially shown on the display.

Some restrictions apply to selective prompting.

o No blanks should be entered between the selective prompt characters and the parameter keyword.

o Parameters must be in keyword format.

o Parameters can be specified by position only if they are not preceded by selective prompt characters.

o Selective prompting only applies at the parameter level. Now, let's look at several examples of how selective prompting can be implemented.

Example 1

Have you ever selected a menu option in error, only to find that it submitted a job immediately without any opportunity to exit or cancel without running the job?

It is a good idea to confirm all job submissions with a display that pops up before a job is submitted. The prompt screen could display a message that asks the operator, "Do you really want to do this?" But you could have a hundred jobs that require confirmation! You probably don't have time to correct them all. The following command shows how selective prompting gives the user an opportunity to cancel before submitting a job.

 SBMJOB ?*CMD(CALL PGM(PGMA)) + ?*JOB(JOBA) 

The two special characters (?*) preceding the CMD and JOB keywords cause the command (CALL PGM...) and the job name (JOBA) to be displayed, but prevent the user from entering a value into either of the parameters. The user can press F3 to cancel the Submit Job (SBMJOB) command. Optionally, you could allow certain parameters to be changed by the user. For example, placing ?? before the JOBQ parameter would allow the user to select the job queue each time the job was submitted.

Example 2

A second example further illustrates the usefulness of selective command prompting. If your workstation printers are powered off at IPL, the writers will not be started; or if someone shuts a printer off during the day, the writer will be canceled. Your operators, your help-desk staff, or even your programming staff may frequently receive requests from users to start writers.

The following command shows the use of selective prompting to allow any user to start a writer.

STRPRTWTR ??DEV(*N)

Two special characters (??) preceding the DEV keyword cause the device parameter to be displayed and allow the user to enter a value. No other parameters are shown. The user just needs to know the name of his printer.

Example 3

Now you'll see one more example of selective prompting. Every night, your operator uses the Save Library (SAVLIB) command to back up your system. You want to ensure that the same list of libraries is always backed up, so you do not want the operator to key in the command every night and possibly omit a critical library. But you have more than one tape drive and you want the operator to be able to select another tape drive when one is not available.

The following command shows the use of selective prompting on the SAVLIB command.

 SAVLIB ?*LIB(LIBA LIBB LIBC) + ??DEV(*N) 

The same set of libraries will always be saved; but if tape drive TAP01 is not available, the operator can key in the name of an-other tape drive.

Tighten and Improve Your Command Interface

The AS/400 command interface is very easy to use, mainly because the command prompter makes working with commands almost effortless. (Just think how much easier DOS would be if it had a command prompter like OS/400.)

The command prompter also facilitates management of system security. All users, including operators, can be restricted to tasks supplied as menu options. In some cases, you can avoid the overhead associated with the management of object authority. Just use a good menu-security system and restrict access to the command line by providing menu options that use selective prompting of CL commands.

Christopher Andrle is an AS/400 contract programmer with more than eight years' experience on the S/38 and AS/400.


Selective Command Prompting

Figure 1 Selective Prompting

 Character Description ?? Display the parameter and allow entries. ?* Display the parameter but do not allow entries. ?/ Display the parameter but do not allow entries. Use the default value. ?< Display the parameter and allow entries. Use the default value unless a value is entered. ?- Do not display this parameter. This parameter will not be shown when F9=All parameters is pressed. ?& Display the parameter only after F9 is pressed and allow entries. Use the default value unless a value is entered. ?% Display the parameter only after F9 is pressed but do not allow entries. Use the default value. 
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: