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

spilt a file based on a control file data


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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: 1436
Location: Bangalore,India

PostPosted: Wed Feb 06, 2008 8:28 pm
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: 496
Location: USA

PostPosted: Wed Feb 06, 2008 11:10 pm
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
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
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

Moderator Emeritus


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

PostPosted: Mon Feb 11, 2008 9:53 pm
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: 496
Location: USA

PostPosted: Tue Feb 12, 2008 1:08 am
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: 496
Location: USA

PostPosted: Tue Feb 12, 2008 1:16 am
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Store the data for fixed length COBOL Programming 1
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
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top