can some one clear my basic doubt. it goes like this.......
i want to sort a sequential file, but skipping the first and last records to be sorted. in my output file these two unsorted records must appear as first and last records itself.........
example: i have 10 records as input. sort records 2 to 9. output file must have 10 records with first record same as the first record in the input file and 10 th record must be last record in input file.....
hope every one reading it got a clear picture of what is required....
shows one way to do this with DFSORT. You'll need z/OS DFSORT V1R5 PTF UQ95214 or DFSORT R14 PTF UQ95213 (Dec, 2004) in order to use DFSORT's IFTHEN and OVERLAY functions. Only DFSORT has these functions, so if you don't have DFSORT, you won't be able to use them. If you do have DFSORT, but you don't have the Dec, 2004 PTF, ask your System Programmer to install it (it's free). For complete details on all of the new DFSORT and ICETOOL functions available with the Dec, 2004 PTF, see:
If you need more specific help, you'll need to show an example of what the input records look like and what you want the output records to look like, and indicate the position, length and format of the key you want to use and the RECFM and LRECL of the input file.
I assume you're trying to sort the data records on the first 15 characters. But as you can see, the hdg... record appears after the wue... record instead of before it, which is not what you want. Sure, the header record (0 = X'F0') and trailer record (9 = X'F9') will be sorted in the right place, but the rest of the records may or may not be depending on the values in each key field. Here's why:
With 1,15,ZD, the zone is stripped off each byte for sorting purposes, so byte 6 of each record is transformed like this for sorting:
Code:
0 = X'F0' -> 0
w = X'A6' -> 6
h = X'88' -> 8
d = X'84' -> 4
d = X'84' -> 4
9 = X'F9' -> 9
resulting in the following order after sorting:
Code:
0 = X'F0' -> 0
d = X'84' -> 4
d = X'84' -> 4
w = X'A6' -> 6
h = X'88' -> 8
9 = X'F9' -> 9
As you can see the w (6) sorts before the h (8) which is NOT what you want.
The problem with this scheme is that the hex values of the letters are in groups (e.g. 8x, 9x and Ax for the lowercase letters), so you can't just use the last nibble (x) to sort on as ZD does. For example, h = X'88' and w = X'A6' can't be sorted that way.
So unless there's something special about your data that you're not telling me about, that scheme won't work.
I'd suggest you use the method in the Smart DFSORT Trick I gave you the link for. It does work for all cases.