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
 

 

negative value is moved to an unsigned integer

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions
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    Post subject: negative value is moved to an unsigned integer
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

Site Director


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

PostPosted: Thu Aug 20, 2009 7:28 pm    Post subject:
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    Post subject:
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    Post subject: Reply to: negative value is moved to an unsigned integer
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts READ A PACKED "NEGATIVE" FI... jdesouza CA Products 3 Tue May 02, 2017 11:43 pm
No new posts Syncsort - NULL in Integer field chec... nartcr SYNCSORT 4 Thu Oct 06, 2016 6:47 am
No new posts New PROC not reflecting in prod even ... Musab Ahmed CA Products 9 Tue Mar 15, 2016 12:45 pm
No new posts Negative value used in IFTHEN jacobdng DFSORT/ICETOOL 3 Tue Aug 04, 2015 2:12 pm
No new posts Does FUNCTION NUMVAL work for alphanu... Venkata Ramayya COBOL Programming 8 Fri Mar 20, 2015 10:43 pm


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