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 

Extract record based on Seq No (HEX) & Key 3 using SORT

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


Joined: 03 Aug 2018
Posts: 4
Topics: 2

PostPosted: Fri Aug 03, 2018 3:48 pm    Post subject: Extract record based on Seq No (HEX) & Key 3 using SORT Reply with quote

Hi,

I have a below requirement and need a solution for this using DFSORT/any other utility

Code:

XXXX ____2018-08-01-13.49.53.655020Y123456 A  B
YYYY ____2018-08-01-13.52.31.311231Y123456 C  B
YYYY ____2018-08-01-13.52.31.311231Y123456 C  D


File length is 81 and its fixed

Y123456 is the key

The ____(Spaces) between XXXX/YYYY and timestamp has a sequence no (Type: INTEGER) but its not visible. Once I turn HEX ON and it has value 0001,0002,0003 for record 1,2 &3 respectively.

I need to extract record which has maximum sequence no for distinct keys (Sequence No 3 & Key Y123456 in this case)

I am not sure how many records will be there in input file for a given key.

Output should be:
Code:

YYYY ____2018-08-01-13.52.31.311231Y123456 C  D



Thanks !
_________________
Mainframe Developer
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Fri Aug 03, 2018 4:50 pm    Post subject: Reply with quote

gps_94,

You can use the following DFSORT/ICETOOL JCL which will give you the desired results.

I assumed that your Key Y123456 is at position 36 for a length of 7 bytes and the sequence number is at position 6 for a length of 4 bytes.

Code:

//STEP0100 EXEC PGM=ICETOOL                             
//TOOLMSG  DD SYSOUT=*                                   
//DFSMSG   DD SYSOUT=*                                   
//IN       DD DISP=SHR,DSN=Your Input file
//OUT      DD SYSOUT=*                                   
//TOOLIN   DD *                                         
  SELECT FROM(IN) TO(OUT) ON(36,7,CH) FIRST USING(CTL1) 
/*                                                       
//CTL1CNTL DD *                                         
  SORT FIELDS=(36,7,CH,A,                               
               06,4,FI,D)                               
/*


The output would be
Code:

YYYY     2018-08-01-13.52.31.311231Y123456 C  D

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


Joined: 03 Aug 2018
Posts: 4
Topics: 2

PostPosted: Fri Aug 03, 2018 5:16 pm    Post subject: Reply with quote

Thanks a lot Kolusu .

Also, if you can tell me how we can achieve this using DFSORT instead of using SYNCSORT.
_________________
Mainframe Developer
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Fri Aug 03, 2018 5:25 pm    Post subject: Reply with quote

gps_94 wrote:
Thanks a lot Kolusu .

Also, if you can tell me how we can achieve this using DFSORT instead of using SYNCSORT.


gps_94,

DFSORT and Syncsort are competitive products. I'm a DFSORT developer. I'm happy to answer questions on DFSORT and DFSORT's ICETOOL, but I don't answer questions on Syncsort.
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Sat Aug 04, 2018 3:34 am    Post subject: Reply with quote

That WAS a DFSort solution!
_________________
Utility and Program control cards are NOT, repeat NOT, JCL.
Back to top
View user's profile Send private message
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