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

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


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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
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
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: 8696
Location: Dubuque, Iowa, USA

PostPosted: Wed Mar 02, 2011 7:33 pm
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
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
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
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
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
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
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 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 How to move DB2 Installation HLQ DB2 4
No new posts How to move values from single dimens... COBOL Programming 1
No new posts Reading the CSV data in COBOL and mov... COBOL Programming 4
Search our Forums:

Back to Top