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

moving PICX(10) to PIC 9(4).9(5)


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

New User


Joined: 04 Jul 2007
Posts: 91
Location: Hyderabad

PostPosted: Thu Feb 12, 2009 6:32 pm
Reply with quote

Hello,
My requirement is I have a varibale INV PIC X(10)
And I need to move it OUTV PIC 9(4)V9(5)

Ex :
INV = 1.0000
OUTV= 0001.00000

INV = 1.045
OUTV=0001.04500

Can anyone help me in this.
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


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

PostPosted: Thu Feb 12, 2009 6:54 pm
Reply with quote

Does the data in INV contain an actual decimal "." point, do you want an actual decimal in OUTV?
Back to top
View user's profile Send private message
dp33770

New User


Joined: 04 Jul 2007
Posts: 91
Location: Hyderabad

PostPosted: Thu Feb 12, 2009 7:01 pm
Reply with quote

Yes The data in INV contains an actual decimal ".".
I want that decimal in my output .
as if the INV is 25.678 i want my OUTV as 0025.67800
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Thu Feb 12, 2009 7:13 pm
Reply with quote

UNTESTED:


OUTV must be defined as PIC 9(4).9(5)

requires a new field TEMPV PIC 9(4)V9(5).


COMPUTE TEMPV = NUMVAL(INV)

MOVE TEMPV TO OUTV
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: Thu Feb 12, 2009 8:05 pm
Reply with quote

Hey Dick, wouldn't MOVE NUMVAL(INV) TO OUTV work too?
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Thu Feb 12, 2009 8:43 pm
Reply with quote

It has to be a COMPUTE.
The receiving field can be defined with COMP-3 if you want:
Code:
01  NUMVAL-AREA.                                     
    03 NUMVAL-FROM                PIC X(17).           
    03 NUMVAL-TO                  PIC S9(13)V99 COMP-3.

    MOVE '   +987.65' TO NUMVAL-FROM                 
    DISPLAY 'FROM = {' NUMVAL-FROM '}'               
    COMPUTE NUMVAL-TO = FUNCTION NUMVAL (NUMVAL-FROM)
    DISPLAY '  TO = {' NUMVAL-TO '}'
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Thu Feb 12, 2009 8:45 pm
Reply with quote

CICS Guy,

directly to OUTV (the edit mask) will work. My enterprise compiler does not like the MOVE, but will allow COMPUTE FUNCTION NUMVAL.
.......... I always use compute when I want to move numerics. my thing.
Back to top
View user's profile Send private message
dp33770

New User


Joined: 04 Jul 2007
Posts: 91
Location: Hyderabad

PostPosted: Mon Feb 16, 2009 3:03 pm
Reply with quote

Thanks all
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 Moving Or setting POINTER to another ... COBOL Programming 2
No new posts Moving a COMP-3 Variable to a Numeric... COBOL Programming 2
No new posts Moving a PS file as body of a mail! JCL & VSAM 4
No new posts Moving UDB database to Db2 on z/OS DB2 4
No new posts Moving values to a variable of copybo... COBOL Programming 6
Search our Forums:

Back to Top