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

Split file dynamically based on the field value(s)


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

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Thu Nov 22, 2007 1:30 pm
Reply with quote

Hi,

I have file with lrecl-370 and recfm FB. Field 'first name' starts @ col 20-49 (length 30).

My requirement is to split the file dynamically on this field. i.e., if the file contains 10 names (name may repeat), I need 10 o/p files.

Example:

Code:
 ----+----1----+----2----+----3----+----4----+----5----+----6
 ***************************** Top of Data ******************
                    STEVE                                   
                    MALCOM                                   
                    MALCOM                                   
                    MALCOM                                   
                    MALCOM                                   
                    MALCOM                                   
                    ANDREW                                   
                    ANDREW                                   
                    STEVE                                   
                    STEVE                                   
                    JOHN                                     
                    ANDREW                                   
 **************************** Bottom of Data ****************


I need all STEVEs in 1 file, JOHNs in another file etc... (total 4 o/p files for the above example).

Please note that the field values generally change across runs. Also rec count is unknown and expecting the (uniq) names somewhere between 70-90.


I could not find any topic suitable for this requirement in DFSORT forum.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Thu Nov 22, 2007 10:05 pm
Reply with quote

You can use this strategy with DFSORT/ICETOOL:

Use SELECT FIRST to get one record for each name and generate an OUTFIL FNAMES=Annn,INCLUDE=(p,m,CH,EQ,C'name') statement for that name in a temporary file that you can use as the control statements in a subsequent step or operator. You'll need the appropriate //Annn DD statements (or you can generate those too).
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Thu Nov 22, 2007 11:08 pm
Reply with quote

Frank,
Probably murli is pointing into dynamically deciding and creating on the number of o/p files!

I remember you had proposed a solution in one of the previous posts where you had suggested to use INTRDR, but i was not able to get that post(probably it was in JCL forum)....
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Thu Nov 22, 2007 11:08 pm
Reply with quote

Yes i got it
http://ibmmainframes.com/viewtopic.php?t=6324&highlight=intrdr
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Fri Nov 23, 2007 11:33 am
Reply with quote

Hi,

Quote:
expecting the (uniq) names somewhere between 70-90.

Total record count in the i/p file is 70-90 and not the names as posted yesterday. Sorry icon_redface.gif icon_redface.gif icon_redface.gif .

As suggested by Frank, I got it thru dynamic control card.

Thanks all. icon_biggrin.gif
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1287
Location: Chennai, India

PostPosted: Fri Nov 23, 2007 5:10 pm
Reply with quote

murali,

Quote:
As suggested by Frank, I got it thru dynamic control card.


It would be great if you can share the final JCL. This would help us as the requirement looked a bit tricky.
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Fri Nov 23, 2007 6:10 pm
Reply with quote

Aaru,

Quote:
It would be great if you can share the final JCL.

As of now i dont have MF access. Today being weekend I shall share the JCL on Monday.

Quote:
This would help us as the requirement looked a bit tricky

Even i thought the same.... but not that tricky.
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Mon Nov 26, 2007 10:31 am
Reply with quote

Aaru,

Find the JCL below. I used two jobs for this -

Job1:
Code:

//S1    EXEC  PGM=SORT                                                 
//SYSOUT DD SYSOUT=*                                                 
//SYSPRINT DD SYSOUT=*                                               
//SORTIN DD DSN=&SYSUID..MURALI.TEST370,DISP=SHR                     
//*** CONTAINS DD STATEMENTS USED IN JOB2 ***
//SORTOUT DD DSN=&SYSUID..MURALI.TRIAL(DDDDS),DISP=SHR               
//SYSIN DD *                                                         
  SORT FIELDS=(20,30,CH,A)                                           
  SUM FIELDS=NONE                                                     
  OUTFIL OUTREC=(C'//OUT',SEQNUM,5,ZD,                               
             C' DD DSN=&SYSUID..OUT',SEQNUM,5,ZD,C',',80:X,/,         
    C'//  DISP=(,CATLG),LRECL=370,RECFM=FB,SPACE=(CYL,2,RLSE)',80:X) 
/*                 
//****** END OF JOB1 *****                       



Job2: (Depends on job1)

Code:
//   JCLLIB   ORDER=&SYSUID..MURALI.TRIAL                   
//*                                                         
//S1    EXEC  PGM=ICETOOL                                   
//DFSMSG DD SYSOUT=*                                       
//TOOLMSG DD SYSOUT=*                                       
//INFILE DD DSN=&SYSUID..MURALI.TEST370,DISP=SHR           
//TEMPFILE DD DSN=&&T1,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)   
//CARDFILE DD DSN=&&T2,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)   
//TOOLIN DD *                                               
  SELECT FROM(INFILE) TO(TEMPFILE) ON(20,30,CH) FIRST       
  COPY FROM(TEMPFILE)  USING(CTL1)                         
/*                                                         
//CTL1CNTL DD *                                                         
   SORT FIELDS=COPY                                                     
   OUTFIL FNAMES=CARDFILE,                                               
   OUTREC=(C'  OUTFIL FNAMES=OUT',SEQNUM,5,ZD,C',',80:X,/,               
     C'    INCLUDE=(20,30,CH,EQ,C''',20,30,C''')',80:X)                 
/*                                                                     
//*                                                                     
//S2    EXEC  PGM=SORT                           
//SYSOUT DD SYSOUT=*                                                   
//SYSPRINT DD SYSOUT=*                                                 
//SORTIN DD DSN=&SYSUID..MURALI.TEST370,DISP=SHR                       
//** MEMBER CREATED IN JOB1 ****
//    INCLUDE MEMBER=DDDDS                                             
//SYSIN DD *                                                           
    SORT FIELDS=COPY                                                     
//   DD DSN=&&T2,DISP=SHR                                       
//*** END OF JOB2 ***       
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1287
Location: Chennai, India

PostPosted: Mon Nov 26, 2007 12:15 pm
Reply with quote

Murali,

Thanks for sharing the JCL icon_biggrin.gif.
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Mon Nov 26, 2007 2:09 pm
Reply with quote

You are welc icon_smile.gif me Aaru!!!
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 Compare 2 files and retrive records f... DFSORT/ICETOOL 2
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top