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 

DFSORT with JOINKEYS question

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


Joined: 16 Jun 2010
Posts: 2
Topics: 1

PostPosted: Tue Aug 04, 2015 6:41 pm    Post subject: DFSORT with JOINKEYS question Reply with quote

I have an input file that includes a list of "good" users:

Code:

//IN1      DD  *       
  DBFM                 
  DB2P                 
  DCSR                 


I have another input file that includes information about these and other users. If a user on this file is on the "good" user list, I would like to update columns 40 - 80 with all nines (9999999...). There can be more than one entry per user on this list (see DBFM).

Code:

//IN2      DD  *                                                     
  A23201DBFMLA  01LA  DBFM15174075457DBFM2043020201010010101010001010
  A23201DBFM01  0101  DBFM15215142951DBFM0000202001010010101000101001
  A23201DBLG01  0101  DBLG10228164730SDRW0000000000000000000000000000
  A23201DB2P01  0101  DCAB10228164750SDRW0000000000000000000000000000
  A23201DCAH01  0101  DCAH12124075531DCAH0020203020202000000200010011
  A23201DCSR01  0101  DCPX13197091121SHXL0000000000000000000001000000
  A23201DC1G01  0101  DC1G10228164827SDRW0000000000000000000000000000
  A23201DC2B01  0101  DC2B10228164835SDRW0000000000000000000000000000
  A23201DDDR01  0101  DDDR13080210054SCLN2020202020202020200000000000
  A23201DD1S01  0101  DD1S12124075521DD1S0000101001101010101010101011


I feel this is doable with JOINKEYS, but I not sure how to make this work. I would like the results to look like this:

Code:

A23201DBFMLA  01LA  DBFM15174075457DBFM9999999999999999999999999999
A23201DBFM01  0101  DBFM15215142951DBFM9999999999999999999999999999
A23201DBLG01  0101  DBLG10228164730SDRW0000000000000000000000000000
A23201DB2P01  0101  DCAB10228164750SDRW9999999999999999999999999999
A23201DCAH01  0101  DCAH12124075531DCAH0020203020202000000200010011
A23201DCSR01  0101  DCPX13197091121SHXL9999999999999999999999999999
A23201DC1G01  0101  DC1G10228164827SDRW0000000000000000000000000000
A23201DC2B01  0101  DC2B10228164835SDRW0000000000000000000000000000
A23201DDDR01  0101  DDDR13080210054SCLN2020202020202020200000000000
A23201DD1S01  0101  DD1S12124075521DD1S0000101001101010101010101011


Thank you very much in advance for any assistance you can provide.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Tue Aug 04, 2015 10:05 pm    Post subject: Reply with quote

bmeansdfw,

It is quite simple to get the desired results using Joinkeys. You did not mention the position of the key to be matched and the DCB properties.

I made the following assumptions.

1. It is a good practice to use high volume files as IN1 and the low volume file as IN2.

2. I assumed that the file1 has an LRECL=80 and RECFM=FB and the key is at position 7 for a length of 4 and the data is already sorted on the key. If not you just need to remove the parms SORTED,NOSEQCK on the Joinkeys statement.

3. I assumed that the file2 has an LRECL=80 and RECFM=FB and the key is at position 1 for a length of 4 and the data is already sorted on the key. If not you just need to remove the parms SORTED,NOSEQCK on the Joinkeys statement.

Use the following UNTESTED JCL which will give you the desired results.
Code:

//STEP0100 EXEC PGM=SORT                                             
//SYSOUT   DD SYSOUT=*                                               
//INA      DD *                                                       
A23201DBFMLA  01LA  DBFM15174075457DBFM2043020201010010101010001010   
A23201DBFM01  0101  DBFM15215142951DBFM0000202001010010101000101001   
A23201DBLG01  0101  DBLG10228164730SDRW0000000000000000000000000000   
A23201DB2P01  0101  DCAB10228164750SDRW0000000000000000000000000000   
A23201DCAH01  0101  DCAH12124075531DCAH0020203020202000000200010011   
A23201DCSR01  0101  DCPX13197091121SHXL0000000000000000000001000000   
A23201DC1G01  0101  DC1G10228164827SDRW0000000000000000000000000000   
A23201DC2B01  0101  DC2B10228164835SDRW0000000000000000000000000000   
A23201DDDR01  0101  DDDR13080210054SCLN2020202020202020200000000000   
A23201DD1S01  0101  DD1S12124075521DD1S0000101001101010101010101011   
//INB      DD *                                                       
DBFM                                                                 
DB2P                                                                 
DCSR                                                                 
//SORTOUT  DD SYSOUT=*                                               
//SYSIN    DD *                                                       
  OPTION COPY                                                         
  JOINKEYS F1=INA,FIELDS=(7,4,A),SORTED,NOSEQCK                       
  JOINKEYS F2=INB,FIELDS=(1,4,A),SORTED,NOSEQCK                       
  JOIN UNPAIRED,F1                                                   
  REFORMAT FIELDS=(F1:1,80,?)                                         
  INREC IFOUTLEN=80,                                                 
  IFTHEN=(WHEN=(81,1,CH,EQ,C'B'),OVERLAY=(40:41C'9'))                 
//*

_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
bmeansdfw
Beginner


Joined: 16 Jun 2010
Posts: 2
Topics: 1

PostPosted: Thu Aug 06, 2015 1:59 pm    Post subject: Reply with quote

Thanks, Kolusu.

I did have to change INA and INB to SORTJNF1 and SORTJNF2 (and the JOINKEYS reference to them), but once I did that it worked like a charm!
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Thu Aug 06, 2015 2:39 pm    Post subject: Reply with quote

bmeansdfw wrote:
Thanks, Kolusu.

I did have to change INA and INB to SORTJNF1 and SORTJNF2 (and the JOINKEYS reference to them), but once I did that it worked like a charm!


bmeansdfw,

The job posted above works fine asis with DFSORT and if you had to change the INA/INB to SORTJNF1/SORTJNF2 respectively, then you are using syncsort.

Please keep that in mind to quote that in your future posts as it wouldn't be ethical to seek a solution from competitive developer. I'm a DFSORT developer and I'm happy to answer questions on DFSORT and DFSORT's ICETOOL, but I don't answer questions on Syncsort as DFSORT and Syncsort are competitive products.
_________________
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