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 

How to replace a byte in packed decimal using outrec

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


Joined: 27 May 2005
Posts: 14
Topics: 8

PostPosted: Sat Oct 18, 2008 9:00 pm    Post subject: How to replace a byte in packed decimal using outrec Reply with quote

Hi,

Here is my requirement: I have a packed decimal number from positions 2 to 9 in a file (picture cluase PIC S9(15) comp-3.) . I want to replace a particular byte using sort. e.g. I have a number 1059861611, I want to replace '8' with 0. This is to be done for all the records in the file. Can you please help me out?

Thanks!
Aniket.
_________________
Thanks,

Aniket.
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: Sun Oct 19, 2008 11:43 am    Post subject: Reply with quote

aniket,

If I understand correctly all you need to do is change the last nibble in byte 6 to 0 if it is 8. To do that you simply divide the 6th byte by 10(x'16') and get the remainder and check if it is 8 then multiply the 6th byte with 10(x'16') again so that it will be zero. I assumed that your input is FB recfm and 80 bytes in length.

Code:

//SYSIN    DD *                                           
  SORT FIELDS=COPY                                       
  INREC IFOUTLEN=80,                                     
  IFTHEN=(WHEN=INIT,OVERLAY=(81:6,1,BI,MOD,+16,EDIT=(T))),
  IFTHEN=(WHEN=(81,1,ZD,EQ,8),                           
  OVERLAY=(6:(6,1,BI,DIV,+16),MUL,+16,TO=BI,LENGTH=1))   
/*

_________________
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