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

copy groups of records based on subgroup's record occurences


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

New User


Joined: 07 Dec 2011
Posts: 19
Location: India

PostPosted: Thu Mar 15, 2012 5:56 pm
Reply with quote

Hi

My input file(REFM=VB,LRECL=1000) has the following sets of records
Quote:

01 header1/
02 header2/
.
.
03 data records(which are of 2 types)

03,111111,.../(which are of 2 types)
16,101,.../
16,102,.../
49,3/

03,222222,.../
16,201,.../
16,202,.../
49,3/
.
.
98 Trailer1/
99 Trailer2/


Sample Input Data
Code:

01,000000000,000000000,120221,0021,1,01,120221,2/
02,,305100074,1,120220,0021,INR,2,/             
03,111111,22117001,INR,015,+0,,Z,045,+0,,Z,100,+0,0,Z,400,+0,0,Z/
49,2/                                                           
03,111111,59999999,USD,470/
16,101,50000,V,120220,0000/
16,102,50000,V,120220,0000/
16,102,50000,V,120220,0000/
16,102,50000,V,120220,0000/
49,6/
03,111111,59999999,USD,470/
16,101,50000,V,120220,0000/
16,101,50000,V,120220,0000/
16,101,50000,V,120220,0000/
16,101,50000,V,120220,0000/
16,101,50000,V,120220,0000/
16,102,50000,V,120220,0000/
16,102,50000,V,120220,0000/
16,102,50000,V,120220,0000/
16,102,50000,V,120220,0000/
49,11/
03,222222,48888888,USD,470/
16,201,50000,V,120220,0000/
16,201,50000,V,120220,0000/
16,201,50000,V,120220,0000/
16,201,50000,V,120220,0000/
16,202,50000,V,120220,0000/
16,202,50000,V,120220,0000/
16,202,50000,V,120220,0000/
16,202,50000,V,120220,0000/
49,11/
03,222222,48888888,USD,470/
16,201,50000,V,120220,0000/
16,202,50000,V,120220,0000/
49,8/
98/     
99,37/


My requirement is to have headers, trailers and only the data records starting with '03,111111' having occurences of '16,101' and '16,102' records greater than 3 times.

Sample Output Data
Code:

01,000000000,000000000,120221,0021,1,01,120221,2/
02,,305100074,1,120220,0021,INR,2,/             
03,111111,59999999,USD,470/
16,101,50000,V,120220,0000/
16,101,50000,V,120220,0000/
16,101,50000,V,120220,0000/
16,101,50000,V,120220,0000/
16,101,50000,V,120220,0000/
16,102,50000,V,120220,0000/
16,102,50000,V,120220,0000/
16,102,50000,V,120220,0000/
16,102,50000,V,120220,0000/
49,11/
98/     
99,15/


The following control card of mine copies the data records starting with '03,111111. But how do I modify it to include only data records having occurences of '16,101' and '16,102' more than 3 times.

Code:

//TOOLIN   DD *                           
 COPY FROM(INP) TO(OUT) USING(CTL1)       
//CTL1CNTL DD *                           
  INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,6:5)),
      IFTHEN=(WHEN=GROUP,                 
      BEGIN=(9,6,CH,EQ,C'111111'),         
      END=(6,3,CH,EQ,C'49,'),             
      PUSH=(5:ID=1))                       
  OUTFIL FNAMES=OUT,                       
      INCLUDE=(5,1,CH,NE,C' ',OR,         
               6,2,CH,EQ,C'01',OR,         
               6,2,CH,EQ,C'02',OR,         
               6,2,CH,EQ,C'98',OR,         
               6,2,CH,EQ,C'99'),           
      BUILD=(1,4,5:6)                     
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Mar 15, 2012 11:17 pm
Reply with quote

Balaji Canabady,

Use the following DFSORT JCL which will give you the desired results.

Code:

//STEP0100 EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//INA      DD DSN=Your input VB file,DISP=SHR
//INB      DD DSN=Same input VB file again,DISP=SHR
//SORTOUT  DD SYSOUT=*                                               
//SYSIN    DD *                                                     
  OPTION COPY                                                       
  JOINKEYS F1=INA,FIELDS=(5,8,A),SORTED,NOSEQCK                     
  JOINKEYS F2=INB,FIELDS=(5,8,A)                                     
  JOIN UNPAIRED                                                     
  REFORMAT FIELDS=(F1:1,4,F2:5,16,F1:21)                             
  INREC IFTHEN=(WHEN=GROUP,PUSH=(5:24,6),                           
  BEGIN=(21,2,CH,EQ,C'03'),END=(21,2,CH,EQ,C'49'))                   
                                                                     
  OUTFIL BUILD=(1,4,21),                                             
  INCLUDE=(21,2,SS,EQ,C'01,02,98,99',OR,                             
          (05,6,CH,EQ,C'111111',AND,13,4,ZD,GT,3,AND,17,4,ZD,GT,3)) 
                                                                     
//*                                                                 
//JNF1CNTL DD *                                                     
  INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,SEQNUM,8,ZD,START=0,8X,5)),     
  IFTHEN=(WHEN=GROUP,PUSH=(5:ID=8),                                 
  BEGIN=(21,2,CH,EQ,C'03'),END=(21,2,CH,EQ,C'49'))                   
//*                                                                 
//JNF2CNTL DD *                                                     
  OPTION EQUALS                                                     
  INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,SEQNUM,8,ZD,START=0,8C'0',5)), 
  IFTHEN=(WHEN=GROUP,PUSH=(5:ID=8),                                 
  BEGIN=(21,2,CH,EQ,C'03'),END=(21,2,CH,EQ,C'49')),                 
  IFTHEN=(WHEN=(21,6,CH,EQ,C'16,101'),OVERLAY=(16:C'1')),           
  IFTHEN=(WHEN=(21,6,CH,EQ,C'16,102'),OVERLAY=(20:C'1')) 
           
  SUM FIELDS=(13,4,ZD,17,4,ZD)
//*
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 How to split large record length file... DFSORT/ICETOOL 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
Search our Forums:

Back to Top