Unconfigured Ad Widget

Collapse

Announcement

Collapse
No announcement yet.

What Is the Difference Between *OMIT and *NOPASS?

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

  • What Is the Difference Between *OMIT and *NOPASS?

    ** This thread discusses the article: What Is the Difference Between *OMIT and *NOPASS? **
    ** This thread discusses the Content article: What Is the Difference Between *OMIT and *NOPASS? **

    Hey, Tom. You could have provided a more comprehensive prototype for QCMDEXC:

    D* Prototype for QCMDEXC API
    D ExecuteCommand...
    D PR extPgm('QCMDEXC')
    D argInCommand 65535A const options(*varsize)
    D argInLength 15P 5 const
    D argInDBCS 3A Const Options(*NoPass)

    The optional third parameter provides a further example of the very subject covered in your handy article. By the way, many prefer to use QCAPCMD instead of QCMDEXC because the former provides other capabilities as well as executing a command.

    Brian.

  • #2
    ** This thread discusses the article: What Is the Difference Between *OMIT and *NOPASS? **
    Hi Brian,

    I'm kicking myself now. You're right, that would have been a PERFECT example

    Thanks for the suggestion. I'm used to using QCMDEXC, but I'll look into using QCAPCMD in future articles. Thanks a lot for your input! Great stuff.

    Enjoy your Holidays!
    Tom

    Comment


    • #3
      ** This thread discusses the article: What Is the Difference Between *OMIT and *NOPASS? **
      To make it even simpler...prototype the prototype. I apologize, I couldn't (for whatever reason) follow the "read more" link to actually read the article. Please take this as a shot from the hip. Determine the length of the command string in the procedure ExecuteCmd.

      In the "caller".

      ‚ /IF DEFINED($EXECUTECMD)
      *====================================
      * ExecuteCmd Prototyped API QCMDEXC. ¦
      *====================================
      D ExecuteCmd PR 1n
      D CmdString 2000a
      *
      ‚ /ENDIF

      The procedure code preferably in a procedure module. Something like this...

      *================================================= ====================
      * E X E C U T E C O M M A N D A P I
      *================================================= =====================
      * Procedure Name: ExecuteCmd ,
      *
      * ExecuteCmd- Runs the command string passed to it.
      *
      * This procedure returns an indicator variable *on = Error or
      * *off = Successful command execution.
      *
      *================================================= =====================
      P ExecuteCmd B Export
      *
      *
      D ExecuteCmd PI 1n
      D CmdString 2000a
      *
      *---------------------------------------------------------------------
      * Standalone definitions.
      *---------------------------------------------------------------------
      D CmdLength s 15p 5 Inz(0)
      D CmdError s 1n Inz(*off)
      *
      *
      *================================================= ===============
      * QCMDEXC - Prototype called RunCommand.
      *================================================= ===============
      * Prototype the external API QCMDEXC.
      *
      D RunCommand PR EXTPGM('QCMDEXC')
      *
      D CmdString2 Like(CmdString)
      D CmdLength2 Like(CmdLength)
      *
      *================================================= ===============
      * Call prototyped API with the Command string and Length.
      *
      C Eval CmdError = *off
      C Eval CmdLength = %Len(%Trim(CmdString))
      *
      C Callp(e) RunCommand(CmdString :
      C CmdLength)
      *
      * Set CmdError if an exception occurred while executing the
      * command string passed to this procedure.
      *
      C If %Error
      C Eval CmdError = *on
      C Else
      C Eval CmdError = *off
      C Endif
      *
      C Return CmdError
      C Eval *inlr = *on
      *
      P ExecuteCmd E
      *

      Comment

      Working...
      X