MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Split the Input file
Goto page Previous  1, 2
 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
Ram22
Beginner


Joined: 09 Jun 2004
Posts: 33
Topics: 6

PostPosted: Wed Jun 23, 2004 8:02 am    Post subject: Reply with quote

Hi Kolusu,

First I am Extremely sorry for requesting immediate reply...please understand that I was in very bad need of the same.. ( really I did not mean to hurt your shedule)

I was very much relaxed when the solution given by you was working..
I am sorry again to tell you that I did not come back to thank you once the solution is working.. but came back with a request again.

I admit that I am poor in sort, but shall do put my efforts to bring me up myself with the suggestions given by Frank(regarding the material for sort)

Now I am with some problem with the solution as stated by you..
The Logic is not working if the number of records in the input file is less than the output files.
i.e. if the number of outputfiles is 5 and the number of records to split is 4 or less than 5, we will endup with 0, once we divide the records count by number of files... thus we will not be able to build the start and end rec's properly...

If you can suggest any thing, It will be of a great help to me..

Thanks in Advance
Ram
Back to top
View user's profile Send private message
Ram22
Beginner


Joined: 09 Jun 2004
Posts: 33
Topics: 6

PostPosted: Wed Jun 23, 2004 8:14 am    Post subject: Reply with quote

Frank,

Thanks a lot for the clarification (ICETOOL and SYNCTOOL are not the same). I am very much sorry as my post annoyed you, but please understand that I am a beginner in the sort techniques.

Regarding my request, I am very much sorry if my request/posting had reflected as a demand. Thas was the first time I was posting a query, and belive me that I really did not intend to hurt your feeling.

Ram
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12398
Topics: 75
Location: San Jose

PostPosted: Wed Jun 23, 2004 10:35 am    Post subject: Reply with quote

Ram22,
The following DFSORT/ICETOOL JCL will take care if the no: of records are less than the no: of split files .i.e when the input file has less than 5 records
Code:

//STEP0100 EXEC PGM=ICETOOL   
//TOOLMSG   DD SYSOUT=*       
//DFSMSG    DD SYSOUT=*       
//IN        DD DSN=YOUR INPUT FILE,
//             DISP=SHR             
//T1        DD DSN=&T1,DISP=(,PASS),SPACE=(TRK,(1,1),RLSE)
//C1        DD DSN=&C1,DISP=(,PASS),SPACE=(TRK,(1,1),RLSE)
//C2        DD DSN=&C2,DISP=(,PASS),SPACE=(TRK,(1,1),RLSE)
//OUT1      DD DSN=YOUR OUTPUT FILE 1,
//             DISP=(NEW,CATLG,DELETE),
//             UNIT=SYSDA,
//             SPACE=(CYL,(X,Y,)RLSE)
//OUT2      DD DSN=YOUR OUTPUT FILE 2,
//             DISP=(NEW,CATLG,DELETE),
//             UNIT=SYSDA,
//             SPACE=(CYL,(X,Y,)RLSE)
//OUT3      DD DSN=YOUR OUTPUT FILE 3,
//             DISP=(NEW,CATLG,DELETE),
//             UNIT=SYSDA,
//             SPACE=(CYL,(X,Y,)RLSE)
//OUT4      DD DSN=YOUR OUTPUT FILE 4,
//             DISP=(NEW,CATLG,DELETE),
//             UNIT=SYSDA,
//             SPACE=(CYL,(X,Y,)RLSE)
//OUT5      DD DSN=YOUR OUTPUT FILE 5,
//             DISP=(NEW,CATLG,DELETE),
//             UNIT=SYSDA,
//             SPACE=(CYL,(X,Y,)RLSE)
//TOOLIN    DD *                                   
  COPY FROM(IN) USING(CTL1)                         
  COPY FROM(T1) USING(CTL2)                         
  COPY FROM(IN) USING(CTL3)                         
//CTL1CNTL  DD *                                   
  OUTFIL FNAMES=T1,NODETAIL,REMOVECC,TRAILER1=(COUNT)       
//CTL2CNTL  DD *                                               
  INREC FIELDS=(1,8,FS,DIV,+5,EDIT=(TTTTTTTT))                 
  OUTFIL FNAMES=C1,INCLUDE=(1,8,ZD,LT,1),                     
  OUTREC=(C' OUTFIL FNAMES=OUT1',80:X)                         
  OUTFIL FNAMES=C2,SAVE,                                       
  OUTREC=(C' OUTFIL FNAMES=OUT1,ENDREC=',1,8,/,               
          C' OUTFIL FNAMES=OUT2,STARTREC=',                   
          +1,ADD,1,8,ZD,EDIT=(TTTTTTTT),C',ENDREC=',           
          +2,MUL,1,8,ZD,EDIT=(TTTTTTTT),/,                     
          C' OUTFIL FNAMES=OUT3,STARTREC=',                   
          +1,ADD,(+2,MUL,1,8,ZD),EDIT=(TTTTTTTT),C',ENDREC=', 
          +3,MUL,1,8,ZD,EDIT=(TTTTTTTT),/,                     
          C' OUTFIL FNAMES=OUT4,STARTREC=',                   
          +1,ADD,(+3,MUL,1,8,ZD),EDIT=(TTTTTTTT),C',ENDREC=', 
          +4,MUL,1,8,ZD,EDIT=(TTTTTTTT),/,                     
          C' OUTFIL FNAMES=OUT5,STARTREC=',                   
          +1,ADD,(+4,MUL,1,8,ZD),EDIT=(TTTTTTTT),80:X)         
//CTL3CNTL  DD DSN=&C1,DISP=OLD,VOL=REF=*.C1                   
//          DD DSN=&C2,DISP=OLD,VOL=REF=*.C2                   
/*


If ICETOOL is not allowed then you can split this job into 3 steps. Look for my earlier post and split the job accordingly

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Ram22
Beginner


Joined: 09 Jun 2004
Posts: 33
Topics: 6

PostPosted: Thu Jun 24, 2004 7:08 am    Post subject: Reply with quote

Hi Kolusu,

Thanks a lot for the solution...
I will work on this and will let you know my results

Ram
Back to top
View user's profile Send private message
Ram22
Beginner


Joined: 09 Jun 2004
Posts: 33
Topics: 6

PostPosted: Fri Jun 25, 2004 8:17 am    Post subject: Reply with quote

Hi Kolusu,

I could not understand the concept of SAVE here... can you please tell me about this. At the same time I am confused how it is handling empty and low range files.. Can you please brief me about the process.

One more request.. can u please suggest me some online stuff, where I can read much about syncsort and how to play with it...

Smile
Ram.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12398
Topics: 75
Location: San Jose

PostPosted: Fri Jun 25, 2004 10:43 am    Post subject: Reply with quote

Ram,

Quote:

I could not understand the concept of SAVE here... can you please tell me about this. At the same time I am confused how it is handling empty and low range files.. Can you please brief me about the process.


SAVE selects the records that are not selected for any other OUTFIL group. In the control cards you see the save parm, it will write out all other records which are not written to C1 file

I am generating 2 control cards(c1 & c2). C1 Control cards are generated if the quotient is zero .i.e your file has less than 5 records.

If your file count <=5 ,there is nothing to split the files. In this case we only write 1 output file. we will generate c1 control cards.

If your file count is >= 5 then you will generate c2 control cards which will have the output split into 5 files.

So at any point of time we will either create a C1 control card file or C2 Control card file

Now we concatenate these 2 files together and split the records.

If you really want to know how the job works run this job each step by step and verify the output after every step.

Code:

//STEP0100 EXEC PGM=SORT                       
//SYSOUT   DD SYSOUT=*                         
//SORTIN   DD *                               
A                                             
B                                             
C                                             
//SORTOUT  DD DSN=USERID.COUNT,               
//            DISP=(NEW,CATLG,DELETE),         
//            UNIT=SYSDA,                     
//            SPACE=(TRK,(1,1),RLSE)           
//SYSIN    DD *                               
  SORT FIELDS=COPY                             
  OUTFIL NODETAIL,REMOVECC,TRAILER1=(COUNT)   
//*                                           
//STEP0200 EXEC PGM=SORT                                       
//SYSOUT    DD SYSOUT=*                                       
//SORTIN    DD DSN=USERID.COUNT,                             
//             DISP=SHR                                       
//C1        DD DSN=USERID.CNTLCARD.COUNT.LT5,                 
//             DISP=(NEW,CATLG,DELETE),                       
//             UNIT=SYSDA,                                     
//             SPACE=(TRK,(1,1),RLSE)                         
//C2        DD DSN=USERID.CNTLCARD.COUNT.GE5,                 
//             DISP=(NEW,CATLG,DELETE),                       
//             UNIT=SYSDA,                                     
//             SPACE=(TRK,(1,1),RLSE)                         
//SYSIN    DD *                                               
  SORT FIELDS=COPY                                             
  INREC FIELDS=(1,8,FS,DIV,+5,EDIT=(TTTTTTTT))                 
  OUTFIL FNAMES=C1,INCLUDE=(1,8,ZD,LT,1),                     
  OUTREC=(C' OUTFIL FNAMES=OUT1',80:X)                         
  OUTFIL FNAMES=C2,SAVE,                                       
  OUTREC=(C' OUTFIL FNAMES=OUT1,ENDREC=',1,8,/,               
          C' OUTFIL FNAMES=OUT2,STARTREC=',                   
          +1,ADD,1,8,ZD,EDIT=(TTTTTTTT),C',ENDREC=',           
          +2,MUL,1,8,ZD,EDIT=(TTTTTTTT),/,                     
          C' OUTFIL FNAMES=OUT3,STARTREC=',                   
          +1,ADD,(+2,MUL,1,8,ZD),EDIT=(TTTTTTTT),C',ENDREC=', 
          +3,MUL,1,8,ZD,EDIT=(TTTTTTTT),/,                     
          C' OUTFIL FNAMES=OUT4,STARTREC=',                   
          +1,ADD,(+3,MUL,1,8,ZD),EDIT=(TTTTTTTT),C',ENDREC=', 
          +4,MUL,1,8,ZD,EDIT=(TTTTTTTT),/,                     
          C' OUTFIL FNAMES=OUT5,STARTREC=',                   
          +1,ADD,(+4,MUL,1,8,ZD),EDIT=(TTTTTTTT),80:X)         
//*                                                           
//STEP0300 EXEC PGM=SORT                       
//SYSOUT   DD SYSOUT=*                         
//SORTIN   DD *                               
A                                             
B                                             
C                                             
//OUT1     DD SYSOUT=*                         
//OUT2     DD SYSOUT=*                         
//OUT3     DD SYSOUT=*                         
//OUT4     DD SYSOUT=*                         
//OUT5     DD SYSOUT=*                         
//SYSIN    DD *                               
  SORT FIELDS=COPY                             
//         DD DSN=USERID.CNTLCARD.COUNT.LT5, 
//            DISP=SHR                         
//         DD DSN=USERID.CNTLCARD.COUNT.GE5, 
//            DISP=SHR                         


Hope this helps...

Cheers

Kolusu


Quote:

One more request.. can u please suggest me some online stuff, where I can read much about syncsort and how to play with it...


Syncsort manuals are copy righted and are not available online. Moreover Synctool is an undocumented/unsupported feature of syncsort. So even if you have manual it would not help you.

I hate to say it but you can use DFSORT'S documentation which is available for free on the net, but beware that not all features of DFSORT/ICETOOL will work with syncsort.

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Fri Jun 25, 2004 12:22 pm    Post subject: Reply with quote

Quote:
I hate to say it but you can use DFSORT'S documentation which is available for free on the net, but beware that not all features of DFSORT/ICETOOL will work with syncsort.


To put a finer point on it: The DFSORT documentation describes the functions, features, syntax and messages for DFSORT and DFSORT's ICETOOL. It does NOT describe the functions, features, syntax or messages for any other product. If you use the DFSORT documentation as if it does describe any other product, you will be in for some surprises.

Note in particular that the message numbers and message text for the two products are completely different.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Ram22
Beginner


Joined: 09 Jun 2004
Posts: 33
Topics: 6

PostPosted: Tue Jun 29, 2004 9:01 am    Post subject: Reply with quote

Hi Kolusu,

Thanks in tons for the explanation...
I could learn much regarding Syncsort with your help.

I have restricted access to internet over here, so I will be able to access the forum only during a few hours.... So I will be able to thank you and express my satisfaction a bit late...

Thanks a lot again, to be frank this is the feeling thats comming from deep of me... I really got so much at the initial stage of communicating with you people through forum.... thanks for the moderator who created this forum... Very Happy


Ram
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Tue Apr 25, 2006 5:21 pm    Post subject: Reply with quote

Here's a new solution for this requirement that uses the SPLIT1R function of DFSORT available with z/OS DFSORT PTF UK90007 and DFSORT R14 PTF UK90006. Whereas SPLITBY can rotate back to the first data set, resulting in non-contiguous records, SPLIT1R only does one rotation so the records are always contiguous.

Here's a DFSORT job that uses SPLIT1R dynamically to divide any number of input records among any number of output files:

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN DD DSN=... input file
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//C1 DD DSN=&&C1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//CTL3CNTL DD *
  OUTFIL FNAMES=(OUT01,OUT02,...,OUTnn),  <--- change for nn
//    DD DSN=*.C1,VOL=REF=*.C1,DISP=(OLD,PASS)
//OUT01 DD DSN=... output file01
//OUT02 DD DSN=... output file02
...
//OUTnn DD DSN=... output filenn  <--- change for nn
//TOOLIN DD *
* Get the record count.
COPY FROM(IN) USING(CTL1)
* Generate:
* SPLIT1R=x where x = count/nn.
* nn is the number of output files.
COPY FROM(T1) TO(C1) USING(CTL2)
* Use SPLIT1R=x to split records contiguously among
* the nn output files.
COPY FROM(IN) USING(CTL3)
/*
//CTL1CNTL DD *
  OUTFIL FNAMES=T1,REMOVECC,NODETAIL,
    TRAILER1=(COUNT=(M11,LENGTH=8))
/*
//CTL2CNTL DD *
  OUTREC BUILD=(2X,C'SPLIT1R=',
    1,8,ZD,DIV,+nn,               <--- set to nn
      TO=ZD,LENGTH=8,80:X)
/*


For complete information on SPLIT1R and the other new DFSORT/ICETOOL functions available with the April, 2006 PTFs, see:

www.ibm.com/servers/storage/support/software/sort/mvs/peug/
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group