View previous topic :: View next topic
|
Author |
Message |
Ajay Baghel
Active User
Joined: 25 Apr 2007 Posts: 206 Location: Bangalore
|
|
|
|
Hi,
My requirement is to convert a 15digit decimal number into its equivalent hexadecimal no.
Is it possible to find hexadecimal equivalent of 15digit number through sort?
Thanks,
Ajay |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
Ajay Baghel wrote: |
Hi,
My requirement is to convert a 15digit decimal number into its equivalent hexadecimal no.
Is it possible to find hexadecimal equivalent of 15digit number through sort?
Thanks,
Ajay |
What format are these 15digit numbers in, Zoned Decimal, Packed Decimal or Binary? |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Ajay,
It depends on what you mean by "hexadecimal equivalent". Hex is just a way of representing binary values. If you want to display a 15-byte field in hex, you can use:
Code: |
OPTION COPY
INREC BUILD=(p,15,HEX)
|
where p is the starting position of the input field.
If you want to do something else, you need to state more clearly what you want to do with examples of input and expected output. Also, give the RECFM and LRECL of the input file. |
|
Back to top |
|
|
Ajay Baghel
Active User
Joined: 25 Apr 2007 Posts: 206 Location: Bangalore
|
|
|
|
Hi Frank,
I have an input FB file (lrecl=15) containing 15 digit decimal no in each record.
eg:
123456789012345
223456789012345
281234567890123
I want an output file (20 bytes lrecl FB) that contains corresponding values in Hexadecimal (16 Digits).
00007048860DDF79
0000CB3B96881F79
0000FFC8068484CB
123456789012345 's hexadecimal eqivalent is 00007048860DDF79.
I know it can be done through an in-built function in rexx, but I am wondering if same can be done thru dfsort also.
Thanks,
Ajay |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
Ajay Baghel,
The following DFSORT JCL will give you the desired results.
Code: |
//STEP0100 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
123456789012345
223456789012345
281234567890123
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INREC BUILD=(1,15,ZD,BI)
OUTREC BUILD=(01,8,HEX,4X)
//*
|
The output from this job is
Code: |
00007048860DDF79
0000CB3B96881F79
0000FFC8068484CB
|
|
|
Back to top |
|
|
Ajay Baghel
Active User
Joined: 25 Apr 2007 Posts: 206 Location: Bangalore
|
|
|
|
Hi Skolusu,
I am getting the error message:
WER215A OUTREC ARITHMETIC OVERFLOW
When I submit the below job:
Code: |
//xxx pgm=sort
//sysprint dd sysout=*
//sysout dd sysout=*
//sortin dd *
200807913398189 1
/*
//sortout dd dsn=test.out.binary,
// disp=(,catlg),lrecl=15,recfm=fb,space=(trk,(1,2),rlse)
//sysin dd *
option copy
outrec fields=(1,15,zd,bi,15:x)
/* |
From WER messages, i know that SYNCSORT is getting invoked here.
Alissa, can you please help?
Thanks,
Ajay |
|
Back to top |
|
|
|