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 file into multiple DYNAMICALLY

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
pawan.konduru
Beginner


Joined: 07 Oct 2014
Posts: 8
Topics: 4
Location: HYDERABAD

PostPosted: Fri Feb 22, 2019 1:16 pm    Post subject: Split the file into multiple DYNAMICALLY Reply with quote

Hi,

It will be great if I get an help in getting the below requirement using SORT.

I have a file with around 27 Million records (this can be vary depends on he upstream data), with record length of 350 bytes and Rec FM is FB sample is as below
Code:

111111111 0011 some other data
111111111 2002 some other data
111111111 2002 some other data
111111111 2012 some other data
111111111 2012 some other data
111111111 9999 some other data
222222222 0011 some other data
222222222 2002 some other data
222222222 9999 some other data
333333333 0011 some other data
333333333 2012 some other data
333333333 9999 some other data

here 1 to 9 bytes is the account number which has multiple segments 0011 is the starting segment and 9999 is the ending segment, I want to split the file to max 5M records each file and The output files cannot be split in between the 0011 and 9999 records need to Keep the full set in same file.
_________________
Pawan K
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Fri Feb 22, 2019 2:08 pm    Post subject: Reply with quote

pawan.konduru,

Please search before posting. Check this link which meets your requirement

https://www.mvsforums.com/helpboards/viewtopic.php?t=12800&highlight=keybegin

Read thru it and 8th post in that topic has the final solution.
_________________
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

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


Joined: 07 Oct 2014
Posts: 8
Topics: 4
Location: HYDERABAD

PostPosted: Mon Feb 25, 2019 7:54 am    Post subject: Reply with quote

Hi Kolusu,

I tried searching, but might be i didn't hit with the right words.

I really thank you very much for taking me the right post.

It worked for me, Thanks a lot.... Very Happy
_________________
Pawan K
Back to top
View user's profile Send private message
pawan.konduru
Beginner


Joined: 07 Oct 2014
Posts: 8
Topics: 4
Location: HYDERABAD

PostPosted: Tue Feb 26, 2019 5:31 am    Post subject: Reply with quote

Hi Kolusu,

with the code I got issue for one of the scenario ex. I used the split count 7 and 7th record is the starting of the segment

Code:

INPUT:
111111111 0011 SOME OTHER DATA
111111111 2002 SOME OTHER DATA
111111111 2002 SOME OTHER DATA
111111111 2012 SOME OTHER DATA
111111111 2012 SOME OTHER DATA
111111111 9999 SOME OTHER DATA
222222222 0011 SOME OTHER DATA
222222222 2002 SOME OTHER DATA
222222222 9999 SOME OTHER DATA
333333333 0011 SOME OTHER DATA
333333333 2012 SOME OTHER DATA
333333333 9999 SOME OTHER DATA

SORT CARD USED

  OPTION COPY                                                   
  INREC IFTHEN=(WHEN=GROUP,RECORDS=07,                           
         PUSH=(32:ID=2,34:SEQ=9)),                               
          IFTHEN=(WHEN=GROUP,KEYBEGIN=(1,09),PUSH=(44:SEQ=9)),   
          IFTHEN=(WHEN=GROUP,                                   
                  BEGIN=(34,9,ZD,EQ,07,AND,44,9,ZD,GT,1),       
                    END=(44,9,ZD,EQ,1),                         
                  PUSH=(54:32,2)),                               
          IFTHEN=(WHEN=(44,9,ZD,NE,1,AND,54,2,CH,GT,C' '),       
         OVERLAY=(32:54,2))                                     

OUTPUT:
111111111 0011 SOME OTHER DATA 01000000001 000000001
111111111 2002 SOME OTHER DATA 01000000002 000000002
111111111 2002 SOME OTHER DATA 01000000003 000000003
111111111 2012 SOME OTHER DATA 01000000004 000000004
111111111 2012 SOME OTHER DATA 01000000005 000000005
111111111 9999 SOME OTHER DATA 01000000006 000000006
222222222 0011 SOME OTHER DATA 01000000007 000000001
222222222 2002 SOME OTHER DATA 02000000001 000000002
222222222 9999 SOME OTHER DATA 02000000002 000000003
333333333 0011 SOME OTHER DATA 02000000003 000000001
333333333 2012 SOME OTHER DATA 02000000004 000000002
333333333 9999 SOME OTHER DATA 02000000005 000000003



when i Split using the POS:32 the full set for key 222222222 is getting split into two files.

could you please help be in this.
_________________
Pawan K
Back to top
View user's profile Send private message
Arun Raj
Sort Forum Moderator
Sort Forum Moderator


Joined: 14 Jun 2017
Posts: 7
Topics: 1

PostPosted: Wed Feb 27, 2019 3:00 pm    Post subject: Reply with quote

Pawan,

Since your data has an indicator ('9999') where each group ends, could you modify your control statements as below and give a try?
Code:
//SYSIN    DD *                                           
  OPTION COPY                                             
  INREC IFTHEN=(WHEN=GROUP,RECORDS=07,                   
          PUSH=(32:ID=2,34:SEQ=9)),                       
        IFTHEN=(WHEN=GROUP,                               
               BEGIN=(11,4,ZD,EQ,0011),                   
                 END=(34,9,ZD,EQ,07),                     
                PUSH=(44:ID=2)),                         
        IFTHEN=(WHEN=GROUP,                               
               BEGIN=(34,9,ZD,EQ,07,AND,44,2,CH,NE,C' '),
                 END=(11,4,ZD,EQ,9999),                   
                PUSH=(54:32,2)),                         
        IFTHEN=(WHEN=(54,2,CH,GT,C' '),                   
       OVERLAY=(32:54,2))                                 
  OUTREC IFTHEN=(WHEN=GROUP,KEYBEGIN=(32,2),             
           PUSH=(32:ID=2))
Back to top
View user's profile Send private message
pawan.konduru
Beginner


Joined: 07 Oct 2014
Posts: 8
Topics: 4
Location: HYDERABAD

PostPosted: Tue Mar 12, 2019 8:54 am    Post subject: Reply with quote

Hi Arun,

Sorry for the late Reply due to my vacation, I tried with the above and it worked.
We implemented this last Friday and our Clients were Impressed with this.

Thank you all Thanks a lot.
_________________
Pawan K
Back to top
View user's profile Send private message
Arun Raj
Sort Forum Moderator
Sort Forum Moderator


Joined: 14 Jun 2017
Posts: 7
Topics: 1

PostPosted: Thu Mar 14, 2019 6:49 am    Post subject: Reply with quote

No problem. Thanks for letting us know.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
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