View previous topic :: View next topic |
Author |
Message |
digitalnirmal Beginner
Joined: 06 Dec 2005 Posts: 21 Topics: 10
|
Posted: Tue Jun 13, 2006 2:24 am Post subject: compare comp-3 field to SPACES/LOW-VALUES |
|
|
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 |
|
 |
Jaya Beginner

Joined: 02 Sep 2005 Posts: 77 Topics: 10 Location: Cincinnati
|
|
Back to top |
|
 |
shekar123 Advanced
Joined: 22 Jul 2005 Posts: 528 Topics: 90 Location: Bangalore India
|
Posted: Tue Jun 13, 2006 6:16 am Post subject: |
|
|
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 |
|
 |
digitalnirmal Beginner
Joined: 06 Dec 2005 Posts: 21 Topics: 10
|
Posted: Tue Jun 13, 2006 6:21 am Post subject: |
|
|
@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 |
|
 |
calspach Beginner
Joined: 12 Jun 2006 Posts: 5 Topics: 0
|
Posted: Tue Jun 13, 2006 8:05 am Post subject: |
|
|
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 |
|
 |
|
|