IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search Log in to check your private messages Log in
 

DFSORT Output file order query


 
IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: :: View next topic  
Author Message
A_programmers

New User


Joined: 24 Mar 2010
Posts: 17
Location: USA

PostPosted: Thu Mar 26, 2020 11:59 pm
Reply with quote

Dear friends,

I am working on joining two files as mentioned below. I want to keep the order of file 1 as it is in the output. Whereas I can see that DFSORT is sorting output based on the joinkey. Any idea how can I join 2 files and keep the order of the output same as file 1 as requested below ?


File 1 :

TEST.T1
-----------
Code:
AAA 001 PQR
ZZZ 009 ADR
QQQ 231 PFR
CCC 031 FDR
BBB 201 DSR
LLL 031 QAR


File 2 :

TEST.T2
-----------
Code:
ZZZ 009 ADR TEST1
AAA 001 PQR TEST2
BBB 201 DSR TEST3
CCC 031 FDR TEST4
LLL 031 QAR TEST5
QQQ 231 PFR TEST6


Output file generated :

File 3 :

TEST.T3
-----------
Code:
AAATEST2
BBBTEST3
CCCTEST4 
LLLTEST5   
QQQTEST6 
ZZZTEST1


Expected output :

Code:
AAATEST2
ZZZTEST1 
QQQTEST6 
CCCTEST4 
BBBTEST3
LLLTEST5   


Sort job I have used :

Code:
//STEP01 EXEC PGM=SRT
//SORTJNF1 DD DSN=TEST1.T1,DISP=SHR
//SORTJNF2 DD DSN=TEST1.T2,DISP=SHR
//SORTOUT  DD DSN=TEST1.T3,DISP=(NEW,CATLG,CATLG),DCB=(RECFM=FB,BLZSIZE=0),
//         SPACE=(CYL,(10,10),RLSE),UNIT=SYSDA
//SYSOUT   DD SYSOUT=*
//SYSDUMP  DD SYSOUT=*
//SYSIN DD *
  SORT FIELDS=COPY
  JOINKEYS FILE=F1,FIELDS=(1,3,A)
  JOINKEYS FILE=F2,FIELDS=(1,3,A)
  JOIN UNPAIRED,F1
  REFORMAT FIELDS=(F1:1,3,F2:13,5)
  OPTION EQUALS
/*

Please note; input files will not be in sorted order.
Back to top
View user's profile Send private message
Joerg.Findeisen

Active User


Joined: 15 Aug 2015
Posts: 350
Location: Bamberg, Germany

PostPosted: Fri Mar 27, 2020 1:11 am
Reply with quote

Code:
//SIMPLE   EXEC PGM=ICEMAN                   
//F1       DD *                             
AAA 001 PQR                                 
ZZZ 009 ADR                                 
QQQ 231 PFR                                 
CCC 031 FDR                                 
BBB 201 DSR                                 
LLL 031 QAR                                 
/*                                           
//F2       DD *                             
ZZZ 009 ADR TEST1                           
AAA 001 PQR TEST2                           
BBB 201 DSR TEST3                           
CCC 031 FDR TEST4                           
LLL 031 QAR TEST5                           
QQQ 231 PFR TEST6                           
/*                                           
//SORTOUT  DD SYSOUT=*                       
//SYSOUT   DD SYSOUT=*                       
//SYSIN DD *                                 
  JOINKEYS F1=F1,FIELDS=(1,3,A)             
  JOINKEYS F2=F2,FIELDS=(1,3,A)             
  JOIN UNPAIRED,F1                           
  REFORMAT FIELDS=(F1:1,3,F2:13,5,F1:40,4)   
  SORT FIELDS=(9,4,ZD,A)                     
  OUTFIL FNAMES=(SORTOUT),BUILD=(1,8)       
/*                                           
//JNF1CNTL DD *                                     
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(40:SEQNUM,4,ZD))
  END                                               
/*

Output:
Code:
AAATEST2
ZZZTEST1
QQQTEST6
CCCTEST4
BBBTEST3
LLLTEST5
Back to top
View user's profile Send private message
A_programmers

New User


Joined: 24 Mar 2010
Posts: 17
Location: USA

PostPosted: Thu Apr 09, 2020 4:10 pm
Reply with quote

Thanks Joerg. It is working as expected. Appreciate your help.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Forum Replies
No new posts COBOL VS SORT Utility for file format... COBOL Programming 6
No new posts How to find which file contains my se... DFSORT/ICETOOL 6
No new posts IGZ0035S THERE WAS AN UNSUCCESSFUL OP... COBOL Programming 3
No new posts Hex Value - vb file replace old date ... DFSORT/ICETOOL 14
No new posts Related to using a file in comparison JCL & VSAM 7

Back to Top