View previous topic :: View next topic
|
Author |
Message |
Amb
New User
Joined: 12 Mar 2010 Posts: 64 Location: India
|
|
|
|
Hi,
100 characters is the maximum limit that we can pass using PARM to a COBOL program.I am passing 100 characters using PARM from JCL to COBOL program.
In COBOL program I collect it as follows
01 Parm-parameter.
05 Length-of-parm s9(4) Comp.
05 Data-of-param X(100).
How does the length-of-parm variable get populated in my COBOL program? I want to know this out of curosity. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
You have your PARM data specified in the Linkage Section. You have it specified on the Procedure Division Using. And the operating sytem "calls" your program with one parameter, the PARM, the first part of which it previously calculated to be the lenght of the data you supplied on the PARM in the JCL.
Code: |
01 Parm-parameter.
05 Length-of-parm s9(4) Comp.
05 Data-of-param.
10 FILLER PIC X OCCURS 0 TO 100 TIMES
DEPENDING ON Length-of-parm.
|
If you code it something like the above, you just have to MOVE Data-of-param to wherever you want to process it in your program and not have to worry about anything else. |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
Quote: |
How does the length-of-parm variable get populated in my COBOL program? |
The operating system does it when it loads the program into memory |
|
Back to top |
|
|
Amb
New User
Joined: 12 Mar 2010 Posts: 64 Location: India
|
|
|
|
Ok. So the operating system loads the length.
Can I conclude the below:
Pls correct me if I am wrong.
As the max number of bytes that can be passed from JCL to COBOL using PARM is 100.
So if I pass 100 bytes using PARM from the JCL to COBOL program. Then the COBOL program will receive 102 bytes. 100 bytes from the JCL and 2 bytes by the operating system. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
the payload is still only 100 bytes , the extra bytes are control info
again... 100 vs. 102 is just useless tetrapyloctomy |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
As enrico says, 100 bytes, no more.
If you need more space, you probably have to use a file.
This is the way the Cobol compiler does it. If you want to give options on a PARM, but the PARM is too long, then you can tell the comiler to read form a file instead. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
Follow on
Quote: |
100 characters is the maximum limit that we can pass using PARM to a COBOL program. |
NO, not a COBOL issue
100 chars is a limitation imposed by JCl...
the maximum length of the parm string is 100 chars period
JCl does not know/care about the language used to write the program! |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
To re-phrase what I wrote so badly:
[Reading a file] is the way the Cobol compiler does it [when you want to specificy many options which takes you over 100 characters]. If you want to give options [to the compiler] on a PARM, but the PARM is too long, then you can tell the compiler to read form a file instead. [So even the IBM Cobol compiler is unable to break the 100 character limit]. |
|
Back to top |
|
|
Amb
New User
Joined: 12 Mar 2010 Posts: 64 Location: India
|
|
|
|
In one of the IBM interviews I was asked this question:
What is the mximum limit of the number of characters that can be passed from JCL via PARM? Is it 98 or 100?
So I wonder if it is 98 as 2 bytes are for holding the length of the PARM.. (98+2=100)
Or is it 100 as additional as 2 bytes are loaded by the operating system..(100+2=102)
I will not have access to mainframe till end of this week..If any body has already tried it, pls post the reply. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
100 bytes can be passed. Not 99, not 101, not 98, not 102 -- 100, period. The length of the data is not considered part of what is being passed -- the merely allows you to avoid possible storage abends. |
|
Back to top |
|
|
Amb
New User
Joined: 12 Mar 2010 Posts: 64 Location: India
|
|
|
|
Thanks Robert |
|
Back to top |
|
|
CuriousMainframer
New User
Joined: 28 Feb 2012 Posts: 9 Location: India
|
|
|
|
Hi ,
Bill mentioned that we can tell the compiler to read from a file when the PARM is too long.
Can anyone tell me how this can be done ?. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
How do you currently read data from a dataset ? |
|
Back to top |
|
|
Dsingh29
Active User
Joined: 16 Dec 2008 Posts: 132 Location: IBM
|
|
|
|
Hi CuriousMainframer,
you have to read dataset as an input file to your program or alternatively you can use SYSIN to pass data your cobol program. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
This is the PARM to the compiler, not any old PARM to some program you've written, yes?
In which case there is a compiler option to tell the compiler to use a file to look for more options. If your version of Cobol is late enough. Have a look at the Programmer's Guide for your version. It is best if you look yourself to discover the value, as you get the practice and might pick up other things. It is in 4.2 of Enterprise Cobol, not in 3.2. |
|
Back to top |
|
|
|