Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
How is sign stored in a comp-3 field / COMP field

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions
View previous topic :: :: View next topic  
Author Message
KS

New User


Joined: 28 Feb 2006
Posts: 91
Location: Chennai

PostPosted: Fri Apr 21, 2006 12:57 pm    Post subject: How is sign stored in a comp-3 field / COMP field
Reply with quote

1. How is sign stored in a comp-3 field / COMP field?
2. Synchronised Clause - often asken?
3. Difference between -ve and + ve sqlcodes?
4. Explain difference between TEST and OPTIMIZE Compile directives - one of the Interview Questions.
Back to top
View user's profile Send private message

mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Sat Apr 22, 2006 7:08 am    Post subject:
Reply with quote

Hi KS,

1) COMP-3 stores the sign inthe low order half byte of the field. Ex. -123 is strored as X'123D'; +123 as X'123C'; 123 as X'123F'.

COMP stores the sign in the hi order non-significant bits of the field. Ex. +1 is stored as B'00000001'. As you see the sign is zero; -1 is stored as
B'11111111', the sign is 1.

If you take the pos COMP +1 and "flip" each bit, you get B'11111110' then add B'1'. You get B'11111111' or X'FF'. That's how you change a pos COMP field to a neg field.

That's why you see a lot of move -1 to switches and such from IBM. It's really a way to set it to X'FF'.

2) SYNC aligns a COMP field on half or full word boundary.

3) +ve, good; -ve, bad.
4) OPT... the compiler makes your code more efficient. TEST - not sure.
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 COMP Variables Mismatch gayu7 COBOL Programming 5 Wed Dec 20, 2017 5:06 pm
No new posts CICS web service from DB2 Triggers or... kiranprasad DB2 2 Wed Dec 20, 2017 11:10 am
No new posts Moving a COMP-3 Variable to a Numeric... ajayachander COBOL Programming 2 Thu Dec 14, 2017 5:46 pm
No new posts CONDITIONAL USING COMP-2 WITH PROBLEMS. JOSUEGENTIL COBOL Programming 7 Wed Nov 08, 2017 11:13 pm
No new posts how can i move s9(9) to s9(9) usage comp HARENDRA CHOUDHARY COBOL Programming 3 Mon Nov 06, 2017 12:10 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us