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
 

 

Group move with COMP3

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

Active User


Joined: 29 Dec 2005
Posts: 181
Location: Canada

PostPosted: Wed Apr 15, 2009 5:35 am    Post subject: Group move with COMP3
Reply with quote

Hi

Please consider the data below :

Code:
01 CC-TEMP1.
     05   CC-X1         PIC S9(7) COMP-3.
     05   CC-X2         PIC X(5).

01 CC-TEMP2.
     05   CC-Y1         PIC 9(7) .
     05   CC-Y2         PIC X(5).

Please note that CC-X1 & CC-Y1 are defined diffrently ( one is comp 3).

If I execute following statement

Code:
IF  CC-TEMP1 NUMERIC


The result is , it never identifies it as numeric even if the actual data is numeric.

Where as

Code:
IF  CC-TEMP2 NUMERIC


Correctly identifies it as NUMERIC.

Please note that data is same ( which is numeric ) in both the variables.

Can some one please explain this to me ?
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: Wed Apr 15, 2009 5:54 am    Post subject:
Reply with quote

Have you checked the Language Reference manual?
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: Wed Apr 15, 2009 6:09 am    Post subject: Re: Group move with COMP3
Reply with quote

ap_mainframes wrote:
Can some one please explain this to me ?
Yes, but only if you display both fields to the terminal with HEX ON and post them here.....
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: Wed Apr 15, 2009 6:12 am    Post subject:
Reply with quote

Hello,

Quote:
Can some one please explain this to me ?
Why might you believe that the same value would be valid in both of those definitions?
Quote:
it never identifies it as numeric even if the actual data is numeric.
Your misconception is this - the actual data is not numeric.

As Terry mentioned, some time in the COBOL Language Reference should help you understand.

At the top of the page is a link to "IBM Manuals". Among them are the Language Reference for multiple current cobol compilers.

If you find something in the manual that is not clear, post what you found and your question. Someone will be able to clarify.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7999
Location: Bellevue, IA

PostPosted: Wed Apr 15, 2009 6:45 am    Post subject:
Reply with quote

COBOL is doing exactly what the manuals says it is supposed to do -- which is obviously not what you expected. CC-TEMP2 is a group of like-defined fields, each of which is numeric. So it is numeric. CC-TEMP1 is a group of fields (one of which is signed), which changes some of the rules of IF NUMERIC. The manual explains all (or at least almost everything) and should be your first reference book -- always.
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 Why TS/OP would Not contact site supp... RahulG31 All Other Mainframe Topics 2 Wed Mar 22, 2017 7:46 am
No new posts DB2 9.1.0 not move values to Host-Var... Miguel Fernandez DB2 8 Wed Jan 25, 2017 8:24 pm
No new posts DB2 9.1.0 not move values to Host-Var... Miguel Fernandez DB2 0 Wed Jan 25, 2017 8:23 pm
No new posts DB2 9.1.0 not move values to Host-Var... Miguel Fernandez DB2 0 Wed Jan 25, 2017 8:21 pm
No new posts Sorting group data rajella DFSORT/ICETOOL 4 Sun Jan 22, 2017 11:32 pm


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