Omit the data



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

Omit the data

Postby mvmanish » Mon Mar 14, 2016 12:51 pm

As per my JCL. the output looks like below. Here i want to omit the data that comes after numeric digits(omit the all data starts from "FOR')
2895 FOR TABLE DBOW
82374 FOR TABLE    
68657 FOR TABLE    
896 FOR TABLE      
251 FOR TABLE      
34772 FOR TABLE DBO
32534 FOR TABLE    
118582 FOR TABLE  
230569 FOR TABLE  
3031 FOR TABLE DBOW
mvmanish
 
Posts: 10
Joined: Fri Mar 11, 2016 1:25 am
Has thanked: 1 time
Been thanked: 0 time

Re: Omit the data

 

Re: Omit the data

Postby Aki88 » Mon Mar 14, 2016 1:21 pm

Hello,

Look up PARSE function of DFSORT in the 'DFSORT Application Programming Guide'.
Few assumptions before the solution, since you have not specified the length of the 'number' that can appear before 'FOR', I have assumed that there can be 50 characters at maximum before 'FOR' appears. Next, you have not specified if the input file is fixed length or variable, I have assumed it to be of fixed length. You have not shown the expected output, I have assumed that the output looks something as below:


Expected output:

2895  
82374  
68657  
896    
251    
34772  
32534  
118582
230569
3031  
 


A quick and dirty solution:


 SORT FIELDS=COPY                            
 INREC PARSE=(%01=(ENDBEFR=C'FOR',FIXLEN=50)),
         BUILD=(1:%01)                        
 


Hth.
Aki88
 
Posts: 338
Joined: Tue Jan 28, 2014 1:52 pm
Has thanked: 32 times
Been thanked: 31 times

Re: Omit the data

Postby BillyBoyo » Mon Mar 14, 2016 3:18 pm

One small point, which is that there is a blank before the FOR. ENDBEFR=C' FOR' or simply ENDBEFF=BLANK will do. It won't matter for the result of fixed-length output, but someone looking at the code later may wonder about that blank, so don't give them an opportunity to wonder :-)
BillyBoyo
Global moderator
 
Posts: 3795
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 259 times

Re: Omit the data

Postby mvmanish » Mon Mar 14, 2016 3:54 pm

Hi Aki88,

The data which i posted is the output of sort jcl. My input file is VBA.There are 73 characters before "FOR". Only 10 characters after "FOR". I want to eliminate the characters after "FOR" in my output. I'm using include condition in my JCL.
mvmanish
 
Posts: 10
Joined: Fri Mar 11, 2016 1:25 am
Has thanked: 1 time
Been thanked: 0 time

Re: Omit the data

Postby BillyBoyo » Mon Mar 14, 2016 5:04 pm

Well, you apply Aki88's solution to your data. You can't use INCLUDE for this, INCLUDE/OMIT COND and INCLUDE=/OMIT= operate at the record level.

SORT FIELDS=COPY                            
 INREC PARSE=(%01=(ENDBEFR=C' FOR',FIXLEN=73)),
         BUILD=(1,4,%01)
 OUTFIL VLTRIM=C' '


The PARSE pads up to 73 bytes, the VLTRIM=C' ' will chop off the trailing blanks for the final output, automatically adjusting the record-length.
BillyBoyo
Global moderator
 
Posts: 3795
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 259 times

Re: Omit the data

Postby Aki88 » Mon Mar 14, 2016 5:09 pm

Hello Billy,

I second your point :)

Thank you.
Aki88
 
Posts: 338
Joined: Tue Jan 28, 2014 1:52 pm
Has thanked: 32 times
Been thanked: 31 times


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post