Skip to Content
Custom Search

On size error truncation or no effect

1 reply [Last post]
Anonymous

 


Please take a look at the following question and clarify if the truncation would occur or there will be no change in value of second Variable VAR2

 

Two variables declared as below in COBOL program
01 VAR1 PIC 9(2) VALUE IS 20
01 VAR2 PIC 9(3) VALUE IS 990


ADD VAR1 TO VAR2 ON SIZE ERROR DISPLAY 'ON SIZE ERROR'
DISPLAY 'VALUE OF  VAR2 IS =' VAR2


What is the value of B when it is displayed? 

a) 990
b) 1010 
c) 101 
d) None of the above

"; ; ; ;

Sponsored Listing
Alan.R.Wynne
Offline
Joined: 07/07/2011
Posts:
On Size Error

This is what i suspect happens:

the Add statement causes the 2 working storage items to be loaded into registers and added. As soon as the "on size error" is detected, the "on size error" statements are executed and the variables in working storage remain unchanged.

Click the +1 button  below to share it with your friends and colleagues

 

Share this if you liked it!

 

Disclaimer



Who's online

There are currently 1 user and 30 guests online.

Online users

  • siteadmin
Dr. Radut | forum