I want to change a dtaara on another server with RUNRMTCMD in a CL program. Is it possible to use variables in the RUNRMTCMD to do this? For instance: RUNRMTCMD CMD('CHGDTAARA DTAARA(LIB/DTAARA (10 14)) VALUE(&MONTH)') RMTLOCNAME('123.45.678.253' *IP)
Why don't you try doing just that? That's what I would do, to answer your question. Then you would know a lot more about the messages that could be obtained, and the sort of pitfalls there might be.
If it works (and I think that it will), then in production you should be aware that it might not work if a user is not authorized to the object involved, or the command. So if necessary you should create the CL program to adopt the owner's authority, and make sure the program's owner is authorized correctly.
If it does NOT work, then you can put the whole command into a variable, using CATs to include your parameter value, and then use QCMDEXC to execute the command. Or else, use the same approach from an RPG program. In either case, authority adoption may be required for normal users.
MORE INFORMATION ON THIS TOPIC
The Best Web Links: tips, tutorials and more.
Ask your programming questions--or help out your peers by answering them--in our live discussion forums.
Ask the Experts yourself: Our application development gurus are waiting to answer your programming questions.
Dig Deeper on RPG iSeries programming
Related Q&A from John Blenkinsop
When an error occurs on an IBM command, the diagnostic messages are sent first, then an escape message, which you can monitor. On AS/400 you see the ... Continue Reading
Learn how to 'append data to the file' with the FTP DIR command, and eliminate the hassle of having to end the FTP session and restart to view ... Continue Reading
RPGIV will 'think of' incoming integer fields as binary, and then will redefine them in the program structures as PACKED. So, when you chain a record... Continue Reading
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.