View previous topic :: View next topic
|
Author |
Message |
shreya19
New User
Joined: 13 Mar 2014 Posts: 34 Location: USA
|
|
|
|
I have comma separated file of length 200.
Want to remove commas only from amount fields and want to preserve comma separators.
Amount fields are at position 90, 105 and 145 each of length 10.
Please help |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
Back to top |
|
|
Joerg.Findeisen
Senior Member
Joined: 15 Aug 2015 Posts: 1245 Location: Bamberg, Germany
|
|
|
|
Use PARSE to split the record, then UFF on the separated fields where you want to remove the comma and rebuild the record as needed. |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2018 Location: USA
|
|
|
|
Joerg.Findeisen wrote: |
Use PARSE to split the record, then UFF on the separated fields where you want to remove the comma and rebuild the record as needed. |
1) When all the positions of fixed-length fields are known, no PARSE is needed.
2) For amount fields I’d recommend to use format SFF rather than UFF. Otherwise one might be surprised when some debits are converted to credits, or vice versa.
3) A “file” cannot be “of length 200”. To say nothing that no files do exist in mainframes. |
|
Back to top |
|
|
shreya19
New User
Joined: 13 Mar 2014 Posts: 34 Location: USA
|
|
|
|
I tried SFF, it removes decimals as well and adds leading zeros on using M11 format. Any suggestions on the format to be used in this case? |
|
Back to top |
|
|
Joerg.Findeisen
Senior Member
Joined: 15 Aug 2015 Posts: 1245 Location: Bamberg, Germany
|
|
|
|
Yes, you are right. SFF is the better choice here. |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2018 Location: USA
|
|
|
|
shreya19 wrote: |
I tried SFF, it removes decimals as well and adds leading zeros on using M11 format. Any suggestions on the format to be used in this case? |
You can use millions of possible formats described in details in any SORT manual. Choose whatever you like.
Hint: the most flexible format can be specified via EDIT= parameter. Or any other way is also acceptable. Just read the manual before asking questions. |
|
Back to top |
|
|
Joerg.Findeisen
Senior Member
Joined: 15 Aug 2015 Posts: 1245 Location: Bamberg, Germany
|
|
|
|
Another option to remove the comma could be using SQZ with option PREBLANK. |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
I am assuming it is fields are fixed why not use FINDREP |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2018 Location: USA
|
|
|
|
Joerg.Findeisen wrote: |
Another option to remove the comma could be using SQZ with option PREBLANK. |
The values might be as different as
Code: |
+123,456.78
-98,765.43
$1,234.56
-$9,876.54
$81,234.56-
(19,283.76)
Etc. |
SFF is the best choice when working with amounts. Especially - with amounts of money |
|
Back to top |
|
|
shreya19
New User
Joined: 13 Mar 2014 Posts: 34 Location: USA
|
|
|
|
SQZ preblanks worked perfectly fine as I just wanted to remove commas.. thank you very much! |
|
Back to top |
|
|
|