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

negative value is moved to an unsigned integer


IBM Mainframe Forums -> Mainframe Interview Questions
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
soumyanamboo

New User


Joined: 16 Apr 2008
Posts: 13
Location: Chennai

PostPosted: Thu Aug 20, 2009 2:04 pm
Reply with quote

What will be the output if a negative value is moved to an unsigned integer?

01 WS-VAR1 PIC 99 VALUE 5
01 WS-VAR2 PIC 99 VALUE 10
01 WS-VAR3 PIC 99 VALUE 10

SUBTRACT WS-VAR1 WS-VAR2 FROM WS-VAR3

What is the value of WS-VAR3?
a) 5
b) 0
c) -5
d) On size Error.
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: Thu Aug 20, 2009 7:28 pm
Reply with quote

Hello,

What do you believe is the answer? Why?
Back to top
View user's profile Send private message
arvind.m

Active User


Joined: 28 Aug 2008
Posts: 205
Location: Hyderabad

PostPosted: Thu Aug 20, 2009 8:03 pm
Reply with quote

05
Back to top
View user's profile Send private message
soumyanamboo

New User


Joined: 16 Apr 2008
Posts: 13
Location: Chennai

PostPosted: Thu Aug 20, 2009 8:04 pm
Reply with quote

I think it is (a) 5
Bcos answer is -5( 10+5 is subtracted from 10) and since it is an unsigned integer, only 5 will get stored
Is it correct?
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Thu Aug 20, 2009 8:10 pm
Reply with quote

I don't have mainframe access, but I believe you are correct (answer is a)).
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 -> Mainframe Interview Questions

 


Similar Topics
Topic Forum Replies
No new posts PD not working for unsigned packed JO... DFSORT/ICETOOL 5
No new posts Def PD not working for unsigned packe... JCL & VSAM 3
No new posts data moved using MVI on para-name. PL/I & Assembler 4
No new posts Recompiling programs after a copybook... COBOL Programming 1
No new posts Negative dependency between jobs in m... COBOL Programming 12
Search our Forums:

Back to Top