View previous topic :: View next topic
|
Author |
Message |
rafael2009
New User
Joined: 21 May 2009 Posts: 18 Location: Mumbai
|
|
|
|
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 |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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:
|
|
Back to top |
|
|
rafael2009
New User
Joined: 21 May 2009 Posts: 18 Location: Mumbai
|
|
|
|
Thanks you Frank... |
|
Back to top |
|
|
rafael2009
New User
Joined: 21 May 2009 Posts: 18 Location: Mumbai
|
|
|
|
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 |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
rafael2009
New User
Joined: 21 May 2009 Posts: 18 Location: Mumbai
|
|
|
|
Thanks a lot Frank....Its really helpfull to me... |
|
Back to top |
|
|
ajithkumarsl
New User
Joined: 23 Oct 2006 Posts: 19 Location: Chennai
|
|
|
|
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 |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
ajithkumarsl
New User
Joined: 23 Oct 2006 Posts: 19 Location: Chennai
|
|
|
|
Thanks Frank..
Definitely I will go through the manual..
Thanks a lot..
Ajith |
|
Back to top |
|
|
|