MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Sort and copy

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
deep81this
Beginner


Joined: 26 Apr 2011
Posts: 4
Topics: 2

PostPosted: Wed Mar 30, 2016 9:59 am    Post subject: Sort and copy Reply with quote

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
View user's profile Send private message
deep81this
Beginner


Joined: 26 Apr 2011
Posts: 4
Topics: 2

PostPosted: Wed Mar 30, 2016 10:07 am    Post subject: Reply with quote

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
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Wed Mar 30, 2016 11:37 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group