Tom,
I have one program that takes raw data out of a comma delimted file, in which a few of the fields are decimal such as field1, field2,..,..,166.00,...,...
One of my cobol programs reads in this data and stores in a DB with the following as its field definition. I have "this" labelled to the left of the field that is holding the 166.00 data brought in by csv file above. CUSTDB-FILE is an indexed file.
This is in Program "MAKECUSTDB"
FD CUSTDB-FILE.
01 CUST-RECORD.
02 CUST-PRIME-KEY PIC 9(11).
02 CUST-FIELDS.
03 CUST-LASTNAME PIC X(30).
03 CUST-FIRSTNAME PIC X(30).
03 CUST-MIDDLE-INITL PIC X(1).
03 CUST-PIN PIC 9(4).
03 CUST-BIRTHDATE PIC X(10).
03 CUST-SSN PIC 9(9).
03 CUST-ADDRESS1 PIC X(30).
03 CUST-ADDRESS2 PIC X(30).
03 CUST-CITY PIC X(30).
03 CUST-STATE PIC X(2).
03 CUST-ZIP PIC X(10).
03 CUST-PHONE PIC X(12).
03 CUST-LICENSE PIC X(14).
03 CUST-LICENSE-ST PIC X(2).
03 CUST-LICENSE-EXP PIC X(10).
03 CUST-GENDER PIC X(1).
03 CUST-RACE PIC X(15).
03 CUST-HAIR PIC X(3).
03 CUST-EYES PIC X(3).
03 CUST-HEIGHT PIC X(4).
03 CUST-WEIGHT PIC 9(3).
03 CUST-MAIDEN-NAME PIC X(30).
03 CUST-SPOUSE-NAME PIC X(30).
03 CUST-LIMIT PIC 9(6).
03 CUST-CASH-CK-SW PIC X(1).
03 CUST-STORE-ID PIC X(6).
03 CUST-OPEN-DATE PIC 9(8).
03 CUST-DATE-LAST PIC 9(8).
03 CUST-CHECK-TYPE PIC X(4).
03 CUST-WAIVE-CHRG-SW PIC X(1).
03 CUST-REQUIRE-APPR-SW PIC X(1).
this 03 CUST-AVGCHK-SIZE PIC S9(6)V9(2).
03 CUST-NBRCHK-CSHED PIC 9(7).
&this 03 CUST-AVGCHK-SIZE-P PIC S9(6)V9(2).
03 CUST-NBRCHK-CSHED-P PIC 9(7).
03 CUST-HISTORY-ID PIC 9(11).
03 CUST-FIELD-CHNG-SEC PIC X(30).
02 FILLER PIC X(200).
Then, in one of my many other cobol programs that will use these fields, possibly performing math calcs on them, possibly just reading them. For now, the following program is the one where I'm simply trying to read it, and spit the record out to a sequential file --> this is where I get a good read, except the field is showing up as 1669000{
I want it to show as 166.00 so that it is formatted well for my Java programmer when he reads this out of a named pipe eventually.
This is in Program "READCUSTDB"
FD CUSTDB-FILE.
01 CUST-RECORD.
02 CUST-PRIME-KEY PIC 9(11).
02 CUST-FIELDS.
...
.. this is the file layout of the file described above which I want to read from and then spit out into a sequential file... Defined exactly as above in the 1st program.
..
03 CUST-LASTNAME PIC X(30).
02 FILLER PIC X(200).
WORKING-STORAGE SECTION.
01 WS-CUST-RECORD.
02 WS-CUST-PRIME-KEY PIC 9(11).
02 WS-CUST-FIELDS.
03 WS-CUST-LASTNAME PIC X(30).
03 WS-CUST-FIRSTNAME PIC X(30).
03 WS-CUST-MIDDLE-INITL PIC X(1).
newwww 03 WS-CUST-PIN PIC 9(4).
03 WS-CUST-BIRTHDATE PIC X(10).
03 WS-CUST-SSN PIC 9(9).
03 WS-CUST-ADDRESS1 PIC X(30).
03 WS-CUST-ADDRESS2 PIC X(30).
03 WS-CUST-CITY PIC X(30).
03 WS-CUST-STATE PIC X(2).
03 WS-CUST-ZIP PIC X(10).
03 WS-CUST-PHONE PIC X(12).
03 WS-CUST-LICENSE PIC X(14).
03 WS-CUST-LICENSE-ST PIC X(2).
03 WS-CUST-LICENSE-EXP PIC X(10).
03 WS-CUST-GENDER PIC X(1).
03 WS-CUST-RACE PIC X(15).
03 WS-CUST-HAIR PIC X(3).
03 WS-CUST-EYES PIC X(3).
03 WS-CUST-HEIGHT PIC X(4).
03 WS-CUST-WEIGHT PIC 9(3).
03 WS-CUST-MAIDEN-NAME PIC X(30).
03 WS-CUST-SPOUSE-NAME PIC X(30).
03 WS-CUST-LIMIT PIC 9(6).
03 WS-CUST-CASH-CK-SW PIC X(1).
03 WS-CUST-STORE-ID PIC X(6).
03 WS-CUST-OPEN-DATE PIC 9(8).
03 WS-CUST-DATE-LAST PIC 9(8).
03 WS-CUST-CHECK-TYPE PIC X(4).
03 WS-CUST-WAIVE-CHRG-SW PIC X(1).
03 WS-CUST-REQUIRE-APPR-SW PIC X(1).
Deebug** 03 WS-CUST-AVGCHK-SIZE PIC S9(6)V9(2).
newwww 03 WS-DECI-NBR-EDITED PIC -(7).9(2).
ne
03 WS-DECI-NBR-EDITED PIC X(8).
03 WS-CUST-NBRCHK-CSHED PIC 9(7).
03 WS-CUST-AVGCHK-SIZE-P PIC S9(6)V9(2).
03 WS-CUST-NBRCHK-CSHED-P PIC 9(7).
03 WS-CUST-HISTORY-ID PIC 9(11).
03 WS-CUST-FIELD-CHNG-SEC PIC X(30).
02 WS-FILLER PIC X(200).
ne
01 WS-DECI-NBR-EDITED PIC -(7).9(2).
MAIN-PROGRAM.
PERFORM A-100-INITIALIZATION.
MOVE 0 TO CUST-CTR.
PERFORM B-100-PROCESS-FILES UNTIL EOF-CUST.
PERFORM C-100-WRAP-UP.
STOP RUN.
A-100-INITIALIZATION.
OPEN INPUT CUSTDB-FILE.
OPEN OUTPUT TEST-CUST.
* FILE PROCRESSING CONTROL
B-100-PROCESS-FILES.
MOVE NEG TO SW-EOF-CUST.
READ CUSTDB-FILE NEXT RECORD
AT END MOVE YES TO SW-EOF-CUST
debug ** DISPLAY "AT END"
debug ** DISPLAY OFAC-ENT-NBR
NOT AT END PERFORM B-200-PROCESS-RECORD
END-READ.
******************************************************************
B-200-PROCESS-RECORD.
MOVE CUST-PRIME-KEY TO WS-CUST-PRIME-KEY.
MOVE CUST-FIELDS TO WS-CUST-FIELDS.
Deebug** DISPLAY WS-CUST-AVGCHK-SIZE LINE 1 POSITION 1.
debug ** DISPLAY WS-DECI-NBR-EDITED LINE 1 POSITION 1.
debug ** DISPLAY WS-DECI-NBR-EDITED LINE 1 POSITION 1.
debug ACCEPT MENU-PROMPT LINE 22 POSITION 1.
coment*****None of the above work!!!!All show as 1669000{
WRITE TEST-CUST-REC FROM WS-CUST-RECORD
debug ** INVALID KEY DISPLAY "FAILED!!!!!"
debug ** MOVE YES TO SW-EOF-CUST
END-WRITE.
******************************************************************
C-100-WRAP-UP.
CLOSE CUSTDB-FILE.
CLOSE TEST-CUST.
Forgive me on the horrible formatting of this - I copied this over and noticed some skewing..
-Thanks.
-David