Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
Hello abhay,
You could always write program code to accomplish what you want. . .
You might also talk with the system support people to see if there is some other utility available on your system that would provide the functionality you want.
I still believe that your environment would be better served by installing the current release of your sort product.
Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
Shankar,
Quote:
Please check with the following code for your requirement.
This should work perfectly with that version . But what if "-" is present somewhere between column 8 till 80 (assuming the LRECL to be 80) as you have taken into consideration only the first 7 bytes. Guess you will have to add few more DD steps.
Joined: 25 Jun 2007 Posts: 196 Location: Bangalore
Aaru,
Quote:
But what if "-" is present somewhere between column 8 till 80 (assuming the LRECL to be 80) as you have taken into consideration only the first 7 bytes.
As sorting is happening on field with length 3, the possibility of string "-" should be present somewhere between column 1 and 77 and not in column 78, 79 and 80. Please correct me if i am wrong.
Joined: 25 Jun 2007 Posts: 196 Location: Bangalore
abhay pratap singh,
what is the mininum and maximum length of the field that occur before string "-"?
What is the LRECL and RECFM of your input file?
If you provide the above information it will be easy to provide you the exact solution accoring to the version available in your shop.
Thanks a lot shankar.Code is working and i have got the expected result.
But i have 2 doubts--
1) Whats the meaning of the outrec statement we are using in first sort.I am not getting the meaning of numbers we are using after 80.
2) Use of "OPTION COPY" in sysin card of first sort. Can we use SORT FIELDS=COPY here.
Joined: 25 Jun 2007 Posts: 196 Location: Bangalore
abhay pratap singh,
Quote:
Whats the meaning of the outrec statement we are using in first sort.I am not getting the meaning of numbers we are using after 80.
Three bytes after the string "-" is placed in 81st postion.
Quote:
Use of "OPTION COPY" in sysin card of first sort. Can we use SORT FIELDS=COPY here.
yes, you can use. OPTION COPY and SORT FIELDS=COPY are same.
Quote:
abhay pratap singh,
what is the mininum and maximum length of the field that occur before string "-"?
What is the LRECL and RECFM of your input file?
If you provide the above information it will be easy to provide you the exact solution accoring to the version available in your shop.
Joined: 25 Jun 2007 Posts: 196 Location: Bangalore
Quote:
Maximum length = 78,Minimum length=2
LRECL=80,RECFM=FB
.
As sorting is going to happen on three bytes, the maximum length of the field before string "-" should be 76. So that "-" will present in 77th column and we will get the last three bytes(78th byte, 79th byte and 80th byte) of the file for sorting.
In your case as the maximum length of the field before string "-" is 78,
if string "-" is present on 78, we will get last two bytes(79th byte and 80th byte) of the file for sorting, instead of three and
if string "-" is present on 79, we will get last one byte(80th byte) of the file for sorting, instead of three.
Maximum length = 78,Minimum length=2
LRECL=80,RECFM=FB
.
In your case as the maximum length of the field before string "-" is 78,
if string "-" is present on 78, we will get last two bytes(79th byte and 80th byte) of the file for sorting, instead of three and
if string "-" is present on 79, we will get last one byte(80th byte) of the file for sorting, instead of three.
What you want to do in the above case?
Both the cases are fine because if i am having 78 bytes before "-" then only two bytes i will have after "-" and similarly in the second case.So that is not a problem.