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 

Display a character in binary format like c'11000001' for A

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


Joined: 25 Jul 2004
Posts: 46
Topics: 20

PostPosted: Sat Aug 26, 2006 4:22 am    Post subject: Display a character in binary format like c'11000001' for A Reply with quote

hey,everyone

I got a guestion,how to display a character in binary format?
for example:
Code:

2(X'F2')----->11110010
1(X'F1')------>11110001
A(X'C1')------>11000001
.(X'05')------->00000101


I come up with a solution as below (assume the first byte should be transformed)
Code:

OUTREC FIELDS=(1,1,BI,MOD,+256,DIV,+128,EDIT=(T)
               1,1,BI,MOD,+128,DIV,+064,EDIT=(T),
               1,1,BI,MOD,+064,DIV,+032,EDIT=(T),
               1,1,BI,MOD,+032,DIV,+016,EDIT=(T),
               1,1,BI,MOD,+016,DIV,+008,EDIT=(T),
               1,1,BI,MOD,+008,DIV,+004,EDIT=(T),
               1,1,BI,MOD,+004,DIV,+002,EDIT=(T),
               1,1,BI,MOD,+002,DIV,+001,EDIT=(T))


Though it works fine, but it looks like a little tiny stupid.
As there's so many tricks in dfsort,I think maybe you can figure out a more smart and simple solution.If so,please let me know
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Sat Aug 26, 2006 9:52 am    Post subject: Reply with quote

Not sure is this is more smart and simple, but these DFSORT control statements are a bit more straightforward as they test the bits directly (similar to TM):

Code:

  OPTION COPY                                                       
  INREC IFOUTLEN=8,                                                 
   IFTHEN=(WHEN=INIT,BUILD=(1:8C'0',9:1,1)),                       
   IFTHEN=(WHEN=(9,1,BI,BO,X'80'),OVERLAY=(1:C'1'),HIT=NEXT),       
   IFTHEN=(WHEN=(9,1,BI,BO,X'40'),OVERLAY=(2:C'1'),HIT=NEXT),       
   IFTHEN=(WHEN=(9,1,BI,BO,X'20'),OVERLAY=(3:C'1'),HIT=NEXT),       
   IFTHEN=(WHEN=(9,1,BI,BO,X'10'),OVERLAY=(4:C'1'),HIT=NEXT),       
   IFTHEN=(WHEN=(9,1,BI,BO,X'08'),OVERLAY=(5:C'1'),HIT=NEXT),       
   IFTHEN=(WHEN=(9,1,BI,BO,X'04'),OVERLAY=(6:C'1'),HIT=NEXT),       
   IFTHEN=(WHEN=(9,1,BI,BO,X'02'),OVERLAY=(7:C'1'),HIT=NEXT),       
   IFTHEN=(WHEN=(9,1,BI,BO,X'01'),OVERLAY=(8:C'1'))                 

_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Mon Oct 25, 2010 4:53 pm    Post subject: Reply with quote

With z/OS DFSORT V1R10 PTF UK90025 or z/OS DFSORT V1R12 PTF UK90026 (Oct,2010), you can use DFSORT's new TRAN=BIT function to do this much more easily like this:

Code:

 OPTION COPY                   
 INREC BUILD=(1,1,TRAN=BIT)     


For complete details on the new functions for DFSORT and DFSORT's ICETOOL available with the Oct, 2010 PTF, see:

http://www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000242
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
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