IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

SSRANGE and NOSSRANGE


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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: 2481
Location: @my desk

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

Check out this

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
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
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
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

Moderator Emeritus


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

PostPosted: Fri Oct 10, 2008 12:48 pm
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
Reply with quote

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

Moderator Emeritus


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

PostPosted: Fri Oct 10, 2008 1:05 pm
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)?
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
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
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: 2481
Location: @my desk

PostPosted: Fri Oct 10, 2008 2:21 pm
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

Superior Member


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

PostPosted: Fri Oct 10, 2008 2:30 pm
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 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
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..
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

Superior Member


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

PostPosted: Fri Oct 10, 2008 2:37 pm
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts PL/I Equivalent command for NOSSRANGE PL/I & Assembler 4
No new posts How To specify SSRANGE & CHECK(ON... COBOL Programming 8
No new posts Why SSRANGE option is used for Mainframe Interview Questions 3
No new posts How can we set SSRANGE compiler optio... COBOL Programming 13
No new posts accessing a table with SSrange ON. COBOL Programming 5
Search our Forums:

Back to Top