Since you did not provide any information regarding your actual data (position/length of HEX field, DCB attributes of file, etc.), I created this example:
//STEP1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
000004A4
00001000
//SORTOUT DD DSN=OUTPUT.FILE,...
//SYSIN DD *
ALTSEQ CODE=(F000,F101,F202,F303,F404,F505,F606,F707,F808,F909,
C10A,C20B,C30C,C40D,C50E,C60F)
INREC IFTHEN=(WHEN=INIT,OVERLAY=(41:1,8,TRAN=ALTSEQ)),
IFTHEN=(WHEN=INIT,
OVERLAY=(41:(48,1,BI,ADD,
(47,1,BI,MUL,+16),ADD,
(46,1,BI,MUL,+256),ADD,
(45,1,BI,MUL,+4096),ADD,
(44,1,BI,MUL,+65536),ADD,
(43,1,BI,MUL,+1048576),ADD,
(42,1,BI,MUL,+16777216),ADD,
(41,1,BI,MUL,+268435456)))),
IFTHEN=(WHEN=INIT,
BUILD=(41,15,ZD,PD))
SORT FIELDS=COPY
/*