Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search Memberlist Usergroups Profile Log in to check your private messages Log in
 
how to move comp value to comp-3?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe COBOL
Author Message
morfius9
Warnings : 1

New User


Joined: 22 Feb 2006
Posts: 20

PostPosted: Mon May 12, 2008 12:00 pm    Post subject: how to move comp value to comp-3?
Reply with quote

Hi,
I am trying to move a numeric value in a comp field to a comp - 3 field. But i end up with spaces in the X(16) redefines for the comp - 3 field. Why is that so?

B1 PIC 9(16) COMP.
B2 PIC 9(15) COMP-3.
b3 redefines b2 pic X(08).

MOVE B1 to B2.
display B3
Back to top
View user's profile Send private message
References
dick scherrer

Global Moderator


Joined: 23 Nov 2006
Posts: 8724
Location: 221 B Baker St

PostPosted: Mon May 12, 2008 12:07 pm    Post subject:
Reply with quote

Hello,

What you have coded makes no "cobol" sense. A comp-3 field is not displayable as an X field - by design.

If you want to display the B2 comp-3 field, simply display it
Code:
DISPLAY B2
Back to top
View user's profile Send private message
morfius9
Warnings : 1

New User


Joined: 22 Feb 2006
Posts: 20

PostPosted: Mon May 12, 2008 12:57 pm    Post subject: Reply to: how to move comp value to comp-3?
Reply with quote

Hi DS,
I want to display the HEX value in the 9(16) comp-3 field .

e.g. if the number is stored as 6CBF in hex inside the 9(16) comp-3, i want to display 6CBF and not the number on a CICS screen. Is it possible?
Back to top
View user's profile Send private message
Atul Tamboli

New User


Joined: 12 May 2008
Posts: 4
Location: Pune, India

PostPosted: Mon May 12, 2008 6:03 pm    Post subject:
Reply with quote

If you move the comp-3 field into the numeric field, the actual number can be displayed using numberic field. In your case say you do-

Define ==> B4 PIC 9(15).

MOVE B2 to B4
DISPLAY B4

You should get a readable number in output.
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1001
Location: Virginia, USA

PostPosted: Mon May 12, 2008 6:22 pm    Post subject:
Reply with quote

Cobol does not have a way to display data in hex. Converting data to hex display is something you have to do yourself. Check with the more experienced programmers on your project and see if they have a routine for doing that.
    Back to top
    View user's profile Send private message
    CICS Guy

    Senior Member


    Joined: 18 Jul 2007
    Posts: 1199
    Location: At my desk

    PostPosted: Mon May 12, 2008 6:29 pm    Post subject: Re: Reply to: how to move comp value to comp-3?
    Reply with quote

    morfius9 wrote:
    if the number is stored as 6CBF in hex inside the 9(16) comp-3, i want to display 6CBF and not the number on a CICS screen. Is it possible?
    6CBF is not numeric in a comp-3 field, did you mean the comp field?
    6CBF binary is 27839 decimal.
    There have been several threads on converting to a display form of hex values.....
    Try Display Hexadecimal Value in Cobol Program....
    Back to top
    View user's profile Send private message
    mmwife

    Super Moderator


    Joined: 30 May 2003
    Posts: 1506

    PostPosted: Tue May 13, 2008 6:04 pm    Post subject:
    Reply with quote

    morfius9,

    You can also do the following:

    When looking at sysout (I assume you're using SDSF) use SE in the left side cmd line. Locate your comp-3 field then enter HEX in the top cmd line.

    This will show you the nibbles of the displayed field.

    I usually display fields using DISPLAY ' >' MY-COMP-3 '< '. It let's me know where the displayed data is on the line.
    Back to top
    View user's profile Send private message
    Display posts from previous:   
    Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe COBOL All times are GMT + 6 Hours
    Page 1 of 1