Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How to pass more than one parameters from JCL to program?
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
dejunzhu

Active User


Joined: 08 May 2008
Posts: 390
Location: China

PostPosted: Fri Jul 05, 2013 11:32 am    Post subject: How to pass more than one parameters from JCL to program?
Reply with quote

I' trying to pass two parameters from JCL to program using below step:
Code:
//CMBPSYSB EXEC PGM=TEST,PARM=(&PARM,9),COND=(4,LT)
//SYSPRINT DD   SYSOUT=*                                   
//SYSOUT   DD   SYSOUT=*                                   


In the linkage section of program TEST,
Code:
*****************************************************************
*               LINKAGE          SECTION                        *
*****************************************************************
 LINKAGE                         SECTION.                         
*                                                                 
* 批量控制参数 PARM 结构                                         
 COPY     CKCPARM.                                               
*                                                                 
 01  LK-INPUT-PARM.                                               
     05  LK-INPUT-LEN            PIC   S9(4) COMP.               
     05  LK-INPUT-CHKPT-CNT      PIC   X(1) .                     
*                                                                 
******************************************************************
*               PROCEDURE        DIVISION                        *
******************************************************************
*                                                                 
 PROCEDURE                       DIVISION                         
                                 USING LK-PARM-REC           
                                       LK-INPUT-PARM.             
*                                                                 

when I display the two parameters, I can see the first parameters was successfully passed to LK-PARM-REC of program , but the second parameter was not received into LK-INPUT-PARM.

Can u please advise how to pass the second parameter?
THanks.
Back to top
View user's profile Send private message

Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 1715
Location: UK

PostPosted: Fri Jul 05, 2013 12:00 pm    Post subject:
Reply with quote

You pass everything as one parameter and store in a structure.
Back to top
View user's profile Send private message
dejunzhu

Active User


Joined: 08 May 2008
Posts: 390
Location: China

PostPosted: Fri Jul 05, 2013 12:47 pm    Post subject:
Reply with quote

Thanks for your reply.
Passing and receiving is good for only one parameter.
But I really need to pass 2 parameters...

How can I receive it from my program?
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Fri Jul 05, 2013 12:52 pm    Post subject:
Reply with quote

I think that Nic is intimating that you pass ONE string to the program, and within the program you delimit the different sections of the string passed to get the required parameters.
Back to top
View user's profile Send private message
Stefan

Active User


Joined: 12 Jan 2006
Posts: 110
Location: Germany

PostPosted: Fri Jul 05, 2013 12:59 pm    Post subject: Re: How to pass more than one parameters from JCL to program
Reply with quote

Quote:
The system is going to "call" your program, with one item of linkage, the contents of the PARM from the JCL with the first two bytes being a binary field containing the length of the PARM itself.


This is a quote by Bill Woodger from another thread in this forum.
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Fri Jul 05, 2013 2:00 pm    Post subject:
Reply with quote

Show yourself what you passed in Parm and also display yourself what you received in program when you have used Nic's advice
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 1715
Location: UK

PostPosted: Fri Jul 05, 2013 2:34 pm    Post subject:
Reply with quote

I can see why you are having this problem - I have just had a look through the index and contents of both the language reference and the programming guide and I can find no obvious reference to receiving a parameter from JCL. Passing parameters from module to module, yes; from JCL to program, no. Maybe someone else can post details of which section(s) of those two manuals to look at - or an alternative source (within the IBM manuals).
Back to top
View user's profile Send private message
dejunzhu

Active User


Joined: 08 May 2008
Posts: 390
Location: China

PostPosted: Fri Jul 05, 2013 2:41 pm    Post subject:
Reply with quote

Nic Clouston wrote:
Passing parameters from module to module, yes; from JCL to program, no.

If this is true, why passing more than one parameters is supported by JCL???
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 1715
Location: UK

PostPosted: Fri Jul 05, 2013 2:49 pm    Post subject:
Reply with quote

Because JCL is not COBOL - it is a different language and a different type of language too with its own rules jsust as COBOL has its own rules. And I think you have a typo - JCL passes ONE parameter, of up to 100 bytes.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7232

PostPosted: Fri Jul 05, 2013 3:30 pm    Post subject: Reply to: How to pass more than one parameters from JCL to p
Reply with quote

dejunzhu,

There is a, single, PARM value in the JCL.

Whether the content of that is understood as separate pieces of information in the program that is the target of the EXEC is entirely up to that program, the JCL processor does not care (beyond how it is specified to operate in the JCL) anything about it. To the JCL it is one, and only one parameter, where there are multiple commas, some equals signs, or the word Banana repeated several times, it is all the same to the JCL.

One PARM value from the JCL. You define one parameter in your COBOL program. Then, in the COBOL program, you take the content of that, and interpret it however you like.

If you have PARM='A,B' in the JCL, then you will get two-byte binary with a value of three, followed by A,B in your program. It is entirely up to your program to "realise" that this, to your program, is "two parameters".

Nic,

I've never seen any formal documentation of the process from IBM. I'd guess it must be in some Assembler manual. For COBOL, it is knowledge which just "exists" and gets passed on.... "Just copy program XYZ and make sure you know what it is doing..."

Having said that, mostly it is done badly, so perhaps someone should fill in a suggestion slip and send it to the COBOL people...

I think that the link Stefan provided already should be clear enough :-)
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1738
Location: Bloomington, IL

PostPosted: Fri Jul 05, 2013 3:55 pm    Post subject:
Reply with quote

dejunzhu wrote:
Nic Clouston wrote:
Passing parameters from module to module, yes; from JCL to program, no.

If this is true, why passing more than one parameters is supported by JCL???

What do you base that (completely false) statement on?
Back to top
View user's profile Send private message
prino

Active Member


Joined: 07 Feb 2009
Posts: 984
Location: Oostende, Belgium

PostPosted: Fri Jul 05, 2013 5:08 pm    Post subject:
Reply with quote

Akatsukami wrote:
dejunzhu wrote:
Nic Clouston wrote:
Passing parameters from module to module, yes; from JCL to program, no.

If this is true, why passing more than one parameters is supported by JCL???

What do you base that (completely false) statement on?

On the fact that his parameter contains a comma... icon_lol.gif
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Fri Jul 05, 2013 5:10 pm    Post subject:
Reply with quote

That's a comma type of error though

OK OK I'll get my coat icon_rolleyes.gif
Back to top
View user's profile Send private message
dejunzhu

Active User


Joined: 08 May 2008
Posts: 390
Location: China

PostPosted: Fri Jul 05, 2013 6:01 pm    Post subject:
Reply with quote

okay, I have got the desired solution.
No matter how many parameters delimited by comma, just coding one 01-level variable in LINKAGE SECTION as the receiving area of the program will do.
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Fri Jul 05, 2013 6:22 pm    Post subject:
Reply with quote

Hope you are aware of the limitations as well
Back to top
View user's profile Send private message
Garry Carroll

Active Member


Joined: 08 May 2006
Posts: 990
Location: Dublin, Ireland / Edinburgh, Scotland

PostPosted: Fri Jul 05, 2013 8:22 pm    Post subject:
Reply with quote

dejunzhu wrote:
okay, I have got the desired solution.
No matter how many parameters delimited by comma, just coding one 01-level variable in LINKAGE SECTION as the receiving area of the program will do.


...and if the parameter values are not all the fixed-length that your 01-level variable specifies....?

Garry.
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1738
Location: Bloomington, IL

PostPosted: Sat Jul 06, 2013 2:46 am    Post subject: Re: Reply to: How to pass more than one parameters from JCL
Reply with quote

Bill Woodger wrote:
I've never seen any formal documentation of the process from IBM. I'd guess it must be in some Assembler manual. For COBOL, it is knowledge which just "exists" and gets passed on.... "Just copy program XYZ and make sure you know what it is doing..."

Having said that, mostly it is done badly, so perhaps someone should fill in a suggestion slip and send it to the COBOL people...

It's alluded to, but not explained, in the USING phrase topic of the Enterprise COBOL Language Reference. In the Enterprise PL/I Language Reference, it's made explicit in Passing arguments to the MAIN procedure. Perhaps the folks working on one set of manuals need to bring in the folks working on the other set as consultants... icon_smile.gif
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7913
Location: Bellevue, IA

PostPosted: Sat Jul 06, 2013 6:04 am    Post subject:
Reply with quote

The Programming Guide adds
Quote:
When you run an Enterprise COBOL program under z/OS and pass the program a parameter string, for example, by using JCL or a TSO command, the parameter list consists of a character string that has a halfword prefix that contains the string length.

About this task
You can access the parameter string by using a LINKAGE SECTION and standard COBOL coding as shown in the example referenced below:

Example: accessing main program parameters under z/OS

Alternatively, you can obtain the parameter string by calling either of the following Language Environment callable services, which are described in the related references below:
•CEE3PRM (query parameter string): obtain the parameter string (if not longer than 80 characters)
•CEE3PR2 (query parameter string long): obtain the parameter string and its length
In either case, the parameter string might contain program arguments, runtime options, or both.
in Accessing main program parameters under z/OS
Back to top
View user's profile Send private message
dejunzhu

Active User


Joined: 08 May 2008
Posts: 390
Location: China

PostPosted: Sat Jul 06, 2013 8:47 am    Post subject:
Reply with quote

Another new problem occurred, if I pass parameters via below PARMS ,
Code:
//RUNPRG  EXEC PGM=IKJEFT01,DYNAMNBR=20
//SYSTSPRT DD SYSOUT=*                 
//SYSTSIN DD *                         
 DSN SYSTEM(DB11)                     
 RUN PROGRAM(TST00000) PLAN(TESTPLAN) -
 PARMS('&PAR,0004')               
//SYSPRINT DD SYSOUT=*                 

From the message printed by the program TST00000,
Code:
********************************* TOP OF DATA **
INPUT  PARM :   &PAR,0004           
 

we can see that PAR was not expanded...(I have used SET statement to set PAR to a string, and I'm expecting PAR to be expanded for the program)
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Sat Jul 06, 2013 12:38 pm    Post subject:
Reply with quote

Hi,

You cannot use symbolic parameters in instream data



Gerry
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts I can not compile my program PL1 V3.R... Miguel Fernandez PL/I & Assembler 13 Tue Dec 06, 2016 8:30 pm
No new posts IMS BMP program causes 878 system abend Artemk IMS DB/DC 7 Tue Nov 22, 2016 8:26 pm
No new posts CICS NEW SIT PARAMETERS CICS BEHAVIOR... Kyle Carroll CICS 0 Fri Nov 04, 2016 11:55 pm
This topic is locked: you cannot edit posts or make replies. How to pass the previous month date i... Suganya87 DFSORT/ICETOOL 5 Mon Oct 31, 2016 4:13 pm
No new posts A sample of exit program for exit XMN... lind sh CICS 2 Mon Oct 03, 2016 5:07 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us