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

How to convert hex to Displayable format using SORT


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Log Thangavel

New User


Joined: 19 Jan 2018
Posts: 18
Location: USA

PostPosted: Fri Feb 22, 2019 9:33 am
Reply with quote

Hi,

Can someone help me to covert hex format to displayable format using SORT

The value stored in Input file as X'8900'

80
90

I want this to be printed in output file as 8900. But when I tried to convert using the below card it coming as '0890'

20,2,PD,TO=ZDF,LENGTH=4 (The value start from position 20 in input file)


Read more: ibmmainframes.com/privmsg.php?folder=outbox&mode=read&p=45013#ixzz5gEHZdawn
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Fri Feb 22, 2019 10:08 am
Reply with quote

Did you try the 'HEX' operator?
Back to top
View user's profile Send private message
Log Thangavel

New User


Joined: 19 Jan 2018
Posts: 18
Location: USA

PostPosted: Fri Feb 22, 2019 10:22 am
Reply with quote

Yes, Tried 20,2,HEX,TO=ZD,LENGTH=4

it throwed an syntax error.

20,2,HEX,TO=ZD,LENGTH=4
*

Any other options?
Back to top
View user's profile Send private message
Log Thangavel

New User


Joined: 19 Jan 2018
Posts: 18
Location: USA

PostPosted: Fri Feb 22, 2019 10:31 am
Reply with quote

But when I give the below card

20,2,PD,ZD

I was able to see the output file with value

89
FF04
8900

But it just show only 2 bytes and remaining 2 bytes is spaces. With hex on in file I can see the values '8400'.. But not sure why the last 2 bytes comes as spaces icon_sad.gif
Back to top
View user's profile Send private message
Log Thangavel

New User


Joined: 19 Jan 2018
Posts: 18
Location: USA

PostPosted: Fri Feb 22, 2019 12:08 pm
Reply with quote

Any help is highly appreciated..Thanks
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1222
Location: Bamberg, Germany

PostPosted: Fri Feb 22, 2019 12:54 pm
Reply with quote

See Data types first, then do what Arun has suggested.

Code:
BUILD=(1,2,TRAN=HEX)


RTFM
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Fri Feb 22, 2019 7:39 pm
Reply with quote

HEX has nothing to do with PD or ZD, it just translates the input binary value to its equivalent hexadecimal value.

You just need

starting-position,length,HEX

or

starting-position,length,TRAN=HEX as Joerg mentioned.
Back to top
View user's profile Send private message
Log Thangavel

New User


Joined: 19 Jan 2018
Posts: 18
Location: USA

PostPosted: Fri Feb 22, 2019 10:26 pm
Reply with quote

Hi,
The data was stored through this move statement

Move X’8900’ to file

So when I see on file aid it show same as x’8900’. So in this case which function would convert hex to ZD. I tried HEX function and it gives syntax error
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Fri Feb 22, 2019 11:12 pm
Reply with quote

Quote:
I tried HEX function and it gives syntax error
The correct syntax is shown in previous posts.
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1222
Location: Bamberg, Germany

PostPosted: Sat Feb 23, 2019 3:50 pm
Reply with quote

Log Thangavel wrote:
Hi,
The data was stored through this move statement

Move X’8900’ to file

So when I see on file aid it show same as x’8900’. So in this case which function would convert hex to ZD. I tried HEX function and it gives syntax error


Whatever is moved from here to there or where you see it doesn't matter. You have to deal always with the following to achieve what you want:

Input -> some Magic -> Output

The Magic part is why you are here, try for yourself to find solutions first. Look at your data, see patterns you can work with, try solutions as we do. Help others with what you have done.
Back to top
View user's profile Send private message
Log Thangavel

New User


Joined: 19 Jan 2018
Posts: 18
Location: USA

PostPosted: Sat Feb 23, 2019 7:19 pm
Reply with quote

Yay..it worked.. thanks everyone for the suggestion and input.

I tried the Tran function in outrec with our specifying the input format ,like

Outrec fields= (20,2,Tran=Hex)[/list]
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1222
Location: Bamberg, Germany

PostPosted: Sat Feb 23, 2019 11:07 pm
Reply with quote

As said, you only converting binary values here. Nothing else. Glad it works Ok now for you.
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Populate last day of the Month in MMD... SYNCSORT 2
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts Need to convert date format DFSORT/ICETOOL 20
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
Search our Forums:

Back to Top