MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Segregating records using DFSORT/ICETOOL

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
priyaranjan.mishra
Beginner


Joined: 21 Jan 2008
Posts: 17
Topics: 9

PostPosted: Sat Mar 25, 2017 7:15 am    Post subject: Segregating records using DFSORT/ICETOOL Reply with quote

I have an input file with the following fields:
Account #
Capacity Code
Sequence #
Sorted in ascending order of Account #

Following is a sample input file:
Code:

16909182  SIGS    01
16909182  GRANTR  02   
16909182  JTWROS  03
54372302  SIGS    01
54372302  GRANTR  02
54372302  JTWROS  03
54372302  BFOWRI  04
54372302  BFOWRI  05
73636292  SIGS    01
73636292  GRANTR  02
83727373  SIGS    01
83727373  GRANTR  02
83727373  BFOWRI  03


The requirement is to generate 2 o/p files
1st o/p file should have only the 1st BFOWRI row for each account:

Code:

54372302  BFOWRI  04
83727373  BFOWRI  03


2nd o/p file should have all the rows for all the accounts which do not have BFOWRI capacity:

Code:

16909182  SIGS    01
16909182  GRANTR  02   
16909182  JTWROS  03
73636292  SIGS    01
73636292  GRANTR  02 


I can do this in multiple steps using DFSORT, but wanted to know if this cane be done with DFSORT/ICETOOL in a single step.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12357
Topics: 75
Location: San Jose

PostPosted: Sat Mar 25, 2017 9:20 pm    Post subject: Reply with quote

priyaranjan.mishra,

Try this untested JCL. Use the trick of joinkeys to match the file to itself.

Code:

//STEP0100 EXEC PGM=SORT
//SYSOUT   DD SYSOUT=* 
//INA      DD *         
16909182  SIGS    01   
16909182  GRANTR  02   
16909182  JTWROS  03   
54372302  SIGS    01   
54372302  GRANTR  02   
54372302  JTWROS  03   
54372302  BFOWRI  04   
54372302  BFOWRI  05   
73636292  SIGS    01   
73636292  GRANTR  02   
83727373  SIGS    01   
83727373  GRANTR  02   
83727373  BFOWRI  03   
//INB      DD *         
16909182  SIGS    01   
16909182  GRANTR  02   
16909182  JTWROS  03   
54372302  SIGS    01   
54372302  GRANTR  02   
54372302  JTWROS  03   
54372302  BFOWRI  04   
54372302  BFOWRI  05   
73636292  SIGS    01   
73636292  GRANTR  02   
83727373  SIGS    01   
83727373  GRANTR  02   
83727373  BFOWRI  03   
//BFOWRI   DD SYSOUT=* 
//OTHER    DD SYSOUT=* 
//SYSIN    DD *                                               
  OPTION COPY                                                 
  JOINKEYS F1=INA,FIELDS=(1,8,A,88,1,A),SORTED,NOSEQCK         
  JOINKEYS F2=INB,FIELDS=(1,8,A,09,1,A),SORTED,NOSEQCK         
  JOIN UNPAIRED,F1                                             
  REFORMAT FIELDS=(F1:1,80,?)                                 
  INREC IFTHEN=(WHEN=GROUP,KEYBEGIN=(1,8),PUSH=(81:81,1))     
                                                               
  OUTFIL FNAMES=BFOWRI,NODETAIL,                               
  INCLUDE=(81,1,CH,EQ,C'B',AND,11,6,CH,EQ,C'BFOWRI'),         
  SECTIONS=(1,8,HEADER3=(1,80))                               
                                                               
  OUTFIL FNAMES=OTHER,                                         
  INCLUDE=(81,1,CH,EQ,C'1'),                                   
  BUILD=(1,80)                                                 
//*                                                           
//JNF1CNTL DD *                                               
  INREC OVERLAY=(81:SEQNUM,8,ZD,RESTART=(1,8))                 
//*                                                           
//JNF2CNTL DD *                                               
  INCLUDE COND=(11,6,CH,EQ,C'BFOWRI')                         
  INREC IFOUTLEN=9,                                           
  IFTHEN=(WHEN=INIT,BUILD=(1,8,SEQNUM,8,ZD,RESTART=(1,8))),   
  IFTHEN=(WHEN=INIT,                                           
  OVERLAY=(9:9,8,CHANGE=(1,C'00000001',C'1'),NOMATCH=(X'FF')))
//*

_________________
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group