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

Splitting file into multiple files without duplicates


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
krupagk

New User


Joined: 07 Aug 2010
Posts: 13
Location: Hyderabad

PostPosted: Mon Dec 10, 2012 4:46 pm
Reply with quote

Hi All,

I have wriiten a SORT depends on the requirement. Here iam mentioning small part of the sort

Code:
OUTFIL FILES=01,INCLUDE=(1,6,CH,EQ,C'540483',OR,         
                         1,8,CH,EQ,C'54355451',AND,     
                         731,10,CH,EQ,C'BLACK'),         
OUTREC=(1:1,730,743:743,117)
OUTFIL FILES=02,INCLUDE=(1,6,CH,EQ,C'543554',AND,     
                         1,8,CH,NE,C'54355467',AND,   
                         1,8,CH,NE,C'54355410',AND,   
                         731,10,CH,NE,C'BENE+',AND,   
                         731,10,CH,NE,C'STUDENT'),     
OUTREC=(1:1,730,743:743,117)
OUTFIL FILES=03
.
.
.
.
OUTFIL FILES=last


But few output files contains the same records as the record satisfied both condition. Can you please help me so that the same record will not present in more than one output file

Hope the requirement is clear

Regards

Code'd
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Dec 10, 2012 5:03 pm
Reply with quote

You have been here long enough to know to use the Code tags, so please do so in future.

Since we have no knowledge of your data, we can't be specific, but you have to ensure you have mutually-exclusive conditions in your case.

I don't understand what you are trying to achieve with your OUTREC, but then you've not shown the rest of your code.
Back to top
View user's profile Send private message
Garry Carroll

Senior Member


Joined: 08 May 2006
Posts: 1193
Location: Dublin, Ireland

PostPosted: Mon Dec 10, 2012 5:31 pm
Reply with quote

If you know how many OUTFIL statements you will have, and assuming that all records will be output to one or other of the output files, you could use INREC IFTHEN BUILD processing to apply a suitable identifier to the records as selected (e.g. 01 - 99).
Then, in your OUTFIL processing, select records to be written to the output files based on that identifier.

Garry.
Back to top
View user's profile Send private message
krupagk

New User


Joined: 07 Aug 2010
Posts: 13
Location: Hyderabad

PostPosted: Mon Dec 10, 2012 6:29 pm
Reply with quote

Hi All,

I have total 22 out files. I have used OUTREC as to write only few fields in the out files instead of the complete input record.

I am explaning my requriement here with an example.

Input file:
--------------------------
Code:
AAAAAAAAAAAAAAAA
BBBBBBBBBBBBBBBB
CCCCCCCCCCCCCC
AAAAAABBBBBBBBBB
EEEEEEEEEEEEEEEEEE
DDDDDDEEEEEEEEEE
FFFFFFFFFFFFFFFFFFFFF

-------------------------

For the first SORT condition if the first two records are sorted then the remaining records(here in this case from 3rd record to 7th record)should only be the input for the second condition and so on

Hope you understand my requriment. Here is my complete SORT condition

Code:
SORT FIELDS=COPY                                   
OUTFIL FILES=01,INCLUDE=(1,6,CH,EQ,C'540483',OR,   
                         1,8,CH,EQ,C'54355451',AND,
                         731,10,CH,EQ,C'BLACK'),   
OUTREC=(1:1,730,743:743,117)                       
OUTFIL FILES=02,INCLUDE=(1,6,CH,EQ,C'543554',AND, 
                         1,8,CH,NE,C'54355467',AND,
                         1,8,CH,NE,C'54355410',AND,
                         731,10,CH,NE,C'BENE+',AND,
                         731,10,CH,NE,C'STUDENT'),
OUTREC=(1:1,730,743:743,117)                       
OUTFIL FILES=03,INCLUDE=(1,6,CH,EQ,C'546882'),     
OUTREC=(1:1,730,743:743,117)                       
OUTFIL FILES=04,INCLUDE=(1,8,CH,GE,C'54741147',AND,
                         1,8,CH,LE,C'54741199'),   
OUTREC=(1:1,730,743:743,117)                       
OUTFIL FILES=05,INCLUDE=(1,6,CH,EQ,C'639010'),     
OUTREC=(1:1,730,743:743,117)                       
OUTFIL FILES=06,INCLUDE=((1,8,CH,EQ,C'67611017',OR,
                         1,8,CH,EQ,C'67611027',OR, 
                         1,8,CH,EQ,C'67611037',OR, 
                         1,8,CH,EQ,C'67611057',OR, 
                         1,8,CH,EQ,C'67611088',OR, 
                         1,8,CH,EQ,C'67611089'),AND,
                         731,10,CH,NE,C'BENE+',AND,
                         731,10,CH,NE,C'STUDENT'), 
OUTREC=(1:1,730,743:743,117)                       
OUTFIL FILES=07,INCLUDE=(1,6,CH,EQ,C'529923'),     
OUTREC=(1:1,730,743:743,117)                       
OUTFIL FILES=08,INCLUDE=(1,6,CH,EQ,C'627568',OR,   
                         1,6,CH,EQ,C'525471',OR,   
                         1,8,CH,EQ,C'52117177',OR, 
                         1,6,CH,EQ,C'424336'),     
OUTREC=(1:1,730,743:743,117)                       
OUTFIL FILES=09,INCLUDE=(1,6,CH,EQ,C'639202'),     
OUTREC=(1:1,730,743:743,117)                       
OUTFIL FILES=10,INCLUDE=(1,6,CH,EQ,C'553061'),     
OUTREC=(1:1,730,743:743,117)                       
OUTFIL FILES=11,INCLUDE=(1,6,CH,EQ,C'521171',AND,   
                         1,8,CH,NE,C'52117177'),   
OUTREC=(1:1,730,743:743,117)                       
OUTFIL FILES=12,INCLUDE=(1,8,CH,GE,C'54741100',AND,
                         1,8,CH,LE,C'54741146'),   
OUTREC=(1:1,730,743:743,117)                       
OUTFIL FILES=13,INCLUDE=((1,8,CH,EQ,C'67611047',OR,
                         1,8,CH,EQ,C'67611067',OR, 
                         1,8,CH,EQ,C'67611097'),AND,
                         731,10,CH,NE,C'STUDENT'), 
OUTREC=(1:1,730,743:743,117)                       
OUTFIL FILES=14,INCLUDE=(1,6,CH,EQ,C'676110',AND,   
                         731,10,CH,EQ,C'STUDENT'), 
OUTREC=(1:1,730,743:743,117)                       
OUTFIL FILES=15,INCLUDE=(1,6,CH,EQ,C'543554',AND,   
                         1,8,CH,NE,C'54355467',AND,
                         1,8,CH,NE,C'54355410',AND,
                         731,10,CH,EQ,C'STUDENT'), 
OUTREC=(1:1,730,743:743,117)                       
OUTFIL FILES=16,INCLUDE=(1,8,CH,EQ,C'67611077',AND,   
                         731,10,CH,NE,C'STUDENT'),   
OUTREC=(1:1,730,743:743,117)                         
OUTFIL FILES=17,INCLUDE=(1,8,CH,EQ,C'54355467',AND,   
                         731,10,CH,NE,C'STUDENT'),   
OUTREC=(1:1,730,743:743,117)                         
OUTFIL FILES=18,INCLUDE=(1,6,CH,EQ,C'543554',AND,     
                         1,8,CH,NE,C'54355467',AND,   
                         1,8,CH,NE,C'54355410',AND,   
                         731,10,CH,EQ,C'BENE+'),     
OUTREC=(1:1,730,743:743,117)                         
OUTFIL FILES=19,INCLUDE=((1,8,CH,EQ,C'67611017',OR,   
                         1,8,CH,EQ,C'67611027',OR,   
                         1,8,CH,EQ,C'67611037',OR,   
                         1,8,CH,EQ,C'67611057',OR,   
                         1,8,CH,EQ,C'67611088',OR,   
                         1,8,CH,EQ,C'67611089'),AND, 
                         731,10,CH,EQ,C'BENE+'),     
OUTREC=(1:1,730,743:743,117)                         
OUTFIL FILES=20,INCLUDE=(1,8,CH,EQ,C'54355451',AND, 
                         731,10,CH,EQ,C'SILVER'),   
OUTREC=(1:1,730,743:743,117)                         
OUTFIL FILES=21,INCLUDE=(1,8,CH,EQ,C'54355451',AND, 
                         731,10,CH,EQ,C'COLOR'),     
OUTREC=(1:1,730,743:743,117)                         
OUTFIL FILES=22,INCLUDE=(1,8,CH,EQ,C'54355410'),     
OUTREC=(1:1,730,743:743,117)                         


Regards
D

Code'd Again
Back to top
View user's profile Send private message
krupagk

New User


Joined: 07 Aug 2010
Posts: 13
Location: Hyderabad

PostPosted: Mon Dec 10, 2012 6:32 pm
Reply with quote

Sorry for not using the code.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Dec 10, 2012 6:44 pm
Reply with quote

Since I'd already Code'd your second, I choped out your re-coding.

You are excluding fields with OUTREC, but have you looked at your record-lengths?

You have to make your conditions mutually exclusive. I don't think anyone is going to do it for you, and they are unlikely to be able to do it how you actually want it to be, as only you know that.

If you can't narrow it down further, look at Garry's suggestion.

Once an IFTHEN has a "hit" on a record, IFTHEN processing stops. If you do all your conditions in IFTHEN, then you will get the effect of "it's already been selected" automatically. If you do this, document it.

Inside the IFTHENs you set a value to be selected for each OUTFIL (like 01, 02, etc to 22 or whatever). You have to remember to "chop off" the value afterwards, with BUILD for instance.
Back to top
View user's profile Send private message
Garry Carroll

Senior Member


Joined: 08 May 2006
Posts: 1193
Location: Dublin, Ireland

PostPosted: Mon Dec 10, 2012 7:04 pm
Reply with quote

What I'm suggesting is along the lines....

Code:
INREC IFTHEN=(WHEN=(1,6,CH,EQ,C'540483',OR,
                       1,8,CH,EQ,C'54355451',AND,
                       731,10,CH,EQ,C'BLACK'),
                       BUILD=(1:1,730,743:743,117,880:C'01')),
                   IFTHEN=(WHEN=(1,6,CH,EQ,C'543554',AND,
                       1,8,CH,NE,C'54355467',AND,
                        1,8,CH,NE,C'54355410',AND,
                        731,10,CH,NE,C'BENE+',AND,
                        731,10,CH,NE,C'STUDENT'),
                        BUILD=(1:1,730,743:743,117,880:C'02')),
                        .
                        .
                        .

  OUTFIL FILES=01,INCLUDE COND=(880,2,CH,EQ,C'01').
        BUILD=(1,860)
  OUTFIL FILES=02,INCLUDE COND=(880,2,CH,EQ,C'02'),
         BUILD=(1.860)
    .
    .
    .

 


(I used 880 as an arbitrary position)
Back to top
View user's profile Send private message
krupagk

New User


Joined: 07 Aug 2010
Posts: 13
Location: Hyderabad

PostPosted: Mon Dec 10, 2012 7:30 pm
Reply with quote

Thanks Garry. I will use this logic
Back to top
View user's profile Send private message
krupagk

New User


Joined: 07 Aug 2010
Posts: 13
Location: Hyderabad

PostPosted: Mon Dec 10, 2012 8:59 pm
Reply with quote

Thanks a lot Garry and Bill. The new sort is working as expected icon_biggrin.gif
Back to top
View user's profile Send private message
Garry Carroll

Senior Member


Joined: 08 May 2006
Posts: 1193
Location: Dublin, Ireland

PostPosted: Mon Dec 10, 2012 9:01 pm
Reply with quote

Thanks for letting us know - glad to have been of help.

Garry.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Mon Dec 10, 2012 10:30 pm
Reply with quote

Krupagk,

Looking at your control cards for the 22 files, I am not sure as to why you want to change them. I suggest you stick to your original sort card as they are optimal.

Adding an INREC with conditions will affect the performance as it now needs to perform the checks twice(once on the INREC and the second on OUTFIL)
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
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
Search our Forums:

Back to Top