I am trying to sort a file which has records in batches (Blue is one batch and green is the other) and each batch has records of different types (20, 40, 60). The layout is like this:
aaaaaaaaaa 20 aa 2222222222
bbbbbbbbbb 40 bb low-values
dddddddddd 60 cc low-values eeeeeeeeee 20 dd 1111111111
gggggggggg 40 ee low-values
hhhhhhhhhh 60 ff low-values
Now only the 20 type records have account number value depicted here by 111111111 and 222222222, the 40 and 60 type records have low values…. I want the file to be sorted on the account number keeping the batch still together. In the above example the output should be like:
eeeeeeeeee 20 dd 1111111111
gggggggggg 40 ee low-values
hhhhhhhhhh 60 ff low-values aaaaaaaaaa 20 aa 2222222222
bbbbbbbbbb 40 bb low-values
dddddddddd 60 cc low-values
I tried using Syncsort to achieve this by copying the account number from the 20 type records to the end of all the records in the particular batch (after doing which the file would look like as follows), then sort the file on the added account number at the end of the record and then remove it from going to the output file by just copying the required fields to the output record.
aaaaaaaaaa 20 aa 2222222222 2222222222
bbbbbbbbbb 40 bb low-values 2222222222
dddddddddd 60 cc low-values 2222222222 eeeeeeeeee 20 dd 1111111111 1111111111
gggggggggg 40 ee low-values 1111111111
hhhhhhhhhh 60 ff low-values 1111111111
I used the following SYSIN card to achieve this and was able to copy the account number at the end of the 20 type record but not to the remaining records of the batch.. (The input file is 600 bytes in length and the account number is 19 byte long starting at 552)
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
Quote:
WER271A INREC STATEMENT : NUMERIC FIELD ERROR
This message indicates that you use SYNCSORT and NOT DFSORT. But PARSE function is supported by Syncsort Release 1.3. See the SYSOUT messages to see which version you're having.
BTW, Do you expect duplicate types (20, 40, 60) in each group?
I am not using SYNCSORT.. I am using DFSORT ICEMAN... I am sorry for mistakenly mentioning SYNCSORT in the subject line.. Thats why I posted the same topic under the DFSORT category.. I am sorry for the incovinience.. I wil take care of it going forward.. Could you please unlock the topic from DFSORT category? I need to get this solved ASAP... Am sorry again and thanks for being concerned...
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Quote:
WER271A INREC STATEMENT : NUMERIC FIELD ERROR
This message indicates you're using Syncsort. If you were using DFSORT, you'd see ICExxxs messages, not WERxxxs messages. Why do you think you're using DFSORT?
Thanks for straightening me out.. I am sorry I was not aware of that... How can we possibly achieve what I am looking for using SYNCSORT ... Please help...
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
Hello Abhi (and a belated welcome to the forum),
Which release of Syncsort is being used on your system? If you are not sure, the release is shown in the informational output created each time the sort is run.
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
Hello,
Thank you for posting your solution - good to hear it is working
As Terry mentions, it is best to use the "Code" tag when posting source code, jcl, etc as it is far more readable (in addition to the green on black, it also preserves alignment).
Your solution has been "Code"ed to wshow how it will appear. When you are posting this kind of info, you can use the Preview to see your post as it will appear to the forum rather than how it appears n the Reply editor. When you are satisfied with how it appears, Submit. Make sure you click Submit or your post will be lost (i've done that a time or few ).