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 

Search Part of Hexdecimal string and copy

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


Joined: 29 May 2007
Posts: 165
Topics: 77

PostPosted: Wed Jun 25, 2014 12:51 am    Post subject: Search Part of Hexdecimal string and copy Reply with quote

In my input file a 4byte hexdeciaml string starting from 2 column. I need to copy all records for which second PD digit is greater than '12'.


input file

Code:


000001 P   *16  @029       
       D2115FF007FFF0044444
       7023C1604C0290F00000
---------------------------
000002 P    36 Ã¥ 023       
       D2112FF040FFF0044444
       7034C3607C0230F00000
---------------------------
000003 P   %57  *027       
       D2136FF005FFF0044444
       7031C5774C0270F00000
---------------------------
000004 P   @19  *033       
       D2117FF005FFF0044444
       7023C1979C0330F00000
---------------------------
000005 P    69  ð022       
       D2112FF008FFF0044444
       7043C6904C0220F00000     




Output file should contain below recs.

Code:


000002 P    36 Ã¥ 023       
       D2112FF040FFF0044444
       7034C3607C0230F00000
---------------------------
000003 P   %57  *027       
       D2136FF005FFF0044444
       7031C5774C0270F00000
---------------------------
000005 P    69  ð022       
       D2112FF008FFF0044444
       7043C6904C0220F00000     





I tried below sortcard but it is not working as desired


Code:


//SYSIN     DD *                   
 SORT FIELDS=COPY                   
 INCLUDE COND=(03,02,PD0,GT,X'12') 
 END                               
/*                                 




Thanks,
Siva
Back to top
View user's profile Send private message  
William Collins
Supermod


Joined: 03 Jun 2012
Posts: 437
Topics: 0

PostPosted: Wed Jun 25, 2014 3:11 am    Post subject: Reply with quote

Code:
//SYSIN     DD *                   
 SORT FIELDS=COPY                   
 INCLUDE COND=(03,01,CH,GT,X'12')


You had specified a length for the field of two bytes, the value you are comparing to is only one. Why use PD0 and X'cc'? So I went for CH and the X'12'. Experiment.
Back to top
View user's profile Send private message  
kolusu
Site Admin
Site Admin


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

PostPosted: Wed Jun 25, 2014 10:46 am    Post subject: Reply with quote

sivafdms,

You cannot use PD0 in this case as the hex values looks like this in hex for position 3 and length 2 bytes

Code:

X'1213'
X'1314'
X'1331'
X'1213'
X'1413'


PD0 ignores the leading and trailing , so you are left with

Code:

X'21'
X'31'
X'33'
X'21'
X'41'


And all of them are greater than X'12', so it copied all the records.

You need to use Williams suggestion of validating just 1 byte with hex format like he has shown.
_________________
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