David,
It appears from the query output (COMM-A = 0005000000{) that the data is not PACKED, but ZONED (type Z?). In any event, the error in COBOL Is that the source of the MOVE isn't what it's expecting. You might look into the ON ERROR statement of the MOVE and see if you could try a cascading sort of:
MOVE xxx TO F-xxx ON ERROR PERFORM ATTEMP-2
ATTEMPT-2
MOVE redefined-xxx to F-xxx ON ERROR PERFORM ATTEMP-3
ATTEMP-3
MOVE redefined-again-xxx to F-xxx ON ERROR ...
I seem to recall this would work for NUMERIC overflows. Not sure about ILLEGAL DECIMAL errors.
The only other choices are: (assuming it's Native mode):
1) Remove the $VALIDATE from compile options (not recommended)
2) Set the COBRUNTIME variable to IGNORE Illegal Decimal Errors (see the COBOL Programmer's guide chapter 7 (handling TRAPS)).
If it's Compatibility mode program (i.e. CODE=PROG), then I think you're stuck. You can't turn off or ignore the message. Maybe the ON ERROR stuff would work.
Rich
Rich Trapp <mailto:[log in to unmask]>
Consulting for Agilent Technologies, Loveland, Colorado.
Managed Business Solutions <http://www.mbsnav.com/>
200 South College Avenue
Fort Collins, Colorado 80524-2811
970.679.2221 (voice)
970.669.3071 (fax)
-----Original Message-----
From: David Rutherford [mailto:[log in to unmask]]
Sent: Thursday, August 15, 2002 12:23 PM
To: [log in to unmask]
Subject: Cobol Ilegal Decimal digits...
I am having trouble reading PACKED data items with my Cobol program.
Allow me to give a little background...
Query listing of Data Items being read by the program...
COMM-A =0005000000{
COMM-B =0000000000{
COMM-C =00000000000
As you can see, the Query listing correctly shows the 'A' and the 'B' as
'proper' packed items. For some reason (which I'm not worried about at
the moment), the 'C' record is being displayed as a '0', rather than a
'+0'.
Now that is the data I want to read, here's how I've coded my Cobol
program...
File section...
03 F2-COMM-A-001 PIC -9(03).9(8).
03 F2-COMM-B-001 PIC -9(03).9(8).
03 F2-COMM-C-001 PIC -9(03).9(8).
Working storage database definition...
03 WDB1-COMM-A-001 PIC S9(03)V9(8) COMP-3 VALUE 0.
03 WDB1-COMM-B-001 PIC S9(03)V9(8) COMP-3 VALUE 0.
03 WDB1-COMM-C-001 PIC S9(03)V9(8) COMP-3 VALUE 0.
Now the procedure division...
MOVE WDB1-COMM-A-001 TO F2-COMM-A-001.
MOVE WDB1-COMM-B-001 TO F2-COMM-B-001.
MOVE WDB1-COMM-C-001 TO F2-COMM-C-001.
The moves for 'A' and 'B' work fine, but the move for 'C' causes the
program to abort with an 'illegal DECIMAL digit' error.
Now I realise the best option here is to correct the data in the
database, but that is not an option open to me. Is there a way I can I
give a different definition of the data items in my Cobol program or is
there a particular statement associated with the 'move' that I can use
so that the move doesn't actually cause the program to abort?
Please post any replies to the list, rather than just to me. Thankyou in
advance for your help.
D.
* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
|