IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Remove commas from specific positions in a file


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
shreya19

New User


Joined: 13 Mar 2014
Posts: 34
Location: USA

PostPosted: Wed May 05, 2021 8:36 pm
Reply with quote

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
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Wed May 05, 2021 9:09 pm
Reply with quote

Can you please show the sample value from input?

Sample reference here

ibmmainframes.com/about51021.html
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1245
Location: Bamberg, Germany

PostPosted: Wed May 05, 2021 9:17 pm
Reply with quote

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
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2018
Location: USA

PostPosted: Wed May 05, 2021 9:46 pm
Reply with quote

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
View user's profile Send private message
shreya19

New User


Joined: 13 Mar 2014
Posts: 34
Location: USA

PostPosted: Wed May 05, 2021 9:53 pm
Reply with quote

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
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1245
Location: Bamberg, Germany

PostPosted: Wed May 05, 2021 9:54 pm
Reply with quote

Yes, you are right. SFF is the better choice here.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2018
Location: USA

PostPosted: Wed May 05, 2021 9:55 pm
Reply with quote

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
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1245
Location: Bamberg, Germany

PostPosted: Wed May 05, 2021 10:01 pm
Reply with quote

Another option to remove the comma could be using SQZ with option PREBLANK.
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Wed May 05, 2021 10:04 pm
Reply with quote

I am assuming it is fields are fixed why not use FINDREP
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2018
Location: USA

PostPosted: Wed May 05, 2021 11:34 pm
Reply with quote

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 icon_biggrin.gif
Back to top
View user's profile Send private message
shreya19

New User


Joined: 13 Mar 2014
Posts: 34
Location: USA

PostPosted: Wed May 05, 2021 11:40 pm
Reply with quote

SQZ preblanks worked perfectly fine as I just wanted to remove commas.. thank you very much!
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 1
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top