Portal | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
DFSORT Output file order query

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
A_programmers

New User


Joined: 24 Mar 2010
Posts: 16
Location: USA

PostPosted: Thu Mar 26, 2020 11:59 pm    Post subject: DFSORT Output file order query
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: 309
Location: Bamberg, Germany

PostPosted: Fri Mar 27, 2020 1:11 am    Post subject:
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: 16
Location: USA

PostPosted: Thu Apr 09, 2020 4:10 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts DB2 - row_number function - Need 1st ... Q5P418 DB2 5 Wed Sep 09, 2020 8:35 am
No new posts TWS - ETT File triggering does not wo... me00266 IBM Tools 4 Mon Sep 07, 2020 11:58 pm
No new posts How to process dependent file based o... HithaSri JCL & VSAM 8 Sun Sep 06, 2020 12:42 pm
No new posts EIBRESP =16 & EIBRESP2 = 01 while... Farheen CICS 4 Mon Aug 24, 2020 2:05 pm
No new posts how to show listing in physical locat... Lynne Schuler PL/I & Assembler 2 Sat Aug 22, 2020 9:56 pm

Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us