View previous topic :: View next topic |
Author |
Message |
tniast Beginner
Joined: 08 Sep 2004 Posts: 3 Topics: 2
|
Posted: Thu Sep 09, 2004 9:48 am Post subject: converting char field to comp field(s9(9)) |
|
|
A small change to my previous question. I meant how to convert Char to comp. Please advise |
|
Back to top |
|
|
programmer1 Beginner
Joined: 18 Feb 2004 Posts: 138 Topics: 14
|
Posted: Thu Sep 09, 2004 10:04 am Post subject: |
|
|
tniast,
Simply move the Char variable to a Numeric variable and then this Numeric variable into a Comp variable.
Else, you can use a Redefine. _________________ Regards,
Programmer |
|
Back to top |
|
|
tniast Beginner
Joined: 08 Sep 2004 Posts: 3 Topics: 2
|
Posted: Thu Sep 09, 2004 10:09 am Post subject: |
|
|
This char variable might contain -ve value(for example -23) ? |
|
Back to top |
|
|
Dibakar Advanced
Joined: 02 Dec 2002 Posts: 700 Topics: 63 Location: USA
|
Posted: Sat Sep 11, 2004 1:57 am Post subject: |
|
|
Yesterday I had similar problem. Sign was at end, blank or space. Where input was like " 992.20 "
My sending field was X(11). I defined receiving as "S9(7)V9(2) SIGN TRAILING SEPARATE".
In sending field I replaced leading spaces by zeroes and trailing space by "+" using inspect verb.
I broke both sending and receiving fields into subfields - dollar, cents and sign (and filler in sending field).
Did a "MOVE CORR ..."
Hope I didn't miss out anything |
|
Back to top |
|
|
vara prasad Beginner
Joined: 01 May 2003 Posts: 2 Topics: 0
|
Posted: Mon Sep 13, 2004 5:53 am Post subject: |
|
|
In these type of cases, where a edited numeric fields to be converted to numeric fields, need to take care of following.
1. Fix up the sign position.
2. Know the max positions before and after decimal point.
3. Moving digits before decimal and after decimal to corresponding fields declared.
4. Using above 3, arrive a signed numeric field, which you can move to a comp variable. _________________ Thanks & Regards,
Vara Prasad. |
|
Back to top |
|
|
|
|