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
 

 

COBOL 5.1 and the UNBOUNDED Keyword

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

CICS Moderator


Joined: 14 Jan 2008
Posts: 2502
Location: Atlanta, Georgia, USA

PostPosted: Tue Apr 29, 2014 7:31 pm    Post subject: COBOL 5.1 and the UNBOUNDED Keyword
Reply with quote

In a current program, here's what we do -

Code:

 01  QUEUE-DEFINITION-TABLE.                                     
     05  QUEUE-DEF-MAX       PIC  S9(08) COMP-5.                                               
     05  QUEUE-DEF-TBL       OCCURS 1 TO 10000 TIMES   

This array loads a VSAM file, with the number of records obtained from an Assembler sub-program, which issues a SHOWCB Macro. The current 10000 seems to be a good threshold.

We dynamically calculate the max number of records in this array, by dividing THE LENGTH OF QUEUE-DEFINITION-TABLE (minus THE LENGTH OF QUEUE-DEF-MAX) by THE LENGTH OF QUEUE-DEF-TBL (1). If the number of records returned from the sub-program is greater than the calculated-max, then we have a problem.

Now, in COBOL 5.1, we have the UNBOUNDED keyword, which substitutes for the hard-coded max of 10000.

But when UNBOUNDED is used THE LENGTH OF QUEUE-DEFINITION-TABLE in the compiler doesn't have a length, but rather a "0CL*", which basically says "I don't know the length because you're using UNBOUNDED".

I was told (by Tom Ross) that UNBOUNDED has a max based upon the picture clause and definition, which in this case is a signed binary-fword.

So, if I wanted to define THE LENGTH OF QUEUE-DEFINITION-TABLE, I'd use X'7FFFFFFF' which is the max value for a binary-fword.

I'd like to get some feedback on this approach. Otherwise, I'll leave it at 10000 and that will be that.

Regards,
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Tue Apr 29, 2014 8:08 pm    Post subject: Reply to: COBOL 5.1 and the UNBOUNDED Keyword
Reply with quote

The maximum value your ODO item can hold would be the maximum number of entries in the table.

Depending on the maxima for LINKAGE SECTION items for V5.1, which I haven't checked, that would be it.

However, it would require that the ASM program is returning a value in a field which is longer/contains a higher maximum value (ie unsigned) than the ODO item, else your test for over-the-top will never be true, and other stuff within the table will probably get overwritten, or something outside the table will.

On the other hand, if the figure from the ASM can never big bigger than the maximum of the ODO, you don't even need to test it...
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2502
Location: Atlanta, Georgia, USA

PostPosted: Tue Apr 29, 2014 9:54 pm    Post subject: Reply to: COBOL 5.1 and the UNBOUNDED Keyword
Reply with quote

I've decided to leave it at 10000 as it would cause changes to the program that (for the most part) seem unnecessary. Besides, the new method incorporated into 5.1, to calculate BLL's at approximately a 512K chunk allocation has certainly sped up large table addressability.

All and all, 5.1 looks like the compiler folks did a good job....
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
This topic is locked: you cannot edit posts or make replies. Cobol GUI (like Editor) Kala Mainframe COBOL Programming 14 Wed May 10, 2017 12:30 pm
No new posts IMS T-Pipe queue counts in a COBOL Pr... Siva NKK Kothamasu IMS DB/DC 0 Tue May 09, 2017 6:31 pm
No new posts COBOL Code Parsers and Lineage Establ... balimanja COBOL Programming 2 Tue May 02, 2017 3:30 am
No new posts Cobol upgrade - source code missing f... gthmrj IBM Tools 1 Wed Apr 26, 2017 6:04 pm
No new posts COBOL Programming Sandpit? jodrisco COBOL Programming 6 Wed Apr 12, 2017 3:47 am


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