MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

compare comp-3 field to SPACES/LOW-VALUES

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
digitalnirmal
Beginner


Joined: 06 Dec 2005
Posts: 21
Topics: 10

PostPosted: Tue Jun 13, 2006 2:24 am    Post subject: compare comp-3 field to SPACES/LOW-VALUES Reply with quote

I need to check if a S9(3)v9(4) COMP-3 variable is LOW-VALUES or SPACES.

How do I write it in COBOL?
Back to top
View user's profile Send private message
Jaya
Beginner


Joined: 02 Sep 2005
Posts: 77
Topics: 10
Location: Cincinnati

PostPosted: Tue Jun 13, 2006 3:42 am    Post subject: Reply with quote

Digitalnirmal,

This comparison is invalid in cobol..Moreover, Can you tell us the reason for doing such comparisons.

Check this link for the comparison rules..
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IGYL1101/2.8.5.5?SHELF=&DT=19930312093006&CASE=

If your intension is to check whether the content of the comp-3 data-item is numeric, you can use the class condition

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IGYL1101/2.8.5.2?SHELF=&DT=19930312093006&CASE=

Hope this helps...

Thanks,
Jaya.
_________________
"Great spirits have always encountered violent opposition from mediocre minds."
-Albert Einstein
Back to top
View user's profile Send private message
shekar123
Advanced


Joined: 22 Jul 2005
Posts: 528
Topics: 90
Location: Bangalore India

PostPosted: Tue Jun 13, 2006 6:16 am    Post subject: Reply with quote

Digitalnirmal,

You will get compilation error if u code :

Code:

01 Z  PIC S9(3)V9(4) COMP-3.
PROCEDURE DIVISION.
MOVE LOW-VALUES TO Z.     
IF Z = SPACES OR LOW-VALUES
   DISPLAY 'HAI'           
END-IF.                   

OUTPUT
Code:

LOW-VALUES" and "Z (PACKED NON-INTEGER)" did not follow the "MOVE" statement compatibility rules.  The statement was discarded.
Z (PACKED NON-INTEGER)" was compared with "SPACES".  The comparison was discarded.
Z (PACKED NON-INTEGER)" was compared with "LOW-VALUES".  The comparison was discarded.

_________________
Shekar
Grow Technically
Back to top
View user's profile Send private message
digitalnirmal
Beginner


Joined: 06 Dec 2005
Posts: 21
Topics: 10

PostPosted: Tue Jun 13, 2006 6:21 am    Post subject: Reply with quote

@Jaya
I need to initialize all those COMP-3 fieleds from an IMS DB to ZEROS which are either SPACES or LOW-VALUES.
For this, i need to be able to distinguish them
Back to top
View user's profile Send private message
calspach
Beginner


Joined: 12 Jun 2006
Posts: 5
Topics: 0

PostPosted: Tue Jun 13, 2006 8:05 am    Post subject: Reply with quote

Would it be safe to say that if they aren't numeric they need to be initialized?

If so, you can code

IF Z NUMERIC
CONTINUE
ELSE
MOVE 0 TO Z.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group