Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Have to split the file based on the field

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
advith001

New User


Joined: 16 Mar 2005
Posts: 23

PostPosted: Tue Jun 03, 2008 4:23 pm    Post subject: Have to split the file based on the field
Reply with quote

Hi, I required sorting a seq file based on first 17chars and split based on the first 3 chars and write them each into separate files. Not sure how many files might require.

Example..
CTL2 is of 3 char, Account number is of 14 chars
13122222222222222
13122222222222221
13122222222222223
14433333333333321
14433333333333315
14433333333333310
00155555555555529
00155555555555120

expected output is:

00155555555555529
00155555555555120
13122222222222221
13122222222222222
13122222222222223
14433333333333310
14433333333333315
14433333333333321

If this is a repeated question and I can find in threads, please let me know location where can I find..

Anna.
Back to top
View user's profile Send private message

expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Tue Jun 03, 2008 4:36 pm    Post subject:
Reply with quote

Well, given that the three digit field on which to split gives you a possible 1,000 output files, then using SORT may not be viable in one step. Also the limitation of 255 DD statements doesn't help.

You could sort the records into the order that you require them and then use something like REXX to use dynamic allocation for the split output datasets, only having one at a time allocated.
Back to top
View user's profile Send private message
advith001

New User


Joined: 16 Mar 2005
Posts: 23

PostPosted: Tue Jun 03, 2008 4:46 pm    Post subject:
Reply with quote

I noticed the maximum number of files I would require creating is 30 (for 30 diff states).

Hi Expat, can you plz let me know how REXX can be useful and if possible the commands/code... I don't know REXX cmds..

Thanks!
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Tue Jun 03, 2008 5:21 pm    Post subject:
Reply with quote

I suppose that you could create the 30+ files each time and use sort card along the lines of ..... I don't think that there is a restriction on the number of output files, and I certainly have used 9 or so in the past

Code:

  SORT    FIELDS=(1,17,A),FORMAT=CH       
  OUTFIL  FILES=1,INCLUDE=(1,3,CH,EQ,C'001')
  OUTFIL  FILES=2,INCLUDE=(1,3,CH,EQ,C'002')

  etc etc

  OUTFIL  FILES=30,INCLUDE(1,3,CH,EQ,C'030')
Back to top
View user's profile Send private message
advith001

New User


Joined: 16 Mar 2005
Posts: 23

PostPosted: Tue Jun 03, 2008 5:35 pm    Post subject:
Reply with quote

Hi Expat, thanks for your suggestion.. but is there any option to create a new GDG version for each CTL2( first 3 chars) value change?
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Tue Jun 03, 2008 5:58 pm    Post subject:
Reply with quote

advith001 wrote:
Hi Expat, thanks for your suggestion.. but is there any option to create a new GDG version for each CTL2( first 3 chars) value change?


Do you want the same base name but different GENERATION for each output? That you can handle in the JCL.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Tue Jun 03, 2008 6:12 pm    Post subject:
Reply with quote

Or do you want a different GDG base for each possible output ?
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Tue Jun 03, 2008 6:30 pm    Post subject:
Reply with quote

Either way it is just a matter of setting up the jcl the way you want it.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Tue Jun 03, 2008 7:37 pm    Post subject:
Reply with quote

Consultancy available at competitive rates icon_biggrin.gif
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Tue Jun 03, 2008 10:20 pm    Post subject:
Reply with quote

advith001,

The following DFSORT/ICETOOL JCL will create a dynamic JCL on the fly and submit it via Intrdr which will split the records based on the first 3 characters. However remember that the no: of output files you can open at a time depends on the TIOT limit.

Code:

//STEP0100 EXEC PGM=ICEMAN                                       
//SYSOUT   DD SYSOUT=*                                           
//SORTIN   DD DSN=your input file,DISP=SHR                       
//C1       DD DSN=&&C1,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)       
//D1       DD DSN=&&D1,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)       
//T1       DD DSN=&&T1,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)       
//SYSIN    DD *                                                 
  SORT FIELDS=(1,3,CH,A)                                         
  OUTFIL FNAMES=C1,REMOVECC,NODETAIL,                           
  HEADER1=('//CTL1CNTL DD *',/,                                 
           '  SORT FIELDS=(1,17,CH,A)',80:X),                   
  SECTIONS=(1,3,                                                 
  TRAILER3=('  OUTFIL FNAMES=OUT',1,3,C',INCLUDE=(1,3,CH,EQ,C', 
            '''',1,3,'''',')',80:X))                             
  OUTFIL FNAMES=T1,REMOVECC,NODETAIL,                           
  TRAILER1=('  SORT FROM(IN) USING(CTL1)',80:X)                 
  OUTFIL FNAMES=D1,REMOVECC,NODETAIL,                           
  SECTIONS=(1,3,                                                 
  TRAILER3=(C'//OUT',1,3,4X,C'DD DSN=OUTPUT.FILE',1,3,/,         
            C'//',12X,C'DISP=(NEW,CATLG,DELETE),',/,             
            C'//',12X,C'UNIT=SYSDA,',/,                         
            C'//',12X,C'SPACE=(CYL,(X,Y),RLSE)',/,               
            C'/*',80:X))                                         
/*
//STEP0200 EXEC  PGM=ICEMAN                 
//SYSOUT   DD SYSOUT=*                       
//SYSIN    DD *                             
   OPTION COPY                               
/*                                           
//SORTOUT  DD SYSOUT=*                       
//SORTIN   DD DATA,DLM=$$                   
//TIDXXXXA JOB 'COPY',                       
//             CLASS=A,                     
//             MSGCLASS=Y,                   
//             MSGLEVEL=(1,1),               
//             NOTIFY=TID                   
//*                                         
//STEP0100 EXEC  PGM=ICETOOL                 
//TOOLMSG  DD SYSOUT=*                       
//DFSMSG   DD SYSOUT=*                       
//IN       DD DSN=YOUR INPUT FILE,DISP=SHR   
//TOOLIN   DD *                             
$$                                           
//         DD DSN=&T1,DISP=(OLD,PASS)       
//         DD DSN=&D1,DISP=(OLD,PASS)       
//         DD DSN=&C1,DISP=(OLD,PASS)
/*


Check the output of step0200 and if it had generated the correct JCL , change the sortout statement in step0200 to the following and submit the job

Code:

//SORTOUT  DD SYSOUT=(*,INTRDR)               


The output from the above job would be like this . so change the space parameters and names of the output files to suit your needs

Code:

//TIDXXXXA JOB 'COPY',                           
//             CLASS=A,                           
//             MSGCLASS=Y,                       
//             MSGLEVEL=(1,1),                   
//             NOTIFY=TID                         
//*                                               
//STEP0100 EXEC  PGM=ICETOOL                     
//TOOLMSG  DD SYSOUT=*                           
//DFSMSG   DD SYSOUT=*                           
//IN       DD DSN=YOUR INPUT FILE,DISP=SHR       
//TOOLIN   DD *                                   
  SORT FROM(IN) USING(CTL1)                       
//OUT001    DD DSN=OUTPUT.FILE001                 
//            DISP=(NEW,CATLG,DELETE),           
//            UNIT=SYSDA,                         
//            SPACE=(CYL,(X,Y),RLSE)             
/*                                               
//OUT131    DD DSN=OUTPUT.FILE131                 
//            DISP=(NEW,CATLG,DELETE),           
//            UNIT=SYSDA,                         
//            SPACE=(CYL,(X,Y),RLSE)             
/*                                               
//OUT144    DD DSN=OUTPUT.FILE144                 
//            DISP=(NEW,CATLG,DELETE),           
//            UNIT=SYSDA,                         
//            SPACE=(CYL,(X,Y),RLSE)             
/*                                               
//CTL1CNTL DD *                                   
  SORT FIELDS=(1,17,CH,A)                         
  OUTFIL FNAMES=OUT001,INCLUDE=(1,3,CH,EQ,C'001')
  OUTFIL FNAMES=OUT131,INCLUDE=(1,3,CH,EQ,C'131')
  OUTFIL FNAMES=OUT144,INCLUDE=(1,3,CH,EQ,C'144')


Hope this helps...

Cheers
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 sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts Execute JCL step based on the content... sprikitik JCL & VSAM 2 Tue Oct 03, 2017 10:03 am
This topic is locked: you cannot edit posts or make replies. PS file data should be passed as symb... d_sarlie JCL & VSAM 15 Tue Oct 03, 2017 5:18 am
No new posts How to insert a value on specific pos... Poha Eater DFSORT/ICETOOL 9 Sun Oct 01, 2017 3:04 am
No new posts Partial color change of a field in CI... waseem0424 CICS 5 Fri Sep 29, 2017 7:56 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us