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

Convert all the numbers in the file to hexadecimal format


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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 Developer


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

PostPosted: Wed Jun 03, 2009 9:41 pm
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
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
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 Developer


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

PostPosted: Thu Jun 04, 2009 9:12 pm
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
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
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 Developer


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

PostPosted: Fri Jul 17, 2009 9:12 pm
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:

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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Populate last day of the Month in MMD... SYNCSORT 2
Search our Forums:

Back to Top