Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 757
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: 6968
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 File Aid tool to compare numeric data balaji81_k Compuware & Other Tools 2 Tue Sep 26, 2017 3:35 am
No new posts Remove leading spaces from numeric field rexx77 SYNCSORT 6 Wed Sep 06, 2017 2:15 am
No new posts Convert rows and column into JSON for... Dinesh Manivannan DB2 2 Sun Sep 03, 2017 6:50 pm
No new posts Return a Non Numeric value from REXX Learncoholic CLIST & REXX 3 Fri Sep 01, 2017 8:33 pm
No new posts Select numeric portion from CHAR data... balaji81_k DB2 6 Sat Aug 19, 2017 1:51 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us