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
 

 

Passing 100 characters using PARM from JCL to COBOL

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Passing 100 characters using PARM from JCL to COBOL
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7225

PostPosted: Sun Apr 24, 2011 11:42 am    Post subject: Reply to: JCL parm parameter
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: 1713
Location: UK

PostPosted: Sun Apr 24, 2011 8:35 pm    Post subject:
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    Post subject:
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Sun Apr 24, 2011 10:44 pm    Post subject: Reply to: JCL parm parameter
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7225

PostPosted: Mon Apr 25, 2011 2:20 am    Post subject: Reply to: JCL parm parameter
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Mon Apr 25, 2011 3:41 am    Post subject: Reply to: JCL parm parameter
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7225

PostPosted: Mon Apr 25, 2011 3:53 am    Post subject: Reply to: JCL parm parameter
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    Post subject:
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: 7905
Location: Bellevue, IA

PostPosted: Mon Apr 25, 2011 8:23 am    Post subject:
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    Post subject: Reply to: JCL parm parameter
Reply with quote

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

New User


Joined: 28 Feb 2012
Posts: 5
Location: India

PostPosted: Tue Feb 28, 2012 12:56 pm    Post subject: Reply to: JCL parm parameter
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: 8593
Location: Back in jolly old England

PostPosted: Tue Feb 28, 2012 12:59 pm    Post subject:
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    Post subject: Reply to: JCL parm parameter
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Tue Feb 28, 2012 1:15 pm    Post subject: Reply to: JCL parm parameter
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
http://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
http://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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7225

PostPosted: Tue Feb 28, 2012 1:15 pm    Post subject: Reply to: JCL parm parameter
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts FTP - JCL failed while passing FTP co... Suneetha1612 JCL & VSAM 12 Wed Nov 16, 2016 7:33 pm
This topic is locked: you cannot edit posts or make replies. RANDOM Function in COBOL swapnil781 COBOL Programming 2 Tue Nov 15, 2016 6:17 pm
No new posts Regarding COBOL Stored Procedure opti... selvamsrinivasan85 DB2 4 Fri Nov 04, 2016 8:57 pm
No new posts COBOL Version 6.1 Virendra Shambharkar COBOL Programming 5 Tue Nov 01, 2016 11:24 am
No new posts Cobol list of programs being called biswajit.dattagupta COBOL Programming 5 Tue Nov 01, 2016 2:10 am


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