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 

Drop 'unpaired' key records based on value in another field.

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


Joined: 10 Feb 2006
Posts: 188
Topics: 68

PostPosted: Fri Jan 31, 2014 10:11 am    Post subject: Drop 'unpaired' key records based on value in another field. Reply with quote

Hi, I have a situation where I need to drop 'unpaired' records based on a 'status' field...

Here is my input:

Key Field Status
1111111111 1D
1111111111 1A
2222222222 1D <- drop record since it has no '1A' record following
3333333333 1D
3333333333 1A
4444444444 1A

I would like to DROP all records (based on key field in bytes 1-10) that
have only a status '1D' record (as in key record 2222222222 from above).

Thanks for any help.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Fri Jan 31, 2014 12:12 pm    Post subject: Re: drop 'unpaired' key records based on value in another fi Reply with quote

tcurrier,

Quite simple. Using the following DFSORT/ICETOOL JCL which will give you the desired results
Code:

//STEP0100 EXEC PGM=ICETOOL                                         
//TOOLMSG  DD SYSOUT=*                                               
//DFSMSG   DD SYSOUT=*                                               
//IN       DD *                                                     
1111111111 1D                                                       
1111111111 1A                                                       
2222222222 1D <- DROP RECORD SINCE IT HAS NO '1A' RECORD FOLLOWING   
3333333333 1D                                                       
3333333333 1A                                                       
4444444444 1A                                                       
//OUT      DD SYSOUT=*                                               
//TOOLIN   DD *                                                     
  SELECT FROM(IN) TO(OUT) ON(1,10,CH) ON(81,2,CH) ALLDUPS USING(CTL1)
//CTL1CNTL DD *                                                     
  INREC OVERLAY=(81:12,2,TRAN=ALTSEQ)                               
  ALTSEQ CODE=(C4C1)                                                 
  OUTFIL BUILD=(1,80)                                               
//*

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


Joined: 10 Feb 2006
Posts: 188
Topics: 68

PostPosted: Fri Jan 31, 2014 1:46 pm    Post subject: Reply with quote

Thanks, Kolusu-

The 2222222222 1D record was dropped as expected, but the
4444444444 1A record was also dropped... I only wanted to drop
records if there was a single 1D record.... Thanks.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Fri Jan 31, 2014 2:19 pm    Post subject: Reply with quote

tcurrier,

If that is the case then use JOINKEYS, using the same file twice.

Code:

//STEP0100 EXEC PGM=SORT                                         
//SYSOUT   DD SYSOUT=*                                           
//INA      DD *                                                   
1111111111 1D                                                     
1111111111 1A                                                     
2222222222 1D <- DROP RECORD SINCE IT HAS NO '1A' RECORD FOLLOWING
3333333333 1D                                                     
3333333333 1A                                                     
4444444444 1A                                                     
//INB      DD *                                                   
1111111111 1D                                                     
1111111111 1A                                                     
2222222222 1D <- DROP RECORD SINCE IT HAS NO '1A' RECORD FOLLOWING
3333333333 1D                                                     
3333333333 1A                                                     
4444444444 1A                                                     
//SORTOUT  DD SYSOUT=*                                           
//SYSIN    DD *                                                   
  OPTION COPY                                                     
  JOINKEYS F1=INA,FIELDS=(1,10,A)                                 
  JOINKEYS F2=INB,FIELDS=(1,10,A)                                 
  REFORMAT FIELDS=(F1:1,80)                                       
//*                                                               
//JNF2CNTL DD *                                                   
  OMIT COND=(12,2,CH,EQ,C'1D')                                   
//*

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


Joined: 10 Feb 2006
Posts: 188
Topics: 68

PostPosted: Fri Jan 31, 2014 4:21 pm    Post subject: Reply with quote

oops... our shop uses SYNCSORT.... that must be the issue here?

Code:
 SYNCSORT FOR Z/OS  1.4.0.1N    U.S. PATENTS: 4210961, 5117495   (C)
                            100312: SYNCSORT Z/OS 1.4.01 ZY Z/OS  +SY
 SYNCSORT LICENSED FOR CPU SERIAL NUMBER 55BA6, MODEL 2817 708       
 SYSIN :                                                             
   OPTION COPY                                                       
   JOINKEYS F1=INA,FIELDS=(1,10,A)                                   
            *                                                       
   JOINKEYS F2=INB,FIELDS=(1,10,A)                                   
            *                                                       
   REFORMAT FIELDS=(F1:1,80)                                         
 WER268A  JOINKEYS STATEMENT: SYNTAX ERROR                           
 WER268A  JOINKEYS STATEMENT: SYNTAX ERROR                           
 WER211B  SYNCSMF  CALLED BY SYNCSORT; RC=0000                       
 WER449I  SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE                       
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Fri Jan 31, 2014 4:59 pm    Post subject: Reply with quote

tcurrier wrote:
oops... our shop uses SYNCSORT.... that must be the issue here?


Of course it is an issue as syncsort doesn't support DFSORT syntax and JNF1/JNF2CNTL. I'm a DFSORT developer. DFSORT and Syncsort are competitive products. I'm happy to answer questions on DFSORT and DFSORT's ICETOOL, but I don't answer questions on Syncsort.

You might have to change your jcl to something like this

http://www.mvsforums.com/helpboards/viewtopic.php?p=42970#42970

and move your omit cond to joinkeys

Good luck
_________________
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