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
 

 

Split file dynamically based on the field value(s)

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

Senior Member


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

PostPosted: Thu Nov 22, 2007 1:30 pm    Post subject: Split file dynamically based on the field value(s)
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 Moderator


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

PostPosted: Thu Nov 22, 2007 10:05 pm    Post subject:
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    Post subject:
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    Post subject:
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: 1439
Location: Bangalore,India

PostPosted: Fri Nov 23, 2007 11:33 am    Post subject:
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: 1288
Location: Chennai, India

PostPosted: Fri Nov 23, 2007 5:10 pm    Post subject: Reply to: Split file dynamically based on the field value(s)
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: 1439
Location: Bangalore,India

PostPosted: Fri Nov 23, 2007 6:10 pm    Post subject:
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: 1439
Location: Bangalore,India

PostPosted: Mon Nov 26, 2007 10:31 am    Post subject:
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: 1288
Location: Chennai, India

PostPosted: Mon Nov 26, 2007 12:15 pm    Post subject: Reply to: Split file dynamically based on the field value(s)
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: 1439
Location: Bangalore,India

PostPosted: Mon Nov 26, 2007 2:09 pm    Post subject:
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    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
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Write out NODUPS but just from one file Jay Villaverde DFSORT/ICETOOL 8 Fri Jul 14, 2017 12:44 am
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts How to generate a new unique Input fi... for1ranjith CLIST & REXX 11 Sat Jul 01, 2017 12:09 pm
No new posts Writing a file using online program grvtomar PL/I & Assembler 3 Fri Jun 30, 2017 1:06 pm


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