QCMDEXC command in RPGLE

115 pts.
Tags:
AS/400
RPGLE
Hi, I'm trying to execute RTVSYSVAL via QCMDEXC in RPGLE but it showing some error message related to setting.
Command Desc:-

W1DTTM defined with length 20 char.

Eval      W1CMD =   'RTVSYSVAL  SYSVAL(QDATETIME) +
RTNVAR(&W1DTTM)'

Eval      W1LEN = 100
CALL      'QCMDEXC'     P1CMD                  83
When I checked in debug W1CMD value is -
RTVSYSVAL  SYSVAL(QDATETIME) RTNVAR(&W1DTTM)
After QCMDEXC statement it shows following error:
Command RTVSYSVAL not allowed in this setting.

Detail:-

Message ID . . . . . . :   CPD0031       Severity . . . . . . . :   30
Message type . . . . . :   Diagnostic
Date sent  . . . . . . :   14/05/30      Time sent  . . . . . . :   16:47:24

Message . . . . :   Command RTVSYSVAL not allowed in this setting.
Cause . . . . . :   The complete list of settings includes: batch,
interactive, batch control language (CL) program, interactive CL program,
batch REXX procedure, interactive REXX procedure, batch CL ILE program,
interactive CL ILE program, CALL to QCMDEXC, and various types of source
statements. The Display Command (DSPCMD) command can be used to determine
the setting in which the command is allowed.
Recovery  . . . :   Omit the command.

Answer Wiki

Thanks. We'll let you know when a new response is added.

IF you do DSPCMD RTVSYSVAL and put your cursor on “Where allowed to run” and do F1, you will find it is not allow to run in a batch job.
You create a CL program call that from within your RPG program to get the value OR you can change the command to include *EXEC as one of the parms for “Where allowed to run”
—————————————–

If you review the documentation for the RTVSYSVAL command you will find that it is only valid in CL programs or REXX procedures. There is no problem running the command in batch (which was suggested as being a problem in an earlier response). Your problem is that you’re trying to run the command out of a RPG program using QCMDEXC — which is not going to work. Among other things, there are no return variables supported when using QCMDEXC and you certainly need a return variable. As mentioned in another response, the RPG language provides more direct ways to access the system time.

Discuss This Question: 2  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • philpl1jb

    It looks like you're attemting to get system time and or date.

    There are more direct ways to do this in RPGLE.

    51,355 pointsBadges:
    report
  • venky9m
    If you wnat to retrive the system date better to use %date () or
      time you can use %time(), or
     timestamp you can use %timestamp()
    this is very easy to code the rpgle pgm without using QCMDEXC
    10 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following