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

Help Skipping Records based on Condition - SynSort/ICETOOL


IBM Mainframe Forums -> SYNCSORT
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
nartcr

New User


Joined: 06 Jun 2007
Posts: 83
Location: anada

PostPosted: Fri Aug 22, 2014 2:56 am
Reply with quote

Hello,

I have a requirement to skip certain input records based on condition. I am trying to attain the below through any utilities - ICETOOL/SYNCSORT, however, i do not have clear direction on whether it is possible to achieve the below results.

Given below is sample input file: It contains file header,batch header,Detail records, batch trailer, File trailer.

Code:
1FHEADERCLIENT1
2BHEADERCLIENT1
3DETAIL1CLIENT1
3DETAIL2CLIENT1
3DETAIL3CLIENT1
8BTRAILERCLIENT1
9FTRAILERCLIENT1
1FHEADERCLIENT2
2BHEADERCLIENT2
8BTRAILERCLIENT2
9FTRAILERCLIENT2
1FHEADERCLIENT3
2BHEADERCLIENT3
3DETAIL4CLIENT3
8BTRAILERCLIENT3
9FTRAILERCLIENT3


Whenever, there are file-batch records without detail record, i want these records to be skipped. In short, my output should look like:

Code:
1FHEADERCLIENT1
2BHEADERCLIENT1
3DETAIL1CLIENT1
3DETAIL2CLIENT1
3DETAIL3CLIENT1
8BTRAILERCLIENT1
9FTRAILERCLIENT1
1FHEADERCLIENT3
2BHEADERCLIENT3
3DETAIL4CLIENT3
8BTRAILERCLIENT3
9FTRAILERCLIENT3


Please note that Client 2 records are skipped ( including the batch header and file header ), because there are no corresponding detail records.

Would appreciate if you can suggest any way this could be done using utilities, other than through coding a new program.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Aug 22, 2014 8:08 pm
Reply with quote

WHEN=GROUP for batch header, RECORDS=2 and PUSH the entire header record to an extension of the record.
WHEN=GROUP for detail record, RECORDS=2 and PUSH the detail record ID.

OUTFIL to output the header first when located as an extension of the detail record, then the detail record, using the slash operator (/). Output the batch trailer if marked as containing data records. Out all other records as their original size.
Back to top
View user's profile Send private message
nartcr

New User


Joined: 06 Jun 2007
Posts: 83
Location: anada

PostPosted: Sat Aug 23, 2014 2:49 am
Reply with quote

I will test the same, and will let you know the results. Thanks for your response.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Sat Aug 23, 2014 3:03 am
Reply with quote

Narayanan,

If you know for sure that the file will have one file header, one batch header, one file trailer and one batch trailer for each client, you may try SELECTing each client group having more than 4 records (ie at least one detail record)

Something like this:
Code:
//STEP01   EXEC PGM=SYNCTOOL
//TOOLMSG  DD  SYSOUT=*     
//DFSMSG   DD  SYSOUT=*     
//*                         
//IN       DD  *           
1FHEADERCLIENT1             
2BHEADERCLIENT1             
3DETAIL1CLIENT1             
3DETAIL2CLIENT1             
3DETAIL3CLIENT1             
8BTRAILERCLIENT1           
9FTRAILERCLIENT1           
1FHEADERCLIENT2             
2BHEADERCLIENT2             
8BTRAILERCLIENT2           
9FTRAILERCLIENT2           
1FHEADERCLIENT3             
2BHEADERCLIENT3             
3DETAIL4CLIENT3             
8BTRAILERCLIENT3           
9FTRAILERCLIENT3           
//OUT      DD  SYSOUT=*                                             
//*                                                                 
//TOOLIN   DD  *                                                     
 SELECT FROM(IN) TO(OUT) ON(81,8,CH) HIGHER(4) USING(CTL1)           
//*                                                                 
//CTL1CNTL DD  *                                                     
 INREC IFTHEN=(WHEN=GROUP,BEGIN=(2,2,CH,EQ,C'FH'),PUSH=(81:ID=8))   
 OUTFIL BUILD=(1,80)   
OUT
Code:
1FHEADERCLIENT1 
2BHEADERCLIENT1 
3DETAIL1CLIENT1 
3DETAIL2CLIENT1 
3DETAIL3CLIENT1 
8BTRAILERCLIENT1
9FTRAILERCLIENT1
1FHEADERCLIENT3 
2BHEADERCLIENT3 
3DETAIL4CLIENT3 
8BTRAILERCLIENT3
9FTRAILERCLIENT3
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Sat Aug 23, 2014 3:08 am
Reply with quote

Hi Arun,

Yes, but I don't see how to do that without JOINKEYS, and without forcing a lot of mismatches, so heavy in processing. Perhaps I'm missing something?
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Sat Aug 23, 2014 3:11 am
Reply with quote

Oops, Sorry Bill I was editing my post and missed yours. I have posted the sample code above.
Back to top
View user's profile Send private message
nartcr

New User


Joined: 06 Jun 2007
Posts: 83
Location: anada

PostPosted: Sat Aug 23, 2014 3:23 am
Reply with quote

Works like a charm. Thanks Arun.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Sat Aug 23, 2014 3:30 am
Reply with quote

You're welcome, Glad it worked for you icon_smile.gif
Back to top
View user's profile Send private message
nartcr

New User


Joined: 06 Jun 2007
Posts: 83
Location: anada

PostPosted: Sat Aug 23, 2014 3:38 am
Reply with quote

I was looking for documentation on synctool, and i see from forums that synctool doesnt have any documentation as such. May i ask you what does this statement do?

Code:
PUSH=(81:ID=8)


What does ID mean?

I really appreciate your help in this.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Sat Aug 23, 2014 6:58 am
Reply with quote

Narayanan,

For Synctool there is no official documentation, but you can find a detailed description on the PUSH operator description in your Syncsort manual. If you do not have one you can request one from Syncsort support.

ID=8 means that I am attaching an 8-byte numeric group label, where the BEGINing of each group is marked by the presence of 'FH' at pos-2. The GROUP ID is incremented by 1 for subsequent groups.

After the above INREC statement processing, the records will look something like this:
Code:
----+----1----+----2....pos 80-> 0----+----+
1FHEADERCLIENT1                   00000001
2BHEADERCLIENT1                   00000001           
3DETAIL1CLIENT1                   00000001           
3DETAIL2CLIENT1                   00000001           
3DETAIL3CLIENT1                   00000001           
8BTRAILERCLIENT1                  00000001           
9FTRAILERCLIENT1                  00000001           
1FHEADERCLIENT2                   00000002           
2BHEADERCLIENT2                   00000002           
8BTRAILERCLIENT2                  00000002           
9FTRAILERCLIENT2                  00000002           
1FHEADERCLIENT3                   00000003           
2BHEADERCLIENT3                   00000003           
3DETAIL4CLIENT3                   00000003           
8BTRAILERCLIENT3                  00000003           
9FTRAILERCLIENT3                  00000003
Back to top
View user's profile Send private message
nartcr

New User


Joined: 06 Jun 2007
Posts: 83
Location: anada

PostPosted: Sat Aug 23, 2014 8:38 am
Reply with quote

Thank you once again
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 -> SYNCSORT

 


Similar Topics
Topic Forum Replies
No new posts combine multiple unique records into ... DFSORT/ICETOOL 2
No new posts ICETOOL to SUM String DFSORT/ICETOOL 1
No new posts Add condition to a FINDREP SORT card DFSORT/ICETOOL 4
No new posts Sort based on the record type DFSORT/ICETOOL 1
No new posts To Omit records based n SORT condition DFSORT/ICETOOL 6
Search our Forums:

Back to Top