|
View previous topic :: View next topic
|
| Author |
Message |
jackare
New User

Joined: 27 Aug 2008 Posts: 35 Location: Brazil
|
|
|
|
Hello folks!
I need some help here.
This is my SORTIN
| Code: |
00 0000 HEADER 0002
01 0001 01.01.2011
01 0002 31.12.2010
01 0003 28.11.2010
99 9999 TRAILER 0003
00 0000 HEADER 0001
01 0001 08.01.2011
99 9999 TRAILER 0001
|
Layout of SORTIN
a) The layout of the first 8 characters for all types of records is the same:
(01,02,ch) --> Record type: 00 is Header, 01 is detail, 99 is Trailer
(03,01,ch) --> Filler (space)
(04,04,ch) --> Record sequence: 0000 is Header, 9999 is Trailer and 0001 til 9998 is reserved to record detail.
(08,01,ch) --> Filler (space)
b) Header
(09,09,ch) --> Fileid Text (Its is the same for all fileid number)
(18,04,ch) --> Fileid number (This field is different for each Header and is very important to my process)
c) trailer
(09,09,ch) --> Fileid Text (Its is the same for all fileid number, it's not important to my process)
(18,04,ch) --> Total detail records
Well, let's go to the grand finale: In my sortin there are two files into one, because the file has two headers and two trailers. I have to include the fileid field in all records from the header to the trailer, then I have to sort the file using this new field.
This is the result expected
| Code: |
00 0000 HEADER 0001 0001
01 0001 08.01.2011 0001
99 9999 TRAILER 0001 0001
00 0000 HEADER 0002 0002
01 0001 01.01.2011 0002
01 0002 31.12.2010 0002
01 0003 28.11.2010 0002
99 9999 TRAILER 0003 0002 |
The last 4 chars corresponding to position (18,04,ch) of Header.
Thanks! |
|
| Back to top |
|
 |
Guest
|
|
|
|
Hi,
The following DFSORT statements will do what you want
| Code: |
//SYSIN DD *
INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,2,CH,EQ,C'00'),PUSH=(23:18,4))
OPTION EQUALS
SORT FIELDS=(23,4,CH,A)
|
devil13
There is always a better solution. |
|
| Back to top |
|
 |
jackare
New User

Joined: 27 Aug 2008 Posts: 35 Location: Brazil
|
|
|
|
Hi devil13,
Yes, it's working very well. Thanks a lot! |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|