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 multiple parameters through PARM

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
rohanthengal

Active User


Joined: 19 Mar 2009
Posts: 176
Location: Pune, Maharashtra, India

PostPosted: Thu Jun 09, 2011 12:27 pm    Post subject: how to pass multiple parameters through PARM
Reply with quote

i want to know about the way to pass multiple parameters through PARM in JCL.
One of the way which i found is PARM='TASK1,TASK2,TASK3'.
But it would be appreciable if anyone can help me to the way to receive these values in COBOL pgm.
like:
LINKAGE SECTION.
01 LS-VALUES.
05 LS-LENGTH PIC S9(4) COMP.
05 LS-DATA PIC X(20).
will LS-DATA hold the values that are sent by PARM ? OR Do i need to group them by comma separation ? like shown below:
LINKAGE SECTION.
01 LS-VALUES.
05 LS-LENGTH PIC S9(4) COMP.
05 LS-DATA.
10 LS-DATA1 PIC X(5).
10 LS-COMMA1 PIC X(1).
10 LS-DATA2 PIC X(5).
10 LS-COMMA2 PIC X(1).
10 LS-DATA3 PIC X(5).
10 LS-COMMA3 PIC X(1).

I want to know the same as i dont have an access to mainframes for some time. Thank you !
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: Thu Jun 09, 2011 12:30 pm    Post subject:
Reply with quote

Moved to COBOL forum as that appears to be where the real problem lies.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Thu Jun 09, 2011 12:52 pm    Post subject: Reply to: how to pass multiple parameters through PARM
Reply with quote

The PARM form the JCL will arive as a piece of storage up to 102 bytes in length. The first two bytes, a binary half-word, indicate the length of the data that follows (0-100).

In your example, you could define the up-to-100-bytes either way. The data still looks the same, ie 'TASK1,TASK2,TASK3'. The parm will arrive exactly "asis" from the JCL. Up to you to process it.

With your first definition, the last three bytes would contain undefined values.

With your second definition you limit yourself to parameters of the same length (and LS-COMMA-3, in your example, would contain an undefined value).

Code:

01 LS-DATA-FROM-JCL-PARM.
    05 LS-DFJP-LENGTH-OF-PARM PIC S9(4) COMP.
    05 LS-DFJP-PARM-DATA.
       10  FILLER
             OCCURS 0 TO 100 TIMES
               DEPENDING ON
                 LS-DFJP-LENGTH-OF-PARM.
           15  FILLER PIC X.


Defined this way, you will have LS-DFJP-PARM-DATA with no undefined values, being the exact length of the PARM specified in the JCL.

You can MOVE it or UNSTRING it or whatever. Would work with zero length, but better to handle that specifically as an if.

This way you can have "positional" parameters up to any number that you support and which fit in the maximum length of the PARM (100 characters), and the parameters do not need to be the same length (just UNSTRING 'em into appropriate receiving fields).
Back to top
View user's profile Send private message
nigelosberry

New User


Joined: 06 Jan 2009
Posts: 88
Location: Ggn, IN

PostPosted: Thu Jun 09, 2011 12:53 pm    Post subject: Re: how to pass multiple parameters through PARM
Reply with quote

rohanthengal wrote:
will LS-DATA hold the values that are sent by PARM ? OR Do i need to group them by comma separation ?


The whole PARM will arrive in your program as a single string of alphanumeric characters. The first 2 bytes(i.e. a halfword) in that string will be the length of the string.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Thu Jun 09, 2011 1:16 pm    Post subject: Re: how to pass multiple parameters through PARM
Reply with quote

nigelosberry wrote:

[...]
The whole PARM will arrive in your program as a single string of alphanumeric characters. The first 2 bytes(i.e. a halfword) in that string will be the length of the string.


I know what you mean, but, literally, since this is computers, how would that work? The first two bytes of an "alpahnumeric string", as a half-word binary, would be way-way-way over 100 - or way-way-way less, if you define it as signed.
Back to top
View user's profile Send private message
nigelosberry

New User


Joined: 06 Jan 2009
Posts: 88
Location: Ggn, IN

PostPosted: Thu Jun 09, 2011 1:22 pm    Post subject: Re: how to pass multiple parameters through PARM
Reply with quote

nigelosberry wrote:

[...]
The whole PARM will arrive in your program as a single string of alphanumeric characters. The first 2 bytes(i.e. a halfword) in that string will be the length of the string.



Oops!
Thanks Bill. Yes, my statement may be interpreted incorrectly.

Correction:
The whole PARM will arrive as a series of bytes where the first 2 bytes is the length of the PARM string one has supplied in the JCL. Of course there is a limit to the maximum length of a parm in a jcl.
Back to top
View user's profile Send private message
cvkumar59

New User


Joined: 25 Aug 2006
Posts: 18

PostPosted: Mon Oct 31, 2011 5:49 pm    Post subject: how to pass multiple parameters through PARM
Reply with quote

Could you please let me know how the data is passed through the PARM in jCl , anyway the declaration is provided above by Bill. Also could you please let us know the code in Procedure division .

Thanks,
Kumar
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Mon Oct 31, 2011 6:04 pm    Post subject: Reply to: how to pass multiple parameters through PARM
Reply with quote

I'm not sure I get your question.

On the EXEC PGM=, you have "PARM='and then some character string'" Check in the JCL manual on exact details, when you don't need quotes, maxium length, how to do continuation if needed, etc.

In the Cobol program, code something like the above (there are other possibilities, search the Cobol forum here).

In the procedure, with the above definition, just MOVE LS-DFJP-PARM-DATA to wherever you want it to be. Or, UNSTRING LS-DFJP-PARM-DATA if you have multiple parameter elements seperated by commas.

Unless you can be more specific, I don't know what else to type.
Back to top
View user's profile Send private message
don.leahy

Active Member


Joined: 06 Jul 2010
Posts: 642
Location: Whitby, ON, Canada

PostPosted: Mon Oct 31, 2011 6:35 pm    Post subject: Re: how to pass multiple parameters through PARM
Reply with quote

cvkumar59 wrote:
Could you please let me know how the data is passed through the PARM in jCl , anyway the declaration is provided above by Bill. Also could you please let us know the code in Procedure division .

Thanks,
Kumar
Code:
PROCEDURE DIVISION USING LS-VALUES.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Mon Oct 31, 2011 7:39 pm    Post subject: Reply to: how to pass multiple parameters through PARM
Reply with quote

Forgot to mention, if you have a new question, start a new topic please.

Yes, you'll need to mention your dataname on your Procedure Division header, as Don has pointed out, and the definition must be in the Linkage section. The operating 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.
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 -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
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 Using 'parm' to vary SORTOUT record v... Sysaron DFSORT/ICETOOL 13 Wed Sep 07, 2016 9:24 pm
No new posts Converting multiple VB files to FB fi... Viswanath Reddy JCL & VSAM 6 Mon Aug 08, 2016 11:49 pm
No new posts Execute multiple DB2 Load commands in... faizm DB2 4 Wed Aug 03, 2016 12:53 pm


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