View previous topic :: View next topic |
Author |
Message |
deep81this Beginner
Joined: 26 Apr 2011 Posts: 4 Topics: 2
|
Posted: Wed Mar 30, 2016 9:59 am Post subject: Sort and copy |
|
|
I have a requirement in which
File-1
pos 1-13 is the sort key for all records other than starting with '8 44' or '8 40' ;
col 14 can have 2,3,4 etc which denotes transaction type. If there is a 4 type, it shud come only after 3 type and always comes as a pair.
Records of '8 44' starting at pos 2 can come as a byproduct of record type 3, as a different record.
Records of '8 40' starting at pos 2 comes as a trailer for every break in pos 1-7(key within main sort key). Code: |
********************************* Top of Data *****************
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+-
0216CDH33367036 P 11501603281
8 4416CDH02160328 333670P3FGL 56
0216CDH33367046 P4 11501603281
0216CDH33367536 P 11001603281
0216CDH33367546 P 11001603281
0216CDH33367636 P 11001603281
8 4416CDH02160328 333676P3KGL 56
0216CDH33367646 P4 11001603281
8 4016CDH02160328 032 010003900039
8 4016CDH02160328 032 020003900039
0316TUBD0374636 T 11001603281
0316TUBD0374646 T 11001603281
8 4016TUB03160328 032 0100051000510000000
8 4016TUB03160328 032 0200051000510000000
0417TBCB0045736 T 11001603281
0417TBCB0045746 T 11001603281
8 4017TBC04160328 032 0100001000010000000
8 4017TBC04160328 032 0200001000010000000
0616TFCE5144546 T 11001603281
0616TFCE5160436 T 11001603281
8 4416TFC06160328 E51604W1EGK 56
0616TFCE5160446 T1 11001603281
0616TFCE5646236 T 11001603281
0616TFCE5646246 T 11001603281
8 4016TFC06160328 032 010005700057
8 4016TFC06160328 032 020005700057
******************************** Bottom of Data *************** |
File-2
pos 1-13 is the sort key; col 14 is always space(a diff kind of transaction record) Code: |
********************************* Top of Data *****************
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+-
0316TUBC70033 6 T 1 160303
0316TUBC70237 6 T 1 160303
0616TFCE31620 6 T 1 160303
0816CZG309075 6 P 1 160303
0816CZG310534 6 P 1 160303
1016TFAC62710 6 T 1 160303
******************************** Bottom of Data *************** |
Requirement is to concatenate file-1 & file-2....or to insert the records in file-2 to file-1 based on pos 1-13, without affecting '8 44' or '8 40' records. Kindly help. |
|
Back to top |
|
|
deep81this Beginner
Joined: 26 Apr 2011 Posts: 4 Topics: 2
|
Posted: Wed Mar 30, 2016 10:07 am Post subject: |
|
|
output file shud be like:
Result file: Code: |
********************************* Top of Data ******************
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+-
0216CDH33367036 P 11501603281
8 4416CDH02160328 333670P3FGL 56
0216CDH33367046 P4 11501603281
0216CDH33367536 P 11001603281
0216CDH33367546 P 11001603281
0216CDH33367636 P 11001603281
8 4416CDH02160328 333676P3KGL 56
0216CDH33367646 P4 11001603281
8 4016CDH02160328 032 010003900039
8 4016CDH02160328 032 020003900039
0316TUBC70033 6 T 1 160303
0316TUBC70237 6 T 1 160303
0316TUBD0374636 T 11001603281
0316TUBD0374646 T 11001603281
8 4016TUB03160328 032 0100051000510000000
8 4016TUB03160328 032 0200051000510000000
0417TBCB0045736 T 11001603281
0417TBCB0045746 T 11001603281
8 4017TBC04160328 032 0100001000010000000
8 4017TBC04160328 032 0200001000010000000
0616TFCE31620 6 T 1 160303
0616TFCE5144546 T 11001603281
0616TFCE5160436 T 11001603281
8 4416TFC06160328 E51604W1EGK 56
0616TFCE5160446 T1 11001603281
0616TFCE5646236 T 11001603281
0616TFCE5646246 T 11001603281
8 4016TFC06160328 032 010005700057
8 4016TFC06160328 032 020005700057
0816CZG309075 6 P 1 160303
0816CZG310534 6 P 1 160303
1016TFAC62710 6 T 1 160303
******************************** Bottom of Data *************** |
|
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
Posted: Wed Mar 30, 2016 11:37 am Post subject: |
|
|
deep81this,
I am not sure as to why you posted this question in Application programming forum where this type of questions belong to Utilities forum.
Please answer the following questions
1. What is the LRECL and RECFM of file1
2. What is the LRECL and RECFM of file2
3. What is the LRECL and RECFM of the Output file?
Did you try using DFSORT Joinkeys and see if you can get the desired results? _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
|
|