MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

size of the PROCEDURE DIVISION USING statement

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
MVS_blob
Beginner


Joined: 23 Oct 2007
Posts: 23
Topics: 9

PostPosted: Sun Jun 29, 2008 8:38 pm    Post subject: size of the PROCEDURE DIVISION USING statement Reply with quote

Hi,

Been stuck on this problem for some time now, and Google hasn't turned up any good results..

Does anyone know of, the limitations on the 'USING' clause on the procedure Division statement? i.e. memory size

I'm using the IBM Enterprise COBOL for z/OS 3.4.1 compiler.

Cheers.
Back to top
View user's profile Send private message
MVS_blob
Beginner


Joined: 23 Oct 2007
Posts: 23
Topics: 9

PostPosted: Mon Jun 30, 2008 1:14 am    Post subject: Reply with quote

Found it: 32767 bytes.

As the Procedure division doesn't allocate memory in the 'USING' clause, then the 32767 must refer to the addresses of the individual values being passed.

1 address = 1 word = 4 bytes = 32 bits

Therefore 32767 / 32 bits = 1024 variables

That means the statement 'PROCEDURE DIVISION USING' is limited to 1024 variables?

Can anyone correct me if i'm wrong...

Also, what is classed as a variable? e.g. redefinitions, 88 LVL, OCCURS...etc
Back to top
View user's profile Send private message
MVS_blob
Beginner


Joined: 23 Oct 2007
Posts: 23
Topics: 9

PostPosted: Mon Jun 30, 2008 1:29 am    Post subject: Reply with quote

Oops...

Its 32767 items, not bytes.
Back to top
View user's profile Send private message
Terry_Heinze
Supermod


Joined: 31 May 2004
Posts: 391
Topics: 4
Location: Richfield, MN, USA

PostPosted: Mon Jun 30, 2008 9:55 am    Post subject: Reply with quote

Just out of curiousity, why are you interested in a limitation like that?
_________________
....Terry
Back to top
View user's profile Send private message Send e-mail
MVS_blob
Beginner


Joined: 23 Oct 2007
Posts: 23
Topics: 9

PostPosted: Tue Jul 01, 2008 3:05 am    Post subject: Reply with quote

My problem was like this:

PROGRAM1:
Code:
CALL PROGRAM2
USING DB-PCB-1
    DB-PCB-2
    DB-PCB-3
    DB-PCB-4
    DB-PCB-5


PROGRAM2:
Code:
PROCEDURE DIVISION
USING DB-PCB-1
    DB-PCB-2
    DB-PCB-3
    DB-PCB-4
    DB-PCB-5


DB-PCB-4 & DB-PCB-5 was correct in PROGRAM1
DB-PCB-4 & DB-PCB-5 was corrupted in PROGRAM2

I changed the code to:

PROGRAM1:
Code:
CALL PROGRAM2
USING DB-PCB-1
    DB-PCB-4
    DB-PCB-2
    DB-PCB-3
    DB-PCB-5



PROGRAM2:
Code:
PROCEDURE DIVISION
USING DB-PCB-1
    DB-PCB-4
    DB-PCB-2
    DB-PCB-3
    DB-PCB-5


The results were then:
DB-PCB-3 & DB-PCB-5 was correct in PROGRAM1
DB-PCB-3 & DB-PCB-5 was corrupted in PROGRAM2

Naturally, I then thought it was a size limitation error.

...The final solution I found was PROGRAM3 was missing some PCBS:

PROGRAM0:
Code:
CALL PROGRAM1
CALL PROGRAM3


PROGRAM3:
Code:
CALL PROGRAM2
USING DB-PCB-1
    DB-PCB-2
    DB-PCB-3


So changing PROGRAM3's code to
PROGRAM3:
Code:
CALL PROGRAM2
USING DB-PCB-1
    DB-PCB-2
    DB-PCB-3
    DB-PCB-4
    DB-PCB-5


made everything work perfectly. Wink
Back to top
View user's profile Send private message
dsh33782
Beginner


Joined: 30 Jun 2008
Posts: 1
Topics: 0
Location: Tampa Bay Florida

PostPosted: Tue Jul 01, 2008 4:32 am    Post subject: Re: size of the PROCEDURE DIVISION USING statement Reply with quote

MVS_blob

When I worked at Micro Focus I saw a lot of code from Fortune 1000 customers and I've seen cases where over 2400 parameter addresses have been passed in a COBOL call statement to assembler. The actual limit in a specific case could be set by the compiler for the caller or the called language or by the environment they are running in.

If an application is passing more than just a few parameters, it might be time to redesign the interface to reduce the overhead of passing a lot of address constants.

Don Higgins
don@higgins.net
www.z390.org

MVS_blob wrote:
Hi,

Been stuck on this problem for some time now, and Google hasn't turned up any good results..

Does anyone know of, the limitations on the 'USING' clause on the procedure Division statement? i.e. memory size

I'm using the IBM Enterprise COBOL for z/OS 3.4.1 compiler.

Cheers.

_________________
Don Higgins
don@higgins.net
www.z390.org
Back to top
View user's profile Send private message Send e-mail
MVS_blob
Beginner


Joined: 23 Oct 2007
Posts: 23
Topics: 9

PostPosted: Tue Jul 01, 2008 6:25 pm    Post subject: Reply with quote

dsh33782, thanks for your comments.

32767 passed variables is the limit set by the COBOL for z/OS 3.4.1 compiler. (Thats alot of variables - the programs I work on don't reach anywhere near that limit)

P.S. I'm honoured that my post enticed you to join the forum. Very Happy
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group