Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
How to convert hex to Displayable format using SORT

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: How to convert hex to Displayable format using SORT
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: http://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    Post subject:
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    Post subject: How to convert hex to Displayable format using SORT
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    Post subject: How to convert hex to Displayable format using SORT
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    Post subject: How to convert hex to Displayable format using SORT
Reply with quote

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

New User


Joined: 15 Aug 2015
Posts: 24
Location: Germany

PostPosted: Fri Feb 22, 2019 12:54 pm    Post subject:
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    Post subject:
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    Post subject: HEX function gives syntax error
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    Post subject:
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

New User


Joined: 15 Aug 2015
Posts: 24
Location: Germany

PostPosted: Sat Feb 23, 2019 3:50 pm    Post subject: Re: HEX function gives syntax error
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    Post subject:
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

New User


Joined: 15 Aug 2015
Posts: 24
Location: Germany

PostPosted: Sat Feb 23, 2019 11:07 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Convert string to packed format ajaydwivedi4u COBOL Programming 1 Sat Sep 21, 2019 5:01 pm
No new posts Convert from 1/1/2019 to 01/01/2019 sudhakarraju DFSORT/ICETOOL 1 Fri Sep 20, 2019 1:16 am
No new posts Convert Numeric to Packed decimal and... anand1204 DFSORT/ICETOOL 5 Thu Aug 08, 2019 3:53 am
No new posts need assistance on a sort rajiv rengasamy SYNCSORT 11 Fri Jul 26, 2019 8:19 pm
No new posts need help with a tricky sort - Continued rajiv rengasamy SYNCSORT 8 Tue Jul 16, 2019 1:26 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us