View previous topic :: View next topic
|
Author |
Message |
Bharath Bhat
Active User
Joined: 20 Mar 2008 Posts: 283 Location: chennai
|
|
|
|
Hi,
Do we have a way to tap the omitted records from E15 exit routine?
My requirement is to split the input file into two based on some criteria (Match-merge processing). The processing will be done inside E15. Here we can eliminate the unwanted records. I wanted to check if we have a method to form another sort out file. |
|
Back to top |
|
|
Bharath Bhat
Active User
Joined: 20 Mar 2008 Posts: 283 Location: chennai
|
|
|
|
One method I could think of is writing the unwanted records into a new file inside the program. But, I guess that will increase the I/O processing. It could be efficient if SORT could take care of it.
Thanks, |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
Perhaps if you elaborated on the conditions for omitting records we may be able to suggest |
|
Back to top |
|
|
Bharath Bhat
Active User
Joined: 20 Mar 2008 Posts: 283 Location: chennai
|
|
|
|
We have something called a rolled out department. I'll have the rolled out departments in an input file which will be compared against SORTIN. If they match, I want the record in SORTIN in SORTOUT. If they do not match, I need the record in another file. I do not have any key in the SORTIN to identify which type of record is it(Rolled out/non-rolled out). We do not want to append anything extra(which could have made the solution simpler).
SORTIN
----------
DEPT13409dknvfkh
DEPT23409dknvfkh
DEPT33409dknvfkh
DEPT43409dknvfkh
DEPT43409dknvfkh
DEPT23409dknvfkh
DEPT33409dknvfkh
ROLL-DEPT
--------------
DEPT1
DEPT4
DEPT9
SORTOUT
-----------
DEPT13409dknvfkh
DEPT43409dknvfkh
DEPT43409dknvfkh
Desired SORTOUT02
-----------------------
DEPT23409dknvfkh
DEPT33409dknvfkh
DEPT23409dknvfkh
DEPT33409dknvfkh
We would set a return code of 0 if matches or 4 if does not match.
0 would write into SORTOUT.
Where will the record go if return code = 4?
Will it be Lost? or could it be found somewhere else somehow? |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10886 Location: italy
|
|
|
|
It looks like You are hiding something...
for a simple two files match problem ( as Your data seems to describe )
there is no need for a E15 exit
search the forums with syncsort two files match and You will find many samples for Your need |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6248 Location: Mumbai, India
|
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Bharath Bhat,
As already mentioned in this thread, you'll find many examples in this forum for two-file matches using SyncSort JOIN. If you find it difficult to adapt those to your requirement , post your requirement here so that somebody might have alternatives. |
|
Back to top |
|
|
Bharath Bhat
Active User
Joined: 20 Mar 2008 Posts: 283 Location: chennai
|
|
|
|
Pardon me.
For I forgot to mention the soul reason for using E15.
The reason behind this is, I would append another field to the SORTOUT after processing the rolled out departments. I would use another input file for getting this new field.
So my SORTOUT would look like,
DEPT13409dknvfkhID1
DEPT43409dknvfkhID5
DEPT43409dknvfkhID5
I do not have the liberty to change the LRECL of mentioned SORTOUT02.
If I would go for a sort on the last field, that would result in a file with large LRECL for SORTOUT02 than that of SORTIN. In that case I would need to use E35 exit in the same step to trim SORTOUT02.
Till now, the best I could think is to write it into a new file inside E15.
I hope I am clear this time. |
|
Back to top |
|
|
Bharath Bhat
Active User
Joined: 20 Mar 2008 Posts: 283 Location: chennai
|
|
|
|
Bharath Bhat wrote: |
We would set a return code of 0 if matches or 4 if does not match.
0 would write into SORTOUT.
Where will the record go if return code = 4?Will it be Lost? or could it be found somewhere else somehow? |
I am basically looking for answers to the above questions. Probably I am unable to explain the requirement correctly. But E15 is inevitable for me in order to append the new ID.
If we can differentiate records in an input file into desired and undesired records, We can make the SORT select desired records and write into SORTOUT by issueing RETURN-CODE = 0. My question is can we make the SORT to write into another file in case if RETURN-CODE = 4 |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Quote: |
I do not have the liberty to change the LRECL of mentioned SORTOUT02.
If I would go for a sort on the last field, that would result in a file with large LRECL for SORTOUT02 than that of SORTIN. In that case I would need to use E35 exit in the same step to trim SORTOUT02. |
Bharath Bhat,
I m sorry. The above part is still not clear to me. Can you please explain what you meant by this? Also it would be better if you tell us the criteria/logic to attach the 'ID' from the 3rd file to the matching records. |
|
Back to top |
|
|
Bharath Bhat
Active User
Joined: 20 Mar 2008 Posts: 283 Location: chennai
|
|
|
|
Arun,
If you compare the SORTIN and SORTOUT, the LRECL of SORTOUT is incremented by the length of ID. That is acceptable for me. But I want the LRECL of the second file(SORTOUT02) to be same as the LRECL of SORTIN. Had it not been a constraint, I could have just appended the ID on rolled out records and split the file into two, based on the last field.
That would create 2 files having LRECL larger than SORTIN.
The ID has a one to one relationship with Department. That will be unloaded from table to a file. With the help of that file, I'll find out the ID that has to be appended. |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Bharath Bhat,
From whatever you've posted so far, I believe this can achieved without exit routines. Also are you trying to force an RC=4 if any single record is written into the unmatched file - SORTOUT2? |
|
Back to top |
|
|
Bharath Bhat
Active User
Joined: 20 Mar 2008 Posts: 283 Location: chennai
|
|
|
|
arcvns wrote: |
Bharath Bhat,
From whatever you've posted so far, I believe this can achieved without exit routines. Also are you trying to force an RC=4 if any single record is written into the unmatched file - SORTOUT2? |
I need an exit routine because the requirement is not just of 2 file or 3 file match-merge. I am very sorry if my explanation leads you guys that way.
On a high level,
I am getting a file consisting millions of records (existing path). I need to do a match merge with another file on the basis of Departments. We will get two files as output, viz, matched and unmatched file. The unmatched file will go in a path which already exists.
The matched file will be input to a cobol program which has the algorithm to find out the ID for each of the records depending upon Department,segment,brick (these are the fields in matched file).
The cobol program will append the ID to the records in the matched file and write it to output file. This will be used for the new path we are trying to create.
But, since the people I am working for are efficiency concious, They do not want me to read the files twice. i.e., once in Sort (for match-merge) and again in Cobol program(for appending ID). The reason for this is we are expecting Millions of records and the Job can simply go on for hours.
By using an exit routine we are trying to save 1 I/O processing per record.
Regarding the return code,
If we set a RETURN-CODE to 0 inside the Exit routine, SORT will accept the record. If RETURN-CODE is set to 4, It will not write it into SORTOUT. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
It will probably help if the requirement was posted in terms of what input data (all files) is to be processed and what output (all files) is to be written from the process along with suitable explanations of why each sample input record was selected or not selected and what rules were followed to create the output.
The volume of sample data does not need to be large, but just enough to demonstrate the full requirement. |
|
Back to top |
|
|
|