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
 

 

Group based operation

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Group based operation
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10256
Location: italy

PostPosted: Thu Jan 05, 2012 11:38 pm    Post subject: Reply to: Group based operation
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 Moderator


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

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

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

http://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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts find RACF group for access to spooled... jzhardy JCL & VSAM 1 Mon May 08, 2017 11:46 am
No new posts Group Data based on a key Arun Raj DFSORT/ICETOOL 7 Thu Apr 27, 2017 11:29 pm
No new posts Need Help with : IFTHEN(WHEN=GROUP) Sumanta_89 DFSORT/ICETOOL 1 Wed Apr 19, 2017 5:23 pm
No new posts Group elements using ICETOOL Learncoholic DFSORT/ICETOOL 2 Fri Apr 14, 2017 11:01 am
No new posts Why TS/OP would Not contact site supp... RahulG31 All Other Mainframe Topics 4 Wed Mar 22, 2017 7:46 am


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