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

Group based operation


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

New User


Joined: 03 Dec 2010
Posts: 87
Location: India

PostPosted: Thu Jan 05, 2012 9:31 pm
Reply with quote

Hi,

I have an input file with LRECL = 80 and FB.
INPUT-FILE-
Code:

IB1000 MFRM
IB2000 XCD1
IB3000 XCD2
IB4000 XCD3
IB5000 XCD4
IB1000 DNET
IB2000 DCD1
IB3000 DCD2
IB4000 DCD3
IB5000 DCD4
IB1000 CCPP
IB2000 CCD1
IB3000 CCD2
IB4000 CCD3
IB5000 CCD4
IB1000 MFRM
IB2000 YCD1
IB3000 YCD2
IB4000 YCD3
IB5000 YCD4


The records are in groups. Starting record of the group can be identified by 'IB1000' at position 1 and length 6. And Ending record of the group can be identified by IB5000 at position 1 and length 6.

Only those groups needs to be written to output files, whose starting record has 'MFRM' at position 8 and length 4.

So the output file(LRECL=80) will have -

Code:

IB1000 MFRM
IB2000 XCD1
IB3000 XCD2
IB4000 XCD3
IB5000 XCD4
IB1000 MFRM
IB2000 YCD1
IB3000 YCD2
IB4000 YCD3
IB5000 YCD4
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Thu Jan 05, 2012 11:38 pm
Reply with quote

a possible solution could be
Code:
 ****** ***************************** Top of Data ******************************
 000001 //ENRICO1  JOB NOTIFY=&SYSUID,                                         
 000002 //             CLASS=A,MSGCLASS=X,MSGLEVEL=(1,1)                       
 000003 //*                                                                     
 000004 //S1      EXEC PGM=SORT                                                 
 000005 //SYSOUT    DD SYSOUT=*                                                 
 000006 //SORTIN    DD *                                                       
 000007 IB1000 MFRM                                                             
 000008 IB2000 XCD1                                                             
 000009 IB3000 XCD2                                                             
 000010 IB4000 XCD3                                                             
 000011 IB5000 XCD4                                                             
 000012 IB1000 DNET                                                             
 000013 IB2000 DCD1                                                             
 000014 IB3000 DCD2                                                             
 000015 IB4000 DCD3                                                             
 000016 IB5000 DCD4                                                             
 000017 IB1000 CCPP                                                             
 000018 IB2000 CCD1                                                             
 000019 IB3000 CCD2                                                             
 000020 IB4000 CCD3                                                             
 000021 IB5000 CCD4                                                             
 000022 IB1000 MFRM                                                             
 000023 IB2000 YCD1                                                             
 000024 IB3000 YCD2                                                             
 000025 IB4000 YCD3                                                             
 000026 IB5000 YCD4                                                             
 000027 //SORTOUT   DD SYSOUT=*                         
 000028 //SYSIN     DD *                                                       
 000030   OPTION COPY                                                           
 000031   INREC  IFTHEN=(WHEN=GROUP,                                           
 000032                  BEGIN=(1,6,CH,EQ,C'IB1000'),                           
 000033                  END=(1,6,CH,EQ,C'IB5000'),                             
 000034                  PUSH=(81:8,4))                                         
 000035   OUTFIL BUILD=(1,80),                                                 
 000036          INCLUDE=(81,4,CH,EQ,C'MFRM')                                   
 ****** **************************** Bottom of Data ****************************
 


output

Code:
********************************* TOP OF DATA **********************************
IB1000 MFRM                                                                     
IB2000 XCD1                                                                     
IB3000 XCD2                                                                     
IB4000 XCD3                                                                     
IB5000 XCD4                                                                     
IB1000 MFRM                                                                     
IB2000 YCD1                                                                     
IB3000 YCD2                                                                     
IB4000 YCD3                                                                     
IB5000 YCD4                                                                     
******************************** BOTTOM OF DATA ********************************


it will discard everything between an IB5000 and the IB1000 that follows

an alternative taking into account only the ib1000 <flag>
considering as a group everything until the next IB1000
could be
Code:
 ....
 000028 //SYSIN     DD *                                                       
 000029   OPTION COPY                                                           
 000030   INREC  IFTHEN=(WHEN=GROUP,BEGIN=(1,6,CH,EQ,C'IB1000'),PUSH=(81:8,4)) 
 000031   OUTFIL BUILD=(1,80),                                                 
 000032          INCLUDE=(81,4,CH,EQ,C'MFRM')                                   
 ****** **************************** Bottom of Data ****************************
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Jan 06, 2012 12:13 am
Reply with quote

Note that this technique is described in the "Include or omit groups of records" Smart DFSORT Trick at:

www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000094

For the requirement described, both of Enrico's jobs would work, but the second one would be simpler since the ending record is superfluous for each group.
Back to top
View user's profile Send private message
techslam

New User


Joined: 03 Dec 2010
Posts: 87
Location: India

PostPosted: Fri Jan 06, 2012 6:16 pm
Reply with quote

@enrico-sorichetti


Thanks a lot Enrico.. This is exactly what I wanted. Thanks a bunch !
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 To search DB2 table based on Conditio... DB2 1
This topic is locked: you cannot edit posts or make replies. Merge 2 input files based on the reco... JCL & VSAM 2
No new posts Compare latest 2 rows of a table usin... DB2 1
No new posts Split large FB file based on Key coun... DFSORT/ICETOOL 4
No new posts Mass JCL release via IDZ tool(eclipse... CA Products 1
Search our Forums:

Back to Top