IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Binary to display characters


IBM Mainframe Forums -> SYNCSORT
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Roy Ware

New User


Joined: 19 Sep 2013
Posts: 14
Location: USA

PostPosted: Tue Sep 19, 2017 8:46 pm
Reply with quote

Another odd question!

I want to take a 4 byte binary field and convert it into a text field of 8 bytes with each zone and digit as a character. For example, for input I have:

Code:
7DEB
2A9C

and would like to see the output as
Code:
72DAE9BC


Can this be done in SyncSort?
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2010
Location: USA

PostPosted: Tue Sep 19, 2017 10:52 pm
Reply with quote

This is not "display as a character", but "display as a hexadecimal".

Not in SYNCSORT (and other SORTs, too)
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2010
Location: USA

PostPosted: Wed Sep 20, 2017 9:17 pm
Reply with quote

Not tested: try to use parameter of OUTREC/OUTFIL:

Code:
 ... BUILD=(...,p,l,TRAN=HEX,...)


If it works OK, let us know, too.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2010
Location: USA

PostPosted: Wed Sep 20, 2017 9:46 pm
Reply with quote

Yes, it works
Code:
//TRANHEX  EXEC PGM=SYNCSORT 
//*                           
//SYSOUT    DD  SYSOUT=*     
//SORTIN   DD  *             
123456789                     
ABCDEFGHIJKLMNOPQRSTUVWXYZ   
abcdefghijklmnopqrstuvwxyz   
//*                           
//SORTOUT  DD  SYSOUT=*       
//*                           
//SYSIN    DD *               
  SORT FIELDS=COPY           
  OUTREC FIELDS=(1,26,HEX)   
  END                         
//*                           

Result:
Code:
----+----1----+----2----+----3----+----4----+----5--
F1F2F3F4F5F6F7F8F94040404040404040404040404040404040
C1C2C3C4C5C6C7C8C9D1D2D3D4D5D6D7D8D9E2E3E4E5E6E7E8E9
818283848586878889919293949596979899A2A3A4A5A6A7A8A9
******************************** Bottom of Data ****
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> SYNCSORT

 


Similar Topics
Topic Forum Replies
No new posts Substring number between 2 characters... DFSORT/ICETOOL 2
No new posts Reading dataset in Python - New Line ... All Other Mainframe Topics 22
No new posts Count the number of characters in a f... CA Products 1
No new posts How to display the leading zeros of a... DB2 7
No new posts SDSF display Max-RC in different colors TSO/ISPF 4
Search our Forums:

Back to Top