Joined: 30 May 2007 Posts: 13 Topics: 5 Location: India
Posted: Fri Sep 17, 2010 1:31 am Post subject: Urgent help required for syncsort a file on multiple conds!!
Hi All,
I have a requirement where in I have an input file containing multiple layouts.It has different record types like 01, 02, 03 etc. Each record type is having a different unique key.I want to sort that input file for each record type and create a single output file.
Pls guide me if it is possible thru SORT utility.
The sample input file is
00 0000000000 header data 0000 00 00 00
01 9000000002 heirarchy data 0000 44 02 00
01 9000000002 heirarchy data 0000 41 02 00
02 9000000002 address data 0050 51 61 00
02 9000000002 address data 0051 52 63 00
03 9000000002 agreement data 0051 52 64 76
03 9000000002 agreement data 0051 52 64 77
-
-
-
88 0000000000 trailor data
record type 01 needs to be sorted on col5
record type 02 needs to be sorted on col6
record type 03 needs to be sorted on col7
I have done sorting based on a single criteria only.I will highly the valuable comments and suggestions from the Mainframer's.
Thanks
Rajat _________________ Rajat Gupta
when depressing thoughts seem to get you down
Put a smile on your face and thank God you're alive and still around.
record type 01 needs to be sorted on col5
record type 02 needs to be sorted on col6
record type 03 needs to be sorted on col7
What are field positions for col5,col6 and col7? Also, how many different record types are possible? Could you have "record type 04" and "record type 05" records? If so, what is the sorting order for them?
Also, Do you want records to be primarily sorted on "Record Types" and secondary sort on "col5","col6" and "col7"? What is LRECL and RECFM of the input file?
Joined: 30 May 2007 Posts: 13 Topics: 5 Location: India
Posted: Fri Sep 17, 2010 1:24 pm Post subject:
hi sqlcode, i can have a maximum of 16 record types and each record type needs to be sorted on a diff. Key.some parts of the keys are overlapping as well.it was a sample data which i had posted.for the time being we can assume that there are only 3 rec types(01,02 and 03) and each is having an independent criteria of sorting. rec type 01 needs to be sorted on col 1 to 3,rec type 02 on col 3 to 5,rec type 03 on col 3 to 8.if we can come up with a logic catering these 3 record types,later on we can cover all the possible scenarios.i know its a bit tricky thats why i am in search of expert advices from the experts.the file is a VB one with LRECL of 2000. _________________ Rajat Gupta
when depressing thoughts seem to get you down
Put a smile on your face and thank God you're alive and still around.
Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
Posted: Fri Sep 17, 2010 3:47 pm Post subject:
Quote:
later on we can cover all the possible scenarios.i know its a bit tricky thats why i am in search of expert advices from the experts.the file is a VB one with LRECL of 2000.
rajat_gupta,
It is NOT tricky or complicated. It is just a simple use of padding the key at a common place using an IFTHEN statement. why post in bits and pieces? post the entire requirement in one go. If your File is a VB file , how can you have data at pos 1 and 3? Assuming that you did not account for the RDW , where is the identifier for the record type?
Post the complete details not bits and pieces. Answer ALL questions
1. What is the position and format of the record type?
2. If the record type = 01 , then what is the position and format of the key to be sorted (please don't give me arbitrary positions)
3. Do the same for all the record types.
4. Do you need to consider the record type also as a key? or just the field? for ex
Joined: 30 May 2007 Posts: 13 Topics: 5 Location: India
Posted: Sat Sep 18, 2010 4:48 am Post subject:
Hi Kolusu,
Here we GO !!
1) I did'nt posted the data because it was a huge file of 2000 bytes.This time around also, I was only able to copy only a part of it.(staring 70 bytes for each record type but have modified the required keys accordingly)
2) The actual requirement is to identify the duplicates from this file(which will be later on done by a COBOL routine).The duplicates can come for any record type and any number of times.For ex if original Rec type 01 is at row no 2, the duplicates for this record type can arrive anywhere in the file(for ex. row no 3, row no 10, etc).This is happening because this file is a merged version of certain GDG generations which are receiving the data from upstream and more than 1 generations can contain the same repeated data.Even we need to arrange the duplicate headers and duplicate trailers as well based on their keys.
Note:: During the entire SORT process we are no where eliminating any records from the input file.Its just we are re-ordering them based on their record types and record keys.
In the Above Sample the last six records are duplicates which I have prefixed with "DUPLIC".
Data starts from pos 5 as its a VB file.Yes it needs to be sorted on Record type as well.
Pos 14-15 is the record type X(02).Sample values are 01,08,12,13,14,15 and 20.(At max I can receive 16.Minimum is 0)
Key for 01:
16,10,ch,A, (Acc no)
14,2,ch,A (rec type)
Key for 08:
16,10,ch,A, (Acc no)
14,2,ch,A, (rec type)
27,3,ch,A
Key for 12:
16,10,ch,A, (Acc no)
14,2,ch,A, (rec type)
29,2,ch,A
In the output file, for every account no I need to get all the record types in sorted order of their keys.
Sort cord could be of any length but we need a single output file in the same format (VB,2000).Waiting eagerly for any possible solution.
Many Thanks, _________________ Rajat Gupta
when depressing thoughts seem to get you down
Put a smile on your face and thank God you're alive and still around.
Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
Posted: Sat Sep 18, 2010 11:45 am Post subject:
rajat_gupta,
Your output does NOT match the sort criteria you have shown especially for the 08 type , how did 225 record come before 217 record? Assuming that it is a typo here is a DFSORT JCL which will give you the desired results
You already have the common key (16,10, and 14,2) for every record type all you need to account for is the additional 5 bytes you have for type 13. For that we pad 5 spaces right after the RDW and using an Ifthen we populate the contents on to that validating the record types. For record type 01 you don't need to. Since we added 5 bytes at the beginning the entire record is shifted by 5 bytes. After the sort is done we remove this temp 5 bytes using OUTREC to retain the original file length.
Joined: 30 May 2007 Posts: 13 Topics: 5 Location: India
Posted: Sun Sep 19, 2010 11:03 am Post subject:
Kolusu,
Thanks a Ton!
I have implemented this Logic for all the possible record types.
However I had missed a point while asking this question.
The key values I provided in sample data were all in Characters, however the actual data has got keys in BI (comp) and PD (comp3) format as well.
What I am doing for that is, I am converting all the binary and PD fields(using edit masks) and putting them together at starting position and then sorting on that.
I am able to do so but just have a small doubt,hope you can clarify that as well.
If in a file I am having a single field(VB 2000) defined as S9(9) comp and I am converting it to CH using the below edit mask,
Overlay=(5:5,4,BI,EDIT=(SIIIIIIIIT),SIGNS=(,-,,),
and after that If I sort that file based on the below Sort card,
SORT FIELDS=(5,10,CH,A), will it always produce the same result if I had given the sort condition directly on the original BI field, like below.(The BI field in signed and can contain both the positive and negative values).
SORT FIELDS=(5,4,BI,A)
I am bit afraid on moving this logic to production environment because of this threat raising in my mind.(Or if you can suggest an alternative approach to my problem).
Many Thanks, _________________ Rajat Gupta
when depressing thoughts seem to get you down
Put a smile on your face and thank God you're alive and still around.
Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
Posted: Sun Sep 19, 2010 11:49 am Post subject:
rajatgupta wrote:
I am bit afraid on moving this logic to production environment because of this threat raising in my mind.(Or if you can suggest an alternative approach to my problem).
rajat_gupta,
You should be very afraid. I specifically asked you about the format of keys to be sorted and yet you provide some arbitrary formats. You are just wasting my time as well as your time. A simple requirement which should have been solved in less than 15 minutes has now spanned over 2 days.
Quote:
The key values I provided in sample data were all in Characters, however the actual data has got keys in BI (comp) and PD (comp3) format as well.
What I am doing for that is, I am converting all the binary and PD fields(using edit masks) and putting them together at starting position and then sorting on that.
You shouldn't be doing any such stuff to convert the data. Sort is capable of sorting the various formats.
If you really need help , then start over once again and explain ALL the details of the keys involved with their position and format for each record type. _________________ Kolusu
www.linkedin.com/in/kolusu
Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
Posted: Mon Sep 20, 2010 11:33 am Post subject:
rajat_gupta,
It is really tough to get the requirements from you. Yesterday you are telling that you have positive and negative values for someone of the fields and today you show the fields as binary ( unsigned). Whatever happened to sorting of the record-type? Either way here is my final guess solution for you.
The biggest key you need to sort is 32 bytes. (type 02 and 03). We also have a common key of 6 bytes ( types 1 - 7 ). so we pad these right after RDW and pad 26 bytes for accommodating the largest key.
since we are padding extra 32 bytes , the entire record is shifted by 32 bytes. so you need to add 32 for all the positions you mentioned. ex: record type which is originally at position 18 is now at position 50.
I did not account for the record type in sorting. You can add that if you need it. Any field which can have positive and negative numbers should be sorted as FI format. Character data can be sorted as BI. So depending on the fields change your sort format.
Joined: 30 May 2007 Posts: 13 Topics: 5 Location: India
Posted: Tue Sep 21, 2010 9:25 am Post subject:
Thanks Kolusu,
This is working fine for all the key types except the rec type 07 which has a PD field in the Key.When I am running the Job Its throwing S000 U0016 Abend and giving an ARITHMETIC OVERFLOW.(Sort parameters are exactly the same which you mentioned)
Below is the Sysout for the Sort Step:
SYSDIAG= 295286, 1897435, 1897435, 2650575
24,620K BYTES OF VIRTUAL STORAGE AVAILABLE, MAX REQUESTED,
0 BYTES RESERVE REQUESTED, 24,572K BYTES USED
4K BYTES OF EMERGENCY SPACE ALLOCATED
SORTIN : RECFM=VB ; LRECL= 2000; BLKSIZE= 27998
INREC RECORD LENGTH = 2032
POTENTIALLY INEFFICIENT USE OF INREC
OUTREC RECORD LENGTH = 2000
SORTOUT : RECFM=VB ; LRECL= 2000; BLKSIZE= 27832
23,592K BYTES OF VIRTUAL STORAGE AVAILABLE ABOVE THE 16MEG LINE,
0 BYTES RESERVE REQUESTED, 23,592K BYTES USED
G=3134,SEGLEN=7848
INREC ARITHMETIC OVERFLOW
SYNCSMF CALLED BY SYNCSORT; RC=0000 _________________ Rajat Gupta
when depressing thoughts seem to get you down
Put a smile on your face and thank God you're alive and still around.
Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
Posted: Tue Sep 21, 2010 10:03 am Post subject:
rajat_gupta,
The messages indicates you are using SYNCSORT. I'm a DFSORT developer. DFSORT and Syncsort are competitive products. I'm happy to answer questions on DFSORT and DFSORT's ICETOOL, but I don't answer questions on Syncsort. _________________ Kolusu
www.linkedin.com/in/kolusu
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