25 pts.
 User defined command
Hi, I want to create a command such that the user only needs to specify (say) a data area name and the command should be automatically fired and perform DSPDTAARA on the parameter specified. I'm not sure how and where to start this because I don't want the syntax to be - mycmd (data area name). I want it to be only - (data area name) after which if the user presses enter, DSPDTAARA is performed. Is this possible?

Software/Hardware used:
iseries/AS400
ASKED: November 28, 2012  10:35 AM
UPDATED: November 28, 2012  12:57 PM

Answer Wiki:
Last Wiki Answer Submitted:  Be the first to answer this question.
All Answer Wiki Contributors:  Be the first to answer this question. Michael Tidmarsh   11,380 pts. , Cypherskull   25 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

Is this just for learning? Why create a new command when DSPDTAARA already does the same thing? See the Defining and documenting commands topic in the Information Center. — Tom

 107,735 pts.

 

BTW, if you only have one data area, you can create a command with the same name as the data area. If you ever need to display a second or third data area, you’ll need a different command for each one. — Tom

 107,735 pts.

 

The only way I can think of achieving a “simple to enter” utility for the user is to create a screen with an input field in which the dtaara name is entered and then the controlling pgm (RPGLE or CLLE etc) call the dspdtaara and outputs the resultant content to the screen.Otherwise ‘DSPDTAARA NAME’ is the only way to go.

 380 pts.

 

The only way I can think of achieving a “simple to enter” utility for the user…
 
The OP has a very specific format in mind. It can be done with just a CMD source statement plus two trivial PARM statements. It’s not even necessary to create a CPP. No separate display file either.
 
But command creation is a big topic. By knowing where the topic documentation is found and getting some background from it, the reason the simplest method works at all should become much clearer.
 
Tom

 107,735 pts.