Obtain MVS START parameters

General discussion on the JZOS batch launcher and toolkit
Post Reply
bilbozos
Posts: 18
Joined: Wed Jan 18, 2006 5:53 am

Obtain MVS START parameters

Post by bilbozos »

Hello all,

I've coded a Java program (to be used in a JZOS-based started task called DESDIFGE).

In the constructor I've written:

Code: Select all

ZUtil.setMvsCommandCallback(this);
Then I've implemented the handleStart method:

Code: Select all

public void handleStart(String startParameters) {
    System.out.println("startParams='"+startParameters+"'");
}
Forgive my ignorance, but when I start the started task and pass it parameters, the content of startParameters is always a zero-length string.

I wonder how parameters are passed to the JZOS-based started task so that my Java program receives them.

What I've tried is:

(1)

Code: Select all

START DESDIFGE,MYPARAM=/tmp/input.txt
(2)

Code: Select all

START DESDIFGE MYPARAM=/tmp/input.txt
Result:
(1) JCL error
(2) My Java class gets invoked, but receives nothing.

Am i doing anything wrong when invoking the started task? Surely! :( What am I missing? What is the START command syntax to specify parameters?
dovetail
Site Admin
Posts: 2022
Joined: Thu Jul 29, 2004 12:12 pm

Post by dovetail »

I believe that if you do this:

S procname,A=B

then it means that you want to substitute "B" for the value of keyword parameter "A" in the proc.

If you want to pass parameters, either leave out the "=" so that it is not confused to be a keyword paramter, or enclose in quotes:

S procname,AABB
S procname,'A=B'
bilbozos
Posts: 18
Joined: Wed Jan 18, 2006 5:53 am

Obtain MVS START parameters

Post by bilbozos »

I'm afraid that does not work.
Using:

S procname,AABB
S procname,'A=B'

in both cases I get "IEE307I START DELIMITER ERROR"
dovetail
Site Admin
Posts: 2022
Joined: Thu Jul 29, 2004 12:12 pm

Post by dovetail »

Perhaps your JCL is not correct?

For more information on the START command, see the manual: "MVS System Commands"
bilbozos
Posts: 18
Joined: Wed Jan 18, 2006 5:53 am

Obtain MVS START parameters from JZOS-based Java class

Post by bilbozos »

Well, in fact I just had a look in that manual. If I'm not wrong, this is the general syntax for the START command:

Code: Select all

S membername[.identifier][,devicetype|,[/]devnum][,volumeserial][,parameters][,JOBNAME=jobname][,JOBACCT=acct_info] [,SUB=subsystemname][,keyword=option[,keyword=option]...]
And this is what it says about the "parameters" : "Program parameters passed to the started program", an insufficient explanation for my ignorance.

This is the source code of my started task:

Code: Select all

//DESDIFGE PROC
//JAVA     EXEC PROC=EXJZOSVM,VERSION='14',
//  LOGLVL='+I',
//  JAVACLS='my.java.ClassName'
//MAINARGS DD DSN=WEBOS.DESA.SYSIN(DIFGMAIN),DISP=SHR
//MSGFILE  DD DSN=WEBDES.T.DESDIFGE.MQ.RECEP,DISP=(OLD,KEEP),
//            VOL=SER=WEBPRO,UNIT=SYSDA,
//            DCB=(LRECL=8644,BLKSIZE=25936,RECFM=VB),
//            SPACE=(CYL,(1,1),RLSE)
//STDENV   DD DSN=WEBOS.DESA.SYSIN(DIFGENVR),DISP=SHR
//OUTDSC   OUTPUT DEST=HOLD
//SYSPRINT DD SYSOUT=W,OUTPUT=(*.OUTDSC)
//SYSOUT   DD SYSOUT=W,OUTPUT=(*.OUTDSC)
//SYSERR   DD SYSOUT=W,OUTPUT=(*.OUTDSC)
//STDOUT   DD SYSOUT=W,OUTPUT=(*.OUTDSC)
//STDERR   DD SYSOUT=W,OUTPUT=(*.OUTDSC)
//CEEDUMP  DD SYSOUT=W,OUTPUT=(*.OUTDSC)
//*
The content of WEBOS.DESA.SYSIN(DIFGMAIN) is the following (just command-line args, parsed by the Java class):

Code: Select all

--mqm MQ_MANAGER_NAME
--queue MY.MQQUEUE.NAME
--qopenmode EXCLUSIVE
--log //DD:MSGFILE
And the content of WEBOS.DESA.SYSIN(DIFGENVR) is the usual content of the STDENV for the JZOS launcher.

The content of WEBOS.DESA.SYSIN(DIFGMAIN) is what the Java class will normally use (the default). But I'd like to use the MVS START command to pass it some other parameters that change the behaviour of my Java class and make it ignore the content of WEBOS.DESA.SYSIN(DIFGMAIN).

Now, I wonder where/how in my procedure I should specify that the Java class gets arguments from the MVS START command, or what am I missing/doing wrong?

Thanks for your support.
dovetail
Site Admin
Posts: 2022
Joined: Thu Jul 29, 2004 12:12 pm

Post by dovetail »

You have two options -

1) you can pass the "[,parameters]" part of the START command and read it with "handleStart()" callback. I'm not sure why this isn't working for you.

2) A much easier option might be to pass start parameters as arguments into your main method. To do this change the JCL to:

Code: Select all

//DESDIFGE PROC  ARGS=''
//JAVA     EXEC PROC=EXJZOSVM,VERSION='14',
//  LOGLVL='+I',
//  JAVACLS='my.java.ClassName &ARGS'
...
Then, you should be able to use:

S DESDIFGE,ARGS=WHATEVER

or

S DESDIFGE,ARGS='a b c d f'

and the arguments will be passed to your class main() method.
bilbozos
Posts: 18
Joined: Wed Jan 18, 2006 5:53 am

Obtain MVS START parameters from JZOS-based Java class

Post by bilbozos »

Thanks for your reply.

I've done something similar to what you mention in option no. 2, but I can't either understand why option no. 1 does not work. I'd like it to work, but believe me, it doesn't. The callback method "handleStart" gets invoked (my sample implementation just outputs the content of its argument with System.out.println), but the thing is that the content of the argument to that callback method is just an empty, non-null String.

That's the reason why I posted this topic.

Thanks anyway.
dovetail
Site Admin
Posts: 2022
Joined: Thu Jul 29, 2004 12:12 pm

Post by dovetail »

I tried it myself, and its a little tricky to use "[,parameters]" on the start command. The MVS Commands manual is not very clear IMO; you have to actually use three commas, like this:

S MYPROC,,,FOO

I modified the "MvsConsoleInteraction" sample shipped with JZOS to print out the console start parameters and it works as expected.

If you use the equals sign, then it assumed to be a keyword=value parameter, so the following will fail unless you have a keyword parameter named FOO defined in your proc:

S MYPROC,,,FOO=BAR

Even if you quote the parameters, you apparently cannot use certain characters in the parameters, like "=" and ",", so that the following two are not valid:

S MYPROC,,,'FOO=BAR'
S MYPROC,,,'FOO,BAR'

But these are OK:

S MYPROC,,,FOO(BAR)
S MYPROC,,,FOO:BAR
S MYPROC,,,'FOO:BAR'

(IMO the MVS START command is pretty lousy in this aspect; it was probably written by the same programmer who locked down JCL PARM= to be 100 characters :-)
bilbozos
Posts: 18
Joined: Wed Jan 18, 2006 5:53 am

Obtain MVS START parameters from JZOS-based Java class

Post by bilbozos »

Yes, the syntax explained in the manual is not very accurate.

Thanks so much for your support.
Post Reply