IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Group move with COMP3


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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
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: 2146
Location: At my coffee table

PostPosted: Wed Apr 15, 2009 6:09 am
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

Moderator Emeritus


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

PostPosted: Wed Apr 15, 2009 6:12 am
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: 8696
Location: Dubuque, Iowa, USA

PostPosted: Wed Apr 15, 2009 6:45 am
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts COBOL - Move S9(11)v9(7) COMP-3 to -(... COBOL Programming 5
No new posts How to move the first field of each r... DFSORT/ICETOOL 5
No new posts Compare latest 2 rows of a table usin... DB2 1
No new posts Problem with IFTHEN=(WHEN=GROUP,BEGIN... DFSORT/ICETOOL 5
No new posts Splitting group records based on deta... DFSORT/ICETOOL 8
Search our Forums:

Back to Top