View previous topic :: View next topic
|
Author |
Message |
karthikraman_m
New User
Joined: 10 Jun 2005 Posts: 12 Location: India
|
|
|
|
Hi
I have a VSAM file which has some COMP-3 fields.
I coded the following in the WS section
Code: |
01 WS-EFF-DATE.
05 FILLER PIC X(01).
05 WS-OBJ-EFF-DATE.
10 WS-EFF-YYYY PIC X(04).
10 WS-EFF-MM PIC X(02).
10 WS--EFF-DD PIC X(02).
01 WS-EFF-DATE-R REDEFINES
WS-EFF-DATE PIC 9(09). |
In the Procedure division, I have statements
Code: |
MOVE INP-VSAM-FILE-RECORD(209:5) TO WS-EFF-DATE-R
DISPLAY 'WS-EFF-DATE-R : ' WS-EFF-DATE-R
DISPLAY 'WS-EFF-DATE : ' WS-EFF-DATE |
The INP-VSAM-FILE-RECORD(209:5) is defined using a copy book as
Code: |
EFF-DATE 9(9) COMP-3 |
The output shown in the spool is junk values.
Code: |
INP-VSAM-FILE-RECORD(209:5) : ../..
WS-EFF-DATE-R: 0000../..
WS-EFF-DATE : 0000../.. |
When i use the HEX format in the spool, I see the correct value(20061211) for the INP-VSAM-RECORD but the other two seems to be different in the 9th nibble. However, I want the actual numeric value (20061211) in the output.
Can someone help me in getting the actual numeric value for the COMP-3 field. I have to move this actual date as standard 8 digit number into an output report file.
Thanks,
Karthik Raman |
|
Back to top |
|
|
akatekar
New User
Joined: 17 Oct 2006 Posts: 7 Location: India
|
|
|
|
Hello Karthik,
Can u try to move to PIC(9) instead of PIC(X) and then do a display of that value? This will help us to debug the issue further.
AK. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
you are a little to clever for your own good. The move with reference modification filled the rightmost five bytes with your data and then zero filled to the left - you did not get a conversion move - unpack - (as the display shows quite clearly).
instead of the receiving field being 9(9) display, make it 9(9) comp-3. then move the comp-3 field to the 9(9) display (to generate the unpack) and there you have it. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
or use the reference provided by the copybook instead of the silly reference modification. |
|
Back to top |
|
|
karthikraman_m
New User
Joined: 10 Jun 2005 Posts: 12 Location: India
|
|
|
|
Thanks for your input friends.
Using the reference in the copybook solved it. The only change i made in the code is
Code: |
MOVE EFF-DATE TO WS-EFF-DATE-R |
instead of
Code: |
MOVE INP-VSAM-FILE-RECORD(209:5) TO WS-EFF-DATE-R |
Thanks a lot.
Karthik Raman |
|
Back to top |
|
|
|