Announcement

Collapse
No announcement yet.

Executing QCMDEXC within RPGLE

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

  • Executing QCMDEXC within RPGLE

    I'm trying to issue a command using QCMDEXC within an RPGLE program. The command will send an status email.
    CLUNODE = NODES

    The failed message is CPD0047 List or expression not valid for parameter SUBJECT. I am guessing it does not like the extra single quote in the Subject

    I have the code as follows:
    $Cmd = 'SNDSMTPEMM RCP((support@xxx.com)) +
    SUBJECT('+ $clunode + ''': Subsystems are shutdown'') +
    NOTE(''Subsystems are shutdown '')';


    When I run the command, I get the command string is populated, but the command SNDSMTPEMM command fails. $clunode is an 8 character variable. I also tried to add %trimr($clunode) and that statement errored also

    This is the populated string when running the program but the command fails.

    ....5...10...15...20...25...30...35...40...45...50 ...55...60
    1 'SNDSMTPEMM RCP((support@xxx.com)) SUBJECT(NODES ': Sub'
    61 'systems are shutdown') NOTE('Subsystems are shutdown ')'
    121 ' '
    181 ' '

    Any thoughts would be appreciated.

  • #2
    I'm not familiar with the SNDSMTPEMM command, but the quoting in the subject looks wrong:
    SUBJECT(NODES ': Subsystems are shutdown')
    I think that should be:
    Code:
    SUBJECT('NODES : Subsystems are shutdown')
    So, you should use:
    Code:
    $Cmd = 'SNDSMTPEMM RCP((support@xxx.com)) +
    SUBJECT('''+ $clunode + ': Subsystems are shutdown'') +
    NOTE(''Subsystems are shutdown '')';

    Comment


    • mgarczynski
      mgarczynski commented
      Editing a comment
      Thanks for the tip. Moving the ''' after the open paren at Subject resolved the issue. BTW, the SNDSMTPEMM allows sending of mail similar to SNDDST. We use it often to send alerts for critical jobs as we don't have an Operator

  • #3
    You are making you subject look like this:

    Code:
    SUBJECT(NODES ': Subsystems are shutdown')
    I think you probably meant to make it look like this?

    Code:
    SUBJECT('NODES: Subsystems are shutdown')

    Comment

    Working...
    X