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

Different sets of values for user-defined commands and programs helps users select reports.


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

Dig deeper on iSeries CL programming

0 comments

Oldest 

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:

SearchEnterpriseLinux

SearchDataCenter

Close