Why SSRANGE is not allowed?

OS/VS COBOL, COBOL II, Enterprise COBOL for z/OS. OpenCOBOL and OOCobol.
Post Reply
alpna
Registered Member
Posts: 56
Joined: Fri Jun 21, 2013 10:35 pm

Why SSRANGE is not allowed?

Post by alpna »

Hi,

A job was abended in production. The reason was that COBOL internal table was overlowed. We are not using SSRANGE in production. It is told it is standard. In my last compnay also we were not using SSRANGE in production. Why it is not allowed, what is wrong with this option?
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1896
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: Why SSRANGE is not allowed?

Post by Robert Sample »

With SSRANGE, the compiler adds code to check table limits -- which potentially means a LOT of code could be added. The V5.1 Performance Tuning Guide manual states on page 25:
A benchmark that makes moderate use of subscripted references to tables slows down by 20% when SSRANGE is specified.
So many sites prohibit SSRANGE in production code due to the performance hit suffered. There is nothing "wrong" with the option -- it does what it is designed to do. The issue is the performance impact of the option.
alpna
Registered Member
Posts: 56
Joined: Fri Jun 21, 2013 10:35 pm

Re: Why SSRANGE is not allowed?

Post by alpna »

Thanks. So what is the best way to avoid such abends in production?
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1896
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: Why SSRANGE is not allowed?

Post by Robert Sample »

So what is the best way to avoid such abends in production?
Nobody ever wants to hear this, but the best way to avoid such abends is to write better code. Have the table size (number of elements) stored in a variable and EVERY time a subscript is set, test to make sure it is within the table limit. This can be tedious and if the code does not already have this in it, there can be a major effort required to add the tests. But since there is nothing in COBOL except SSRANGE to do such testing, this is what has to be done to prevent abends from table overflows.
User avatar
Anuj Dhawan
Founder
Posts: 2802
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

Re: Why SSRANGE is not allowed?

Post by Anuj Dhawan »

Robert Sample wrote: Fri Oct 26, 2018 5:30 pmHave the table size (number of elements) stored in a variable and EVERY time a subscript is set, test to make sure it is within the table limit.
This had been a standard at couple of shops I had been to but if a shop has never adopted for this, it can indeed be tedious.
Thanks,
Anuj

Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “IBM COBOL, GnuCOBOL (OpenCOBOL), OOCobol.”