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

Delete file row if blanks in the first 3 cols


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

New User


Joined: 04 Oct 2022
Posts: 1
Location: United Kingdom

PostPosted: Fri Oct 14, 2022 4:06 pm
Reply with quote

Hi All,

Can you please help me out with one query.

I have a file with 4 columns delimited by '|' with rows having duplicates at position 55 to 59 (the last column)

So I want to checks the rows for matching field at the last columns (12345=12345) and delete the row with blanks in the First 3 columns
Example:

aaa|bbb|ccc|12345
|||12345
xxx|yyy|zzz|55544


When I try sorting the file from columns 55 to 59 it gives me error that Sorting starts from 1 position. How can I check for the above mentioned scenario. Please advise.
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


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

PostPosted: Fri Oct 14, 2022 4:40 pm
Reply with quote

Use code tag button when presenting code/data here. What have you tried yourself? Post error messages and such things you might have got. Thanks!
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2012
Location: USA

PostPosted: Fri Oct 14, 2022 4:44 pm
Reply with quote

Megha Kaushik wrote:
Hi All,

Can you please help me out with one query.

I have a file with 4 columns delimited by '|' with rows having duplicates at position 55 to 59 (the last column)

So I want to checks the rows for matching field at the last columns (12345=12345) and delete the row with blanks in the First 3 columns
Example:

aaa|bbb|ccc|12345
|||12345
xxx|yyy|zzz|55544


When I try sorting the file from columns 55 to 59 it gives me error that Sorting starts from 1 position. How can I check for the above mentioned scenario. Please advise.

First of all, learn how to use the Code button:
Code:
aaa|bbb|ccc|12345
|||12345
xxx|yyy|zzz|55544

Next, copy here everything of:

1) your input data (using Code button!) including the description of dataset attributes
2) your own used code (using Code button!)
3) your desired output data (using Code button!)
4) your actual output data (using Code button!)
5) all and every error message, and/or error code you get (using Code button!)

Otherwise you may continue posting your messages forever, if you prefer doing so.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3049
Location: NYC,USA

PostPosted: Fri Oct 14, 2022 5:55 pm
Reply with quote

Welcome!
Use parse to either do sort or remove dups .
www.ibm.com/docs/en/zos/2.3.0?topic=fields-parse-parameters icon_cool.gif
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


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

PostPosted: Sat Oct 15, 2022 11:23 am
Reply with quote

Code:
OPTION COPY                                       
OMIT COND=(1,79,SS,RE,C'^[ ]*\|[ ]*\|[ ]*\|12345')
END

will eliminate the line with blanks or empty content in the first three columns when fourth column is equal to "12345"

As others have mentioned, please take note of their advice and provide more data to make it easier for us to help you in the future.
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


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

PostPosted: Sat Oct 15, 2022 12:42 pm
Reply with quote

Update: Use CP 1047 for the Regular Expression, otherwise it will not properly work.
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 How to split large record length file... DFSORT/ICETOOL 10
No new posts DELETE SPUFI DB2 1
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts DSNTIAUL driven delete IBM Tools 0
Search our Forums:

Back to Top