Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Convert all the numbers in the file to hexadecimal format

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
rafael2009

New User


Joined: 21 May 2009
Posts: 18
Location: Mumbai

PostPosted: Wed Jun 03, 2009 8:43 pm    Post subject: Convert all the numbers in the file to hexadecimal format
Reply with quote

I hav a file with numeric data of length 4. I want to convert all the numbers in the file to hexadecimal format.

please could anyone tell me the sort card.

input
------
100
200
300

output
-------
64
C8
12C
Back to top
View user's profile Send private message

Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Wed Jun 03, 2009 9:41 pm    Post subject:
Reply with quote

You can use a DFSORT job like the following to do what you asked for:

Code:

//S1    EXEC  PGM=SORT                                           
//SYSOUT    DD  SYSOUT=*                                         
//SORTIN DD *                                                     
000                                                               
100                                                               
200                                                               
300
/*                                                               
//SORTOUT DD SYSOUT=*                                             
//SYSIN    DD    *                                               
  OPTION COPY                                                     
  INREC IFOUTLEN=80,                                             
    IFTHEN=(WHEN=INIT,BUILD=(1,3,ZD,TO=BI,LENGTH=2)),             
    IFTHEN=(WHEN=INIT,BUILD=(1,2,HEX))                           
/*


SORTOUT will have:

Code:

0064
00C8
012C
Back to top
View user's profile Send private message
rafael2009

New User


Joined: 21 May 2009
Posts: 18
Location: Mumbai

PostPosted: Thu Jun 04, 2009 1:52 pm    Post subject:
Reply with quote

Thanks you Frank...icon_smile.gif
Back to top
View user's profile Send private message
rafael2009

New User


Joined: 21 May 2009
Posts: 18
Location: Mumbai

PostPosted: Thu Jun 04, 2009 3:45 pm    Post subject:
Reply with quote

Hi Frank,
i would like to know bit more about the commands.
FRom my understanding the 1st BUILD will convert decimal to binary...and second BUILD converts binary to hexadecimal....

if u dont mind can u tell me little on the command INREC IFOUTLEN=80
and the two BUILD commands...

is it not possible to convert ZD to HEX directly without converting it to BI

Thanks...
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Thu Jun 04, 2009 9:12 pm    Post subject:
Reply with quote

Yes, you're correct about what the BUILD operands do.

IFOUTLEN=80 just sets the output record length to 80.

A ZD value of 100 looks like this in hex:

F1F1F0

If you were to convert that to hex directly with

1,3,HEX

the result would be:

F1F1F0

Based on your example, you want to convert the ZD value to a BI value and then display the BI value as HEX. So that's what I did.
Back to top
View user's profile Send private message
rafael2009

New User


Joined: 21 May 2009
Posts: 18
Location: Mumbai

PostPosted: Fri Jun 05, 2009 1:04 pm    Post subject:
Reply with quote

Thanks a lot Frank....Its really helpfull to me...
Back to top
View user's profile Send private message
ajithkumarsl

New User


Joined: 23 Oct 2006
Posts: 19
Location: Chennai

PostPosted: Fri Jul 17, 2009 7:10 pm    Post subject:
Reply with quote

The post is really great..

It really rocks..

I have one more doubt in convert..Sorry I searched but I couldn't find an exact one..

How to convert a Character variable of numbers (X(13)) to Packed decimal..

Really appreciate your time and effort..

Thanks
Ajith
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Fri Jul 17, 2009 9:12 pm    Post subject:
Reply with quote

You can use DFSORT control statements like this:

Code:

   OPTION COPY
   INREC BUILD=(1,13,ZD,TO=PD)


If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

http://www.ibm.com/support/docview.wss?rs=0&uid=isg3T7000080
Back to top
View user's profile Send private message
ajithkumarsl

New User


Joined: 23 Oct 2006
Posts: 19
Location: Chennai

PostPosted: Fri Jul 17, 2009 9:46 pm    Post subject:
Reply with quote

Thanks Frank..

Definitely I will go through the manual..

Thanks a lot..

Ajith
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 Changing of LRECL of a file abdulrafi DFSORT/ICETOOL 2 Fri Mar 24, 2017 3:25 pm
No new posts splitting a file abdulrafi DFSORT/ICETOOL 4 Fri Mar 24, 2017 11:51 am
No new posts Receive a file using PCOMM macro Harald.v.K IBM Tools 0 Thu Mar 23, 2017 6:50 pm
No new posts How to pick only YYMMDD from DATE1P (... atulbaviskar SYNCSORT 7 Wed Mar 22, 2017 11:39 am
No new posts Export flat file data into excel sheet murali.andaluri DFSORT/ICETOOL 2 Mon Mar 20, 2017 5:39 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us