Splitting record based on range

In this Mainframe Forum - You can post your queries on DFSORT, ICETOOL , SyncSort & JCL Utilities

Moderators: Frank Yaeger, Moderator Group

Post Reply
jathampy
Member
Posts: 22
Joined: Sat Sep 26, 2009 4:02 pm
Location: software engineer

Splitting record based on range

Post by jathampy » Tue Jan 26, 2010 12:19 am

My input file contain 3 character account prefix followed by account range

Position 1-3 Account prefix
Position 4-6 Start Range
Position 7-9 End Range

The input file need to be exploded based on the start range and end range and then sort based on account prefix.

Example Input file

ADZ001005
ABC005009
DEG010014

Expected Output file

ABC005
ABC006
ABC007
ABC008
ABC009
ADZ001
ADZ002
ADZ003
ADZ004
ADZ005
DEG010
DEG011
DEG012
DEG013
DEG014

Is it possible using sort without using E15/E35 routines?

skolusu
Member
Posts: 43
Joined: Sat Jul 26, 2008 12:38 am

Post by skolusu » Tue Jan 26, 2010 3:26 am

Jathampy,

The following DFSORT/ICETOOL JCL will give you the desired results

Code: Select all

//STEP0100 EXEC PGM=ICETOOL                                           
//TOOLMSG  DD SYSOUT=*                                                
//DFSMSG   DD SYSOUT=*                                                
//IN       DD *                                                       
ADZ001005                                                             
ABC005009                                                             
DEG010014                                                             
//T1       DD DSN=&&T1,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)            
//TOOLIN   DD *                                                       
  COPY FROM(IN) USING(CTL1)                                           
  COPY FROM(IN) USING(CTL2)                                           
  SORT FROM(T1) USING(CTL3)                                           
//CTL1CNTL DD *                                                       
  OUTREC IFTHEN=(WHEN=INIT,OVERLAY=(10:7,3,ZD,SUB,4,3,ZD,EDIT=(TTT))),
  IFTHEN=(WHEN=INIT,OVERLAY=(10:+1,ADD,10,3,ZD,EDIT=(TTT))),          
  IFTHEN=(WHEN=(10,3,ZD,LE,2),OVERLAY=(10:C'002'))                    
  OUTFIL FNAMES=CTL2CNTL,REMOVECC,NODETAIL,BUILD=(80X),               
  TRAILER1=(2:C'OUTFIL FNAMES=T1,REPEAT=',MAX=(10,3,ZD,EDIT=(TTT)))   
//*                                                                   
//CTL2CNTL DD DSN=&&C1,DISP=(,PASS),SPACE=(TRK,(1,0),RLSE)            
//OUT      DD SYSOUT=*                                                
//CTL3CNTL DD *                                                       
  SORT FIELDS=(1,3,CH,A),EQUALS                                       
  OUTREC IFOUTLEN=9,                                                  
  IFTHEN=(WHEN=INIT,OVERLAY=(10:SEQNUM,3,ZD,START=0,RESTART=(1,3))),  
  IFTHEN=(WHEN=INIT,OVERLAY=(04:4,3,ZD,ADD,10,3,ZD,EDIT=(TTT)))       
  OUTFIL FNAMES=OUT,OMIT=(4,3,CH,GT,7,3,CH),BUILD=(1,6)               
//* 
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

jathampy
Member
Posts: 22
Joined: Sat Sep 26, 2009 4:02 pm
Location: software engineer

Post by jathampy » Tue Jan 26, 2010 4:07 am

Incredible Sort logic.
I tested your ICETOOL jcl and results are as per my expectation.
Thanks Kolusu for your timely help.

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others