IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Getting junk values in fields copied from COMP-3


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
karthikraman_m

New User


Joined: 10 Jun 2005
Posts: 12
Location: India

PostPosted: Fri Nov 10, 2006 5:46 pm
Reply with quote

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
View user's profile Send private message
akatekar

New User


Joined: 17 Oct 2006
Posts: 7
Location: India

PostPosted: Fri Nov 10, 2006 8:10 pm
Reply with quote

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
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri Nov 10, 2006 10:15 pm
Reply with quote

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
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri Nov 10, 2006 10:17 pm
Reply with quote

or use the reference provided by the copybook instead of the silly reference modification.
Back to top
View user's profile Send private message
karthikraman_m

New User


Joined: 10 Jun 2005
Posts: 12
Location: India

PostPosted: Sat Nov 11, 2006 6:53 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Null values are considered in Total c... DFSORT/ICETOOL 6
No new posts COBOL - Move S9(11)v9(7) COMP-3 to -(... COBOL Programming 5
Search our Forums:

Back to Top