Convert HEX Data to BIT Display



Support for NetApp SyncSort for z/OS, Visual SyncSort, SYNCINIT, SYNCLIST and SYNCTOOL

Convert HEX Data to BIT Display

Postby gmosley » Fri May 06, 2011 9:08 pm

I'm converting database data to display data for a report and I need to convert a (PL/I) bit datatype to PIC X.
For example, the unload file gives me hex’4D’ which I want to translate into PIC X(8) which should be 01001101.
Can this be done with Syncsort?
gmosley
 
Posts: 17
Joined: Thu Sep 13, 2007 10:52 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Convert HEX Data to BIT Display

 

Re: Convert HEX Data to BIT Display

Postby Alissa Margulies » Sat May 07, 2011 2:21 am

Here is one example of how to accomplish this task:
//SORT  EXEC PGM=SORT                                                 
//SORTOUT DD SYSOUT=*                                                 
//SORTIN  DD *                                                       
(                                                                     
//SYSOUT  DD SYSOUT=*                                                 
//SYSIN   DD *                                                       
   INREC BUILD=(1,1,HEX)                                             
   SORT FIELDS=COPY                                                   
   OUTREC IFTHEN=(WHEN=(1,1,CH,EQ,C'0'),BUILD=(C'0000',2,1),HIT=NEXT),
          IFTHEN=(WHEN=(1,1,CH,EQ,C'1'),BUILD=(C'0001',2,1),HIT=NEXT),
          IFTHEN=(WHEN=(1,1,CH,EQ,C'2'),BUILD=(C'0010',2,1),HIT=NEXT),
          IFTHEN=(WHEN=(1,1,CH,EQ,C'3'),BUILD=(C'0011',2,1),HIT=NEXT),
          IFTHEN=(WHEN=(1,1,CH,EQ,C'4'),BUILD=(C'0100',2,1),HIT=NEXT),
          IFTHEN=(WHEN=(1,1,CH,EQ,C'5'),BUILD=(C'0101',2,1),HIT=NEXT),
          IFTHEN=(WHEN=(1,1,CH,EQ,C'6'),BUILD=(C'0110',2,1),HIT=NEXT),
          IFTHEN=(WHEN=(1,1,CH,EQ,C'7'),BUILD=(C'0111',2,1),HIT=NEXT),
          IFTHEN=(WHEN=(1,1,CH,EQ,C'8'),BUILD=(C'1000',2,1),HIT=NEXT),
          IFTHEN=(WHEN=(1,1,CH,EQ,C'9'),BUILD=(C'1001',2,1),HIT=NEXT),
          IFTHEN=(WHEN=(1,1,CH,EQ,C'A'),BUILD=(C'1010',2,1),HIT=NEXT),
          IFTHEN=(WHEN=(1,1,CH,EQ,C'B'),BUILD=(C'1011',2,1),HIT=NEXT),
          IFTHEN=(WHEN=(1,1,CH,EQ,C'C'),BUILD=(C'1100',2,1),HIT=NEXT),
          IFTHEN=(WHEN=(1,1,CH,EQ,C'D'),BUILD=(C'1101',2,1),HIT=NEXT),
          IFTHEN=(WHEN=(1,1,CH,EQ,C'E'),BUILD=(C'1110',2,1),HIT=NEXT),
          IFTHEN=(WHEN=(1,1,CH,EQ,C'F'),BUILD=(C'1111',2,1),HIT=NEXT),
          IFTHEN=(WHEN=(5,1,CH,EQ,C'0'),OVERLAY=(5:C'0000'),HIT=NEXT),
          IFTHEN=(WHEN=(5,1,CH,EQ,C'1'),OVERLAY=(5:C'0001'),HIT=NEXT),
          IFTHEN=(WHEN=(5,1,CH,EQ,C'2'),OVERLAY=(5:C'0010'),HIT=NEXT),
          IFTHEN=(WHEN=(5,1,CH,EQ,C'3'),OVERLAY=(5:C'0011'),HIT=NEXT),
          IFTHEN=(WHEN=(5,1,CH,EQ,C'4'),OVERLAY=(5:C'0100'),HIT=NEXT),
          IFTHEN=(WHEN=(5,1,CH,EQ,C'5'),OVERLAY=(5:C'0101'),HIT=NEXT),
          IFTHEN=(WHEN=(5,1,CH,EQ,C'6'),OVERLAY=(5:C'0110'),HIT=NEXT),
          IFTHEN=(WHEN=(5,1,CH,EQ,C'7'),OVERLAY=(5:C'0111'),HIT=NEXT),
          IFTHEN=(WHEN=(5,1,CH,EQ,C'8'),OVERLAY=(5:C'1000'),HIT=NEXT),
          IFTHEN=(WHEN=(5,1,CH,EQ,C'9'),OVERLAY=(5:C'1001'),HIT=NEXT),
          IFTHEN=(WHEN=(5,1,CH,EQ,C'A'),OVERLAY=(5:C'1010'),HIT=NEXT),
          IFTHEN=(WHEN=(5,1,CH,EQ,C'B'),OVERLAY=(5:C'1011'),HIT=NEXT),
          IFTHEN=(WHEN=(5,1,CH,EQ,C'C'),OVERLAY=(5:C'1100'),HIT=NEXT),
          IFTHEN=(WHEN=(5,1,CH,EQ,C'D'),OVERLAY=(5:C'1101'),HIT=NEXT),
          IFTHEN=(WHEN=(5,1,CH,EQ,C'E'),OVERLAY=(5:C'1110'),HIT=NEXT),
          IFTHEN=(WHEN=(5,1,CH,EQ,C'F'),OVERLAY=(5:C'1111'))           
/*
Alissa Margulies
Syncsort Mainframe Product Services
201-930-8260
zos_tech@syncsort.com
Alissa Margulies
Global moderator
 
Posts: 369
Joined: Tue Feb 26, 2008 11:15 pm
Location: USA
Has thanked: 1 time
Been thanked: 1 time

Re: Convert HEX Data to BIT Display

Postby gmosley » Mon May 09, 2011 9:18 pm

Thanks, Alissa. I'll give it a try.
gmosley
 
Posts: 17
Joined: Thu Sep 13, 2007 10:52 pm
Has thanked: 0 time
Been thanked: 0 time


Return to Syncsort/Synctool

 


  • Related topics
    Replies
    Views
    Last post