IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Passing 100 characters using PARM from JCL to COBOL


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Amb

New User


Joined: 12 Mar 2010
Posts: 64
Location: India

PostPosted: Sun Apr 24, 2011 8:44 am
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Sun Apr 24, 2011 11:42 am
Reply with quote

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
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Sun Apr 24, 2011 8:35 pm
Reply with quote

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
View user's profile Send private message
Amb

New User


Joined: 12 Mar 2010
Posts: 64
Location: India

PostPosted: Sun Apr 24, 2011 9:49 pm
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Sun Apr 24, 2011 10:44 pm
Reply with quote

the payload is still only 100 bytes , the extra bytes are control info

again... 100 vs. 102 is just useless tetrapyloctomy
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Apr 25, 2011 2:20 am
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Mon Apr 25, 2011 3:41 am
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Apr 25, 2011 3:53 am
Reply with quote

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
View user's profile Send private message
Amb

New User


Joined: 12 Mar 2010
Posts: 64
Location: India

PostPosted: Mon Apr 25, 2011 7:12 am
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8697
Location: Dubuque, Iowa, USA

PostPosted: Mon Apr 25, 2011 8:23 am
Reply with quote

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
View user's profile Send private message
Amb

New User


Joined: 12 Mar 2010
Posts: 64
Location: India

PostPosted: Mon Apr 25, 2011 10:58 am
Reply with quote

Thanks Robert
Back to top
View user's profile Send private message
CuriousMainframer

New User


Joined: 28 Feb 2012
Posts: 9
Location: India

PostPosted: Tue Feb 28, 2012 12:56 pm
Reply with quote

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
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Tue Feb 28, 2012 12:59 pm
Reply with quote

How do you currently read data from a dataset ?
Back to top
View user's profile Send private message
Dsingh29

Active User


Joined: 16 Dec 2008
Posts: 132
Location: IBM

PostPosted: Tue Feb 28, 2012 1:09 pm
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Tue Feb 28, 2012 1:15 pm
Reply with quote

the question was really ...
How do i write the compilation jcl/
what do I have to put in the source program
in order to have the cobol compiler accept/use more than 98 chars of parms

see here
publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/igy3pg40/2.1.5?ACTION=MATCHES&REQUEST=parm&TYPE=FUZZY&SHELF=IGY3SH40.bks&DT=20071214180654&CASE=&searchTopic=TOPIC&searchText=TEXT&searchIndex=INDEX&rank=RANK&ScrollTOP=FIRSTHIT#FIRSTHIT

or, if Your compiler does not support the SYSOPTF ddname, here
publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/igy3pg32/2.1.5?ACTION=MATCHES&REQUEST=parm&TYPE=FUZZY&SHELF=IGY3SH33&DT=20061117131343&CASE=&searchTopic=TOPIC&searchText=TEXT&searchIndex=INDEX&rank=RANK&ScrollTOP=FIRSTHIT#FIRSTHIT
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Feb 28, 2012 1:15 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Substring number between 2 characters... DFSORT/ICETOOL 2
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
Search our Forums:

Back to Top