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

Convert Numeric Edited to Numeric.


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

New User


Joined: 01 Nov 2006
Posts: 3

PostPosted: Fri Nov 03, 2006 12:28 pm
Reply with quote

I'll explain the query with an example.
xxx,xxx,xxx.xx to be moved into 999999999.99.
This is for computation. So while computing numeric value is stated invalid.
Help me on this.
Back to top
View user's profile Send private message
UmeySan

Active Member


Joined: 22 Aug 2006
Posts: 771
Location: Germany

PostPosted: Fri Nov 03, 2006 2:46 pm
Reply with quote

Hi !

I guess that TTT,TTT,TTT.xx is in a PIC-X Field.

Then you just could use 3 Moves with offset & length to move the data
to an other working field. then move this to your numeric or comp-field to do the computing.

MOVE FIELD (01:03) to WRKFLD (01:03)
MOVE FIELD (05:03) to WRKFLD (04:03) ...and so on

You also could use UNSTRING to separate the Field into 3 workingfields,
which are belonging to a 01 level. Then move that one to a comp field.

Plse correct me if I'm wrong
Regards, UmeySan
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Fri Nov 03, 2006 7:40 pm
Reply with quote

Quote:
TTT,TTT,TTT.xx to be moved into 999999999.99.



both fields are x-type, containing alpha characters (, and .).

For computation, you need to define a numeric field and load it with the numeric value of TTT,TTT,TTT.xx.

new-field PIC S9(9)V9(2).

use NUMVAL or NUMVAL-C.
Back to top
View user's profile Send private message
DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Fri Nov 03, 2006 9:41 pm
Reply with quote

Try this

Code:

01  CHAR1         PIC X(14)           VALUE '123,456,789.98'.   
01  VALUE1 REDEFINES CHAR1 PIC 999,999,999.99.                 
01  VALUE2        PIC 9(9)V9(2).                               
01  VALUE3        PIC 9(9).9(2).
                               
    MOVE VALUE1 TO VALUE2, VALUE3.                 
    DISPLAY VALUE1 ' ' VALUE2 ' ' VALUE3.


result

Code:

.SARPAGE 4                                 
.                                           
.123,456,789.98 12345678998 123456789.98   


Dave
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 Issues Converting From ZD to Signed N... DFSORT/ICETOOL 4
No new posts Need to convert date format DFSORT/ICETOOL 20
No new posts Keep leading zero(s) after convert fl... SYNCSORT 7
No new posts Convert single row multi cols to sing... DFSORT/ICETOOL 6
No new posts convert file from VB to FB and use tr... DFSORT/ICETOOL 8
Search our Forums:

Back to Top