ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Programming commands

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Programming commands

    I wasn't sure which forum this belongs on. This seems about as close as anything to fitting the description.

    I have created a DUPSPLF command that we need on our system (yes, I know DUPSPLF is available in TAATOOLS but my employer doesn't want to purchase it) but I have a little dilemma. The first parameter of my DUPSPLF command is JOBNAME (qualified). I want to specify *CURRENT as the default. the 2nd parameter is spool file name (SPLF) which I want to be a required parameter. The problem is if I want SPLF to be a required parameter, I have to specify MIN(1) (or MIN > 0). Since I have specified a default for the 1st parameter, JOBNAME, it won't let me specify a value > 0 for MIN for JOBNAME and I get a warning saying that a required parameter (SPLF) is not allowed after an optional parameter (JOBNAME) and it makes SPLF an optional requirement instead of a required one, ignoring the MIN(1) option.

    So, how can I make SPLF (and also the 3rd parameter SPLNMBR) required and still specify a default value for the 1st parameter JOBNAME

  • #2
    Re: Programming commands

    Do what IBM does with their spool file commands (HLDSPLF, RLSSPLF, etc.) and make spool file name the first parameter. If you need spool file number to also be required, make it the second parameter (although you could specify a default value of *ONLY similar to the IBM commands).

    Just as a suggestion, you could make the keywords to your command the same as the IBM commands: FILE for spool file, JOB for qualified job name, and SPLNBR for spool file number. That way if one of the IBM commands is in a program and you want to copy that line of source and change the command to your command, the keywords don't also have to be changed.

    Comment


    • #3
      Re: Programming commands

      Originally posted by gregwga50
      So, how can I make SPLF (and also the 3rd parameter SPLNMBR) required and still specify a default value for the 1st parameter JOBNAME
      I put the required parameters first, followed by the optional parameters, since that's required. Then I use the 2nd value of the PROMPT parameter in the PARM commands to order them the way I want to see them.

      Code:
      PARM  KWD(FILE) . . .  PROMPT('Spooled file' 1)
      The command-processing program needs to list the parameters in the order they're defined in the source code, not according to the 2nd values of PROMPT.

      Comment


      • #4
        Re: Programming commands

        Originally posted by gregwga50
        I wasn't sure which forum this belongs on.
        The problem you're having is covered, so this is just a minor side comment.

        Since "commands" are the biggest part of "CLP/CLLE", then that would be the forum that fits.
        Tom

        There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors.

        Why is it that all of the instruments seeking intelligent life in the universe are pointed away from Earth?

        Comment

        Working...
        X