Tip

Command special values: One set for the user, one set for the program

John Kohan, Search400 expert

John Kohan




Did you know you can have the user select one set of values on user-defined commands, yet have your program receive a totally different set of values? This is helpful when you need to interrupt what the user selected into "Program Logic". Below is an example that asks the user what type of report they want.

CMD        PROMPT('Activity Reports')

PARM   KWD(RTYPE) TYPE(*CHAR) LEN(1) RSTD(*YES) +  
             DFT(*ACTIVITY) VALUES(1 2 3) +  

             SPCVAL((*ACTIVITY 1) (*MOVEMENT 2) +        
             (*ADJUSTMENT 3)) 

             MIN(0) PROMPT('Type of  Report')                                

When the user enters *MOVEMENT, the called program will receive a "2". Now a simple select statement will produce the requested report. This is much easier for the user to understand which report they are selecting.

-----------------------------------------
About the author: John Kohan is a senior programmer analyst at CT Codeworks.

==================================
OTHER PROGRAMMER TIPS
==================================

  • Accessing any job's QTEMP
    Finally there is a way to run commands on any job, batch or online and without any cumbersome pre-requisites.
  • Editing a source member without SEU
    You can editing a source member without SEU if your iSeries 400 is on V4R4 or later by using the EDTF command. This command is typically used for editing files in the iSeries integrated file system, but you can also use it to edit a source member.
  • All 256 possible values of a character
    Here's an RPG program to list all 256 possible values of a character along with binary representation.


This was first published in April 2002

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.