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
 

 

copy groups of records based on subgroup's record occurences

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: copy groups of records based on subgroup's record occurences
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    Post subject: Reply to: copy groups of records based on subgroup's record
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    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 SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts HALDB data refresh/copy from producti... vineetanand2007 IMS DB/DC 1 Mon Jan 02, 2017 11:16 am
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 am
No new posts syncsort: copy lines after the keyword shreya19 SYNCSORT 7 Fri Dec 02, 2016 9:47 am


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