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
 

 

how to move comp value to comp-3?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    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

dick scherrer

Site Director


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

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: 27

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: 3
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: 1512
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: 2150
    Location: At my coffee table

    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: 1592

    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
    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
    This topic is locked: you cannot edit posts or make replies. How to move a long alphanumeric data ... lind sh COBOL Programming 8 Mon Dec 05, 2016 7:51 pm
    No new posts Protection Exception while move 0 to ... Kevin Vaz CICS 10 Tue Oct 18, 2016 4:19 pm
    No new posts How can we create a flat file in JAVA... rakesh.v18 Java & MQSeries 7 Fri Sep 23, 2016 10:46 pm
    This topic is locked: you cannot edit posts or make replies. Alphanumeric to Numeric move on UNIX mistah kurtz COBOL Programming 16 Wed Jul 27, 2016 8:47 pm
    No new posts Need information on COBOL MOVE CORRES... subratarec COBOL Programming 10 Tue Jun 28, 2016 10:38 pm


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