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
 

 

move 9(7)v99 to 9(7).99

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
ammuthan_ss

New User


Joined: 09 Dec 2003
Posts: 3
Location: chennai

PostPosted: Wed Mar 02, 2011 4:42 pm    Post subject: move 9(7)v99 to 9(7).99
Reply with quote

I am trying to move data value 9(7)v99 to 9(7).99.
but when the move happens the value 000001992 moved as 0000000.19.
isn't that should come as 0000019.92. i want the value like this only.
please help.
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


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

PostPosted: Wed Mar 02, 2011 5:12 pm    Post subject:
Reply with quote

provide a cut&paste version of your
  • data element definitions
  • your procedural statements used to populate the receiving field.


yes, it should work, but obviously you have defined something incorrectly.
or your data mapping of the input data is incorrect.
Back to top
View user's profile Send private message
valyk

Active User


Joined: 16 Apr 2008
Posts: 104
Location: South Carolina

PostPosted: Wed Mar 02, 2011 7:20 pm    Post subject:
Reply with quote

It looks like there must be another numeric field before this field and it is defined incorrectly.

ie:
Code:
            05  NUM-FIELD1                  PIC 9(5).
            05  NUM-FIELD2                  PIC 9(7)V99.


NUM-FIELD1 is defined as 5, but should be 7. and it is throwing off your placement by two bytes.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7913
Location: Bellevue, IA

PostPosted: Wed Mar 02, 2011 7:33 pm    Post subject:
Reply with quote

valyk, there also could be a REDEFINES issue ... or an intermediate variable is being used .... or etc etc. Without actually seeing the data definitions, we cannot predict what the precise problem is.

Furthermore, it is not at all clear how your "solution" resolves the problem, since (1) nobody knows if a group move is being used, which would be required for your "solution" to work, and (2) your "solution" would shift the data 2 bytes to the LEFT, not RIGHT, so the output value would be 1992.00 instead of 0.19 -- not quite the same.
Back to top
View user's profile Send private message
valyk

Active User


Joined: 16 Apr 2008
Posts: 104
Location: South Carolina

PostPosted: Wed Mar 02, 2011 7:44 pm    Post subject:
Reply with quote

I was just thinking in a simplistic scenario, reading an input field and moving to output. But, you're right, I went the wrong way with my example.
Back to top
View user's profile Send private message
ammuthan_ss

New User


Joined: 09 Dec 2003
Posts: 3
Location: chennai

PostPosted: Wed Mar 02, 2011 8:12 pm    Post subject:
Reply with quote

dbzTHEdinosauer wrote:
provide a cut&paste version of your
  • data element definitions
  • your procedural statements used to populate the receiving field.


yes, it should work, but obviously you have defined something incorrectly.
or your data mapping of the input data is incorrect.


03 PRICE PIC s9(007)V99 COMP-3. (this comes from file)
01 WS-TOTALDEBIT PIC 9(7)v99.
01 WS-TOTALDEBIT-1 PIC 9(7).99.

ADD PRICE TO WS-TOTALDEBIT
MOVE WS-TOTALDEBIT TO WS-TOTALDEBIT-1
Back to top
View user's profile Send private message
Kjeld

Active User


Joined: 15 Dec 2009
Posts: 365
Location: Denmark

PostPosted: Wed Mar 02, 2011 8:15 pm    Post subject:
Reply with quote

Also check the explicit or implicit (default) DECIMAL POINT IS statement. It could affect the outcome of your move if it is set to COMMA, not to PERIOD as you may have presumed.
Back to top
View user's profile Send private message
valyk

Active User


Joined: 16 Apr 2008
Posts: 104
Location: South Carolina

PostPosted: Wed Mar 02, 2011 8:19 pm    Post subject:
Reply with quote

ammuthan_ss wrote:
dbzTHEdinosauer wrote:
provide a cut&paste version of your
  • data element definitions
  • your procedural statements used to populate the receiving field.


yes, it should work, but obviously you have defined something incorrectly.
or your data mapping of the input data is incorrect.


03 PRICE PIC s9(007)V99 COMP-3. (this comes from file)
01 WS-TOTALDEBIT PIC 9(7)v99.
01 WS-TOTALDEBIT-1 PIC 9(7).99.

ADD PRICE TO WS-TOTALDEBIT
MOVE WS-TOTALDEBIT TO WS-TOTALDEBIT-1


Add a display for PRICE. Make sure your input data is really what you think it is.
Back to top
View user's profile Send private message
ammuthan_ss

New User


Joined: 09 Dec 2003
Posts: 3
Location: chennai

PostPosted: Thu Mar 03, 2011 11:49 am    Post subject:
Reply with quote

Kjeld wrote:
Also check the explicit or implicit (default) DECIMAL POINT IS statement. It could affect the outcome of your move if it is set to COMMA, not to PERIOD as you may have presumed.


Yes. I have this in my program.
SPECIAL-NAMES.
DECIMAL-POINT IS COMMA.
after commenting them out my proggram works fine.
Thanks so much for your help...
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Thu Mar 03, 2011 12:18 pm    Post subject:
Reply with quote

I would suggest changing your edit mask, instead of removing the special names clause.

but that depends on if the program is for a country that uses comma instead of decimal.

you can use Language Environment routines to edit monetary fields, allowing the local/regional settings to control, and then you don't have to play with the 'is this output supposed tobe a comma or decimal point'.
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
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
No new posts how to move view the remote file in o... mailtoashok CICS 2 Fri Feb 12, 2016 1:07 pm


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