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

how to move comp value to comp-3?


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

New User


Joined: 22 Feb 2006
Posts: 27

PostPosted: Mon May 12, 2008 12:00 pm
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
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon May 12, 2008 12:07 pm
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: 27

PostPosted: Mon May 12, 2008 12:57 pm
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: 3
Location: Pune, India

PostPosted: Mon May 12, 2008 6:03 pm
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: 1512
Location: Virginia, USA

PostPosted: Mon May 12, 2008 6:22 pm
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: 2146
    Location: At my coffee table

    PostPosted: Mon May 12, 2008 6:29 pm
    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: 1592

    PostPosted: Tue May 13, 2008 6:04 pm
    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
    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 COBOL - Move S9(11)v9(7) COMP-3 to -(... COBOL Programming 5
    No new posts How to move the first field of each r... DFSORT/ICETOOL 5
    No new posts Converting ASCII values to COMP-3 (ZD... JCL & VSAM 2
    No new posts Interviewers are surprised with my an... Mainframe Interview Questions 6
    No new posts How to move DB2 Installation HLQ DB2 4
    Search our Forums:

    Back to Top