Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Help Skipping Records based on Condition - SynSort/ICETOOL

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> SYNCSORT
View previous topic :: :: View next topic  
Author Message
nartcr

New User


Joined: 06 Jun 2007
Posts: 73
Location: Chicago

PostPosted: Fri Aug 22, 2014 2:56 am    Post subject: Help Skipping Records based on Condition - SynSort/ICETOOL
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Fri Aug 22, 2014 8:08 pm    Post subject: Reply to: Help Skipping Records based on Condition - SynSort
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: 73
Location: Chicago

PostPosted: Sat Aug 23, 2014 2:49 am    Post subject: Reply to: Help Skipping Records based on Condition - SynSort
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: 2158
Location: @my desk

PostPosted: Sat Aug 23, 2014 3:03 am    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Sat Aug 23, 2014 3:08 am    Post subject: Reply to: Help Skipping Records based on Condition - SynSort
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: 2158
Location: @my desk

PostPosted: Sat Aug 23, 2014 3:11 am    Post subject:
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: 73
Location: Chicago

PostPosted: Sat Aug 23, 2014 3:23 am    Post subject:
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: 2158
Location: @my desk

PostPosted: Sat Aug 23, 2014 3:30 am    Post subject:
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: 73
Location: Chicago

PostPosted: Sat Aug 23, 2014 3:38 am    Post subject:
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: 2158
Location: @my desk

PostPosted: Sat Aug 23, 2014 6:58 am    Post subject:
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: 73
Location: Chicago

PostPosted: Sat Aug 23, 2014 8:38 am    Post subject:
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    IBMMAINFRAMES.com Support Forums -> SYNCSORT All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
This topic is locked: you cannot edit posts or make replies. How to pass the previous month date i... Suganya87 DFSORT/ICETOOL 5 Mon Oct 31, 2016 4:13 pm
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts How to delete second instance from Fl... Gunapala CN DFSORT/ICETOOL 6 Tue Oct 18, 2016 11:42 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us