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
 

 

Convert Numeric Edited to Numeric.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Convert Numeric Edited to Numeric.
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: 755
Location: Germany

PostPosted: Fri Nov 03, 2006 2:46 pm    Post subject:
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: 6967
Location: porcelain throne

PostPosted: Fri Nov 03, 2006 7:40 pm    Post subject: Re: Convert Numeric Edited to Numeric.
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    Post subject: Re: Convert Numeric Edited to Numeric.
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    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
No new posts Validate date and numeric fields and ... Rick Silvers DFSORT/ICETOOL 6 Thu May 11, 2017 6:51 pm
No new posts Convert current to hex value gopurs DFSORT/ICETOOL 4 Wed Feb 15, 2017 5:40 am
No new posts Converting decimal to numeric using I... Balaryan DFSORT/ICETOOL 4 Thu Feb 02, 2017 11:27 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts Convert +9999999999999.99 to S9(12)V9(3) vnktrrd DFSORT/ICETOOL 8 Thu Nov 17, 2016 8:15 pm


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