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
 

 

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 READ A PACKED "NEGATIVE" FI... jdesouza CA Products 3 Tue May 02, 2017 11:43 pm
No new posts Alter &DATENS field in HEADER1 Angad DFSORT/ICETOOL 4 Mon Apr 24, 2017 11:49 am
No new posts SORT VSAM file with each field one by... maxsubrat DFSORT/ICETOOL 6 Tue Mar 14, 2017 1:07 pm
No new posts IMS DB-How to update a record (a sing... Nic Clouston IMS DB/DC 9 Thu Mar 09, 2017 4:38 pm
No new posts outrec field outside range Danielle.Filteau SYNCSORT 10 Sat Mar 04, 2017 2:37 am


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