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
 

 

SSRANGE and NOSSRANGE

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
PSS Sankar

New User


Joined: 08 Oct 2008
Posts: 6
Location: Pune

PostPosted: Fri Oct 10, 2008 10:42 am    Post subject: SSRANGE and NOSSRANGE
Reply with quote

Hi,

I Havebeen asked in interview regarding Tables in Cobol.

What happens if we use SSRANGE and NOSSRANGE,If any body nose explain in detail if possible with an example.

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

Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2158
Location: @my desk

PostPosted: Fri Oct 10, 2008 11:01 am    Post subject:
Reply with quote

Check out this

http://publib.boulder.ibm.com/infocenter/pdthelp/v1r1/index.jsp?topic=/com.ibm.entcobol.doc_4.1/CG/igycch257.htm
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Fri Oct 10, 2008 11:03 am    Post subject:
Reply with quote

The IBM COBOL compiler defaults to NOSSRANGE (no subscript range) to avoid performance problems. So even if you fed index greater than tables range your program will not abend.

If you want your program to abend on index greater than tables range you have to give compiler option SSRANGE.
Back to top
View user's profile Send private message
PSS Sankar

New User


Joined: 08 Oct 2008
Posts: 6
Location: Pune

PostPosted: Fri Oct 10, 2008 11:31 am    Post subject: Reply to: SSRANGE and NOSSRANGE
Reply with quote

So if we give NOSSRANGE as compiler option,and when program trying to access out of index value,The program wont get abend??.
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Fri Oct 10, 2008 12:39 pm    Post subject:
Reply with quote

Quote:
So if we give NOSSRANGE as compiler option,and when program trying to access out of index value,The program wont get abend??.


No. You will fetch garbage.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Oct 10, 2008 12:48 pm    Post subject: Reply to: SSRANGE and NOSSRANGE
Reply with quote

Quote:
No. You will fetch garbage.
Which may yet cause an abend. . .

d
Back to top
View user's profile Send private message
PSS Sankar

New User


Joined: 08 Oct 2008
Posts: 6
Location: Pune

PostPosted: Fri Oct 10, 2008 12:57 pm    Post subject:
Reply with quote

Then suggest me...
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Oct 10, 2008 1:05 pm    Post subject:
Reply with quote

Hello,

Quote:
Then suggest me...
Suggest what? If you are looking for explanations, you need to provide enough detail to describe what you are looking for. . .

Did you look at the manuals we have linked at the top of the page (IBM Manuals)?
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/handheld/Connected/BOOKS/igy3pg20/2.4.48?
Back to top
View user's profile Send private message
PSS Sankar

New User


Joined: 08 Oct 2008
Posts: 6
Location: Pune

PostPosted: Fri Oct 10, 2008 1:56 pm    Post subject:
Reply with quote

Ohh...My dear friend,

I need One practical example...
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Fri Oct 10, 2008 2:18 pm    Post subject:
Reply with quote

Quote:

Quote:
No. You will fetch garbage.

Which may yet cause an abend. . .


But not while fetching value.
May be further usage of that value in the program cause abend due to other reasons.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2158
Location: @my desk

PostPosted: Fri Oct 10, 2008 2:21 pm    Post subject:
Reply with quote

PSS Sankar wrote:
Ohh...My dear friend,

I need One practical example...

Why dont you try this out yourself to see what happens practically.
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Fri Oct 10, 2008 2:30 pm    Post subject:
Reply with quote

Hello,

As suggested many times, IBM COBOL compiler defaults to NOSSRANGE (no subscript range) to avoid performance problems. There is additional object code, storage, and CPU overhead associated with using the SSRANGE feature. If you use CA-InterTest for initial monitoring in production, it's advisable not to combine them, the combined overhead of both CA-InterTest and SSRANGE will not be a good idea.

Since you may have specific concerns about your programs, you may want to go ahead and specify the SSRANGE option in your job to compile these programs for production. With the SSRANGE option set, at run time, when the program has an index that exceeds the range, the program will terminate with an ABEND USER=4038 and generate an error message.

IBM’s COBOL processing for table subscripts and indexes is documented in the following manual: COBOL MVS & VM V1R2M2 Programming Guide (SC26-4767-03), found at http://publibz.boulder.ibm.com:80/cgi-bin/bookmgr_OS390/BOOKS/IGYPG104/

Search on the keywords SSRANGE or NOSSRANGE. There should be a fair amount of text discussing the use of SSRANGE compiler option to enable checking for subscripts or indexes trying to reference an area outside the region of the table. The manual also discusses the performance impact of the additional code generated when enabling the SSRANGE option.
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Fri Oct 10, 2008 2:31 pm    Post subject:
Reply with quote

Code:

01 VINTEMP.                                                     
   02 VIN PIC X(40) VALUE 'ABCD 12  IUTOER 545 JLLDF    1   '.   
   02 VIN1 REDEFINES VIN PIC X OCCURS 40 TIMES.                 
'
'
MOVE 41 TO NUMVAL.     
DISPLAY VIN1(NUMVAL). 

if
PARM='NOSSRANGE' then MAXCC=0 CN(INTERNAL)

if

PARM='SSRANGE' then Abend with below message

IGZ0006S The reference to table VIN1 by verb number 01 on line 000070 addressed an area outside the region of the
table.
From compile unit ARITH at entry point ARITH at compile unit offset +00000B8E at entry offset +00000B8E at
address 15F01926.


Check this link also..
http://publib.boulder.ibm.com/infocenter/zos/v1r9/index.jsp?topic=/com.ibm.zos.r9.ceea100/ceea118083.htm
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Fri Oct 10, 2008 2:37 pm    Post subject:
Reply with quote

Hello again,

Just a little thought on the use of SSRANGE..If there is any programming which sets a subscript to be above the maximum value on purpose (eg. to exit a perform-varying) then the program will bomb. eg:
Code:

perform varying sub from 1 by 1 until sub > max-allowed
  if tab-element(sub) = 'whatever'
    move tab-element(sub) to save-element
    compute sub=max-allowed + 1
  end-if
end-perform

..and yes, I've seen programs like that.. icon_surprised.gif

PS. Sambhji, I didn't see your post, however I'll keep mine here as well, it's just other example.
Back to top
View user's profile Send private message
PSS Sankar

New User


Joined: 08 Oct 2008
Posts: 6
Location: Pune

PostPosted: Fri Oct 10, 2008 2:40 pm    Post subject:
Reply with quote

ok..Thanks!!! alot
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
No new posts PL/I Equivalent command for NOSSRANGE satish.ms10 PL/I & Assembler 4 Tue Aug 25, 2009 12:25 pm
No new posts How To specify SSRANGE & CHECK(ON... itjagadesh COBOL Programming 8 Fri Oct 26, 2007 8:14 pm
No new posts Why SSRANGE option is used for rajyalalitha Mainframe Interview Questions 3 Tue Sep 26, 2006 9:28 am
No new posts How can we set SSRANGE compiler optio... jerrinfrancis COBOL Programming 13 Tue Aug 29, 2006 1:36 pm
No new posts accessing a table with SSrange ON. counto COBOL Programming 5 Thu Jun 30, 2005 4:48 am


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