Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Getting junk values in fields copied from COMP-3

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Getting junk values in fields copied from COMP-3
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    Post subject: Re: Getting junk values in fields copied from COMP-3
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    Post subject: Re: Getting junk values in fields copied from COMP-3
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    Post subject: Re: Getting junk values in fields copied from COMP-3
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Check Binary Values for symbols gandikk CA Products 3 Tue Mar 21, 2017 5:11 am
No new posts To display values of multiple rows in... vinu78 DB2 2 Thu Mar 09, 2017 1:20 pm
No new posts DFSORT MUL FIELDS tspr52 DFSORT/ICETOOL 16 Fri Mar 03, 2017 11:53 pm
No new posts Replacing same string with different ... vickey_dw DFSORT/ICETOOL 6 Wed Feb 22, 2017 10:44 pm
No new posts setting new limit Key values for inde... srilata83 DB2 1 Fri Feb 10, 2017 9:24 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us