View previous topic :: View next topic
|
Author |
Message |
balachandra.padiyar
New User
Joined: 01 Nov 2006 Posts: 3
|
|
|
|
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 |
|
|
UmeySan
Active Member
Joined: 22 Aug 2006 Posts: 771 Location: Germany
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
DavidatK
Active Member
Joined: 22 Nov 2005 Posts: 700 Location: Troy, Michigan USA
|
|
|
|
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 |
|
|
|