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
 

 

What COBOL does with sign nibble in unsigned COMP-3

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
abin

Active User


Joined: 14 Aug 2006
Posts: 198

PostPosted: Mon Nov 12, 2007 1:33 pm    Post subject: What COBOL does with sign nibble in unsigned COMP-3
Reply with quote

Hi,

I have a field with following declaration.

Code:
REC-CNTRL-NO                PIC 9(11)     COMP-3.

In input following are the values for two records in this field.

Code:
011111   
111110   
-------
               
111111   
22222B   


My code is as follows.

Code:
COMPUTE REC-CNTRL-NO  = REC-CNTRL-NO  * 1


Out put I got is

Code:
011111   
11111F   
-------
               
111111   
22222F


It looks like for Unsigned comp-3 the sign nibble is of no importance. But it fails in numeric test.

Could some one please explain what COBOL does with sign nibble in unsigned COMP-3. I know that for unsigned COMP-3 valid value is only 'F'.

Also when I move this field into a signed COMP-3 field I am getting a C in the sugn nibble, regardless of the value in input sign nibble.
Back to top
View user's profile Send private message

CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Mon Nov 12, 2007 3:41 pm    Post subject:
Reply with quote

It is just COBOL doing what you asked it to do by specifing unsigned, COBOL in insuring all operations on the field see a generic positive by ORing the F into the sign nibble.....
Back to top
View user's profile Send private message
abin

Active User


Joined: 14 Aug 2006
Posts: 198

PostPosted: Mon Nov 12, 2007 4:51 pm    Post subject:
Reply with quote

Hi ,

COBOL is cool in this matter even with a code as below it is ORing F with the sign nibble, regardless of the value in input sign nibble.

Code:
COMPUTE REC-CNTRL-NO  = REC-CNTRL-NO   
                          * -1                 
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 686
Location: Earth

PostPosted: Mon Nov 12, 2007 5:02 pm    Post subject:
Reply with quote

Abin,
Please note the result variable is unsigned here so it is doing what you asked for.
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 -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts RULES(NOEVENPACK) in cobol jackzhang75 COBOL Programming 1 Wed Mar 29, 2017 12:47 am
No new posts SQL query not working in Cobol program. CuriousMainframer COBOL Programming 14 Wed Feb 22, 2017 5:56 pm
No new posts Execute TSO ACF commands from COBOL-I... supreethi.srid TSO/ISPF 0 Tue Feb 21, 2017 5:19 pm
No new posts Mainframe Interview Questions CICS,CO... akshathan Mainframe Interview Questions 6 Thu Feb 09, 2017 6:38 pm
No new posts Submit job from Cobol with input data abdulrafi COBOL Programming 4 Wed Feb 01, 2017 12:41 pm


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