Debra,
Each of your *CHAR parameters need to be enclosed in single apostrophes.
CALL LEXMAILC PARM('-a' +
'user@xxxxxxxx<mailto:user@xxxxxxxx>' +
'-r' +
'user@xxxxxxxx<mailto:user@xxxxxxxx>' +
'-s'
'TEST' +
'-m' +
'This is a test')
Gary Monnier
-----Original Message-----
From: java400-l-bounces@xxxxxxxxxxxx [mailto:java400-l-bounces@xxxxxxxxxxxx] On Behalf Of Debra Petta
Sent: Monday, February 13, 2012 9:17 AM
To: 'JAVA400-L@xxxxxxxxxxxx'
Subject: Passing parameters to a CL program
I have been trying to pass a list of parameters to a CL program which Will eventually run a Java class and pass these parameters to it.
I thought I was following the documentation for doing this correctly but I still cannot get it to work.
Here's my declaration:
LEXMAILC: PGM PARM(&P1 &P2 &P3 &P4 &P5 &P6 &P7 &P8)
Variables:
DCL &P1 *CHAR 2 /* LexMailc parameter #1 */
DCL &P2 *CHAR 20 /* LexMailc parameter #2 */
DCL &P3 *CHAR 2 /* LexMailc parameter #3 */
DCL &P4 *CHAR 20 /* LexMailc parameter #4 */
DCL &P5 *CHAR 2 /* LexMailc parameter #5 */
DCL &P6 *CHAR 20 /* LexMailc parameter #6 */
DCL &P7 *CHAR 2 /* LexMailc parameter #7 */
DCL &P8 *CHAR 20 /* LexMailc parameter #8 */
I am invoking this program from the command line as follows:
CALL LEXMAILC PARM('-a' user@xxxxxxxx<mailto:user@xxxxxxxx> '-r' user@xxxxxxxx<mailto:user@xxxxxxxx> '-s' TEST '-m' 'This is a test')
however it fails with this message in the job log and it's not clear what I am doing wrong:
Message . . . . : -CALL PGM(LEXMAILC)
CPD0172 Diagnostic 30 02/13/12 11:10:04.309861 QCACALL QSYS 0342 QCMD QSYS 01C8
Message . . . . : Parameters passed on CALL do not match those required.
Cause . . . . . : The parameters passed on the CALL command do not match the
parameters required by program LEXMAILC in library *LIBL. Correct program
not found or correct parameters not passed. The number of parameters or the
type of parameters passed on the CALL command must match those expected by
the program called. Recovery . . . : If correct program not found, change
or specify the library name on the command or in a library list. Change the
CALL command and then try the command again.
Note that the correct program is being invoked because it works when I run it without parameters (and hard code those parameters in the Java class)
--
This is the Java Programming on and around the IBM i (JAVA400-L) mailing list To post a message email: JAVA400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/java400-l
or email: JAVA400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at
http://archive.midrange.com/java400-l.
As an Amazon Associate we earn from qualifying purchases.