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
 

 

spilt a file based on a control file data

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
suresh1624

New User


Joined: 21 Nov 2007
Posts: 28
Location: chennai

PostPosted: Wed Feb 06, 2008 6:09 pm    Post subject: spilt a file based on a control file data
Reply with quote

Hi All

My input file data is as follows.

=COLS> ----+----1----+----2----+
000300 ........001.......
000301 ........026.......
000302 ........025.......
000303 ........016.......
000304 ........003.......
000305 ........017.......

I have a control file based on which the input data is copied to output file.The control file data is as follows

=COLS> ----+----1----+----2-
000306 00101
000307 00201
000308 00301
000309 01502
000310 01602
000311 01702
000312 02403
000313 02503
000314 02603


for example 001 record in the input should be written to first file and 016 to second file and so on; I use only syncsort. the number files is fixed and need not be generated dynamically.Can any one help me please.
Back to top
View user's profile Send private message

murmohk1

Senior Member


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

PostPosted: Wed Feb 06, 2008 8:28 pm    Post subject:
Reply with quote

Suresh,

You dint say all the i/p file keys are present in control file or ONLY subset is present.

Quote:
000311 01702
000312 02403

Though you have not given sufficient examples about ur requirement, I assume the value after your key (keys above 017 & 024) says in which o/p file (02 and 03 files respectively) to the i/p record should be written.

If this is your requirement, usign join keys (I believe- as I have not worked with syncsort much).... join the both the records and using simple outfil....include statement, get your job done (with little reformatting).
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 500
Location: USA

PostPosted: Wed Feb 06, 2008 11:10 pm    Post subject:
Reply with quote

suresh,

Assuming the key field is (6,3) in the input file, and (1,3) for the control file, and the control file output identifier field is (4,2)...
And also assuming that these are both 80 byte FB data sets, try the following:

Code:

//SORT1 EXEC PGM=SORT                                   
//SORTJNF1 DD DISP=SHR,DSN=CONTROL.FILE
//SORTJNF2 DD DISP=SHR,DSN=INPUT.FILE
//SORTOF01 DD DSN=OUTFILE1...
//SORTOF02 DD DSN=OUTFILE2...
//SORTOF03 DD DSN=OUTFILE3...             
//SYSOUT DD SYSOUT=*                                         
//SYSIN DD *                                                 
   JOINKEYS FILES=F1,FIELDS=(1,3,A)                         
   JOINKEYS FILES=F2,FIELDS=(6,3,A)                         
   REFORMAT FIELDS=(F2:1,80,F1:4,2)                         
   SORT FIELDS=COPY                                           
   OUTFIL FILES=01,INCLUDE=(81,2,CH,EQ,C'01'),OUTREC=(1,80)   
   OUTFIL FILES=02,INCLUDE=(81,2,CH,EQ,C'02'),OUTREC=(1,80)   
   OUTFIL FILES=03,INCLUDE=(81,2,CH,EQ,C'03'),OUTREC=(1,80)   
/*
Back to top
View user's profile Send private message
suresh1624

New User


Joined: 21 Nov 2007
Posts: 28
Location: chennai

PostPosted: Sat Feb 09, 2008 3:04 pm    Post subject:
Reply with quote

Alissa,
That was gr8 and indeed helpful;But my client doesn't allow the use of join keys. Is there any performance issues with join keys; they rather go for a cobol pgm instead of using joinkeys when processing millions of records.But anyway you helped me to learn abt joinkeys. Thanks for your help.
Back to top
View user's profile Send private message
suresh1624

New User


Joined: 21 Nov 2007
Posts: 28
Location: chennai

PostPosted: Mon Feb 11, 2008 10:09 am    Post subject:
Reply with quote

Alissa,
I'm sorry and forgot to mention one more requirement. If the field from 6 to 3 in the input doesnt have a join with the control file record that records should be written to a default dataset. Is there any way to do it?


Thanks,
Suresh
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Mon Feb 11, 2008 9:53 pm    Post subject:
Reply with quote

Hello,

If the client has directed a cobol solution, how will additional "join" info help implement the code?

Maybe i've misunderstood icon_confused.gif
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 500
Location: USA

PostPosted: Tue Feb 12, 2008 1:08 am    Post subject:
Reply with quote

suresh1624 wrote:
I'm sorry and forgot to mention one more requirement. If the field from 6 to 3 in the input doesnt have a join with the control file record that records should be written to a default dataset. Is there any way to do it?

Yes. Modify the jobstream as follows:
Code:

//SORT1 EXEC PGM=SORT                                   
//SORTJNF1 DD DISP=SHR,DSN=CONTROL.FILE
//SORTJNF2 DD DISP=SHR,DSN=INPUT.FILE
//SORTOF01 DD DSN=OUTFILE1...
//SORTOF02 DD DSN=OUTFILE2...
//SORTOF03 DD DSN=OUTFILE3...
//SORTOF04 DD DSN=OUTFILE4.NOMATCH...             
//SYSOUT DD SYSOUT=*                                         
//SYSIN DD *                                                 
   JOINKEYS FILES=F1,FIELDS=(1,3,A)                         
   JOINKEYS FILES=F2,FIELDS=(6,3,A) 
   JOIN UNPAIRED,F2                       
   REFORMAT FIELDS=(F2:1,80,F1:4,2),FILL=C'0'                       
   SORT FIELDS=COPY                                           
   OUTFIL FILES=01,INCLUDE=(81,2,CH,EQ,C'01'),OUTREC=(1,80)   
   OUTFIL FILES=02,INCLUDE=(81,2,CH,EQ,C'02'),OUTREC=(1,80)   
   OUTFIL FILES=03,INCLUDE=(81,2,CH,EQ,C'03'),OUTREC=(1,80)
   OUTFIL FILES=04,INCLUDE=(81,2,CH,EQ,C'00'),OUTREC=(1,80)
/*
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 500
Location: USA

PostPosted: Tue Feb 12, 2008 1:16 am    Post subject:
Reply with quote

suresh1624 wrote:
Is there any performance issues with join keys; they rather go for a cobol pgm instead of using joinkeys when processing millions of records.
I would expect the use of SyncSort's JOIN feature to perform better than a COBOL application doing the same thing...
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Sorting group data rajella DFSORT/ICETOOL 4 Sun Jan 22, 2017 11:32 pm
No new posts SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts Storing huge volume of data, compare ... Pradeep K M All Other Mainframe Topics 3 Mon Jan 16, 2017 5:08 pm
No new posts how to recover an uncataloged VSAM da... archanamuthukrishnan All Other Mainframe Topics 3 Wed Jan 11, 2017 6:18 pm
No new posts HALDB data refresh/copy from producti... vineetanand2007 IMS DB/DC 1 Mon Jan 02, 2017 11:16 am


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