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

How to conver a HEX format data into ZD type data?


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
dejunzhu

Active User


Joined: 08 May 2008
Posts: 390
Location: China

PostPosted: Fri Mar 15, 2013 9:52 am
Reply with quote

for example, I want to convert a S9(9) COMP data into a 9(9) data, how to do this via DFSort?
before conversion:
Code:

....
0000
0009

after conversion:
Code:

000000009
FFFFFFFFF
000000009



before conversion:
Code:

....
000A
0000

after conversion:
Code:

0000000010
FFFFFFFFFF
0000000010



thanks for your help in advance.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Fri Mar 15, 2013 12:35 pm
Reply with quote

I'm not sure if I follow completely what you mean. Your input is in "HEX" or COMP (BI)?

Possibly, see the following for information on and examples of numeric conversions with DFSORT: publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CG20/2.4.7?DT=20060615173822

And see the following for information on and examples of editing numeric values with DFSORT: publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CG20/2.4.8?DT=20060615173822


If you're talking about HEX as input, and if you've z/OS DFSORT V1R10 PTF UK90025 or z/OS DFSORT V1R12 PTF UK90026, you can use DFSORT's TRAN=UNHEX.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Mar 15, 2013 12:47 pm
Reply with quote

shame on You icon_cool.gif
after five years of hanging around and You still use the wrong terminology ...

HEX vs BINARY

from
Code:
0000
000A


to ( 8 is an arbitrary length NOT related to the original data )
Code:
00000010
ffffffff
00000010

is a numeric conversion

from
Code:
0000
000A


to ( 8 is NOT an arbitrary length ==> it is 8 half bytes )
Code:
0000000A
fffffffc
00000001


is a printable display of data as stored in memory

looks like You wasted everybody' s time on all the questions You asked and all the replies You were given
icon_evil.gif
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Mar 15, 2013 12:57 pm
Reply with quote

Quote:
before conversion:
Code:
....
000A
0000

after conversion:
Code:
0000000010
FFFFFFFFFF
0000000010



I did not notice before ....
whatever conversion logic You used ... IT WAS WRONG

it should have been

Code:
000000A0
FFFFFFCF
00000010


for a <hex> conversion/display

Code:
00000160
FFFFFFFF
00000160


for a <binary> conversion/display
Back to top
View user's profile Send private message
dejunzhu

Active User


Joined: 08 May 2008
Posts: 390
Location: China

PostPosted: Fri Mar 15, 2013 1:16 pm
Reply with quote

Sorry for my bad statement, but I thought binary format data is stored as HEX data after cobol processing...

In fact, the input is a HEX data, and I want to convert it to ZD data...
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Fri Mar 15, 2013 1:27 pm
Reply with quote

Quote:
If you're talking about HEX as input, and if you've z/OS DFSORT V1R10 PTF UK90025 or z/OS DFSORT V1R12 PTF UK90026, you can use DFSORT's TRAN=UNHEX.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Mar 15, 2013 1:40 pm
Reply with quote

again, You lost another chance ...

in IT everything is just a sequence of BITS ...

0/1 which to save <paper>/<display> space are represented as hexadecimal ( shorthand for base 16 ) numbers

how to call <the thing> that these bits represent depends on the convention used
( as already explained to You in an old reply )

1 byte, 8 bits
rePRESENTATION
Code:
as BITs ==> 11000001
as HEX  ==> C1


human meaning / interpretation

Code:

for a printable char  ==> A   <== Upper case a ( EBCDIC convention as perp POP )
for a decimal number  ==> 1   <== positive 1 ( ZONED SIGNED DECIMAL as per POP )
for a binary number   ==> 193 <== UNSIGNED ( as per BINARY arithmetic )
or                    ==> -63 <== SIGNED ( same as above )

what is that is not clear in the explanation that You keep using the wrong terminology
Back to top
View user's profile Send private message
dejunzhu

Active User


Joined: 08 May 2008
Posts: 390
Location: China

PostPosted: Fri Mar 15, 2013 2:30 pm
Reply with quote

I tried to take advantage of 'TRAN=HEX', but the result is not what I want.
with TRAN=HEX, X'C1F1' (C'A1') would be replaced by C'C1F1', but the result I want is C'49649'(X'F4F9F6F4F9'), which is the printable decimal format of X'C1F1'.

How to achieve this?
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Mar 15, 2013 2:49 pm
Reply with quote

Quote:
In fact, the input is a HEX data, and I want to convert it to ZD data...

You should really meditate on You attitude for an IT career

no reason to waste time explaining and try to make You understand things icon_evil.gif
here is the solution
Code:
****** ***************************** Top of Data ******************************
000003 //*
000004 //S       EXEC PGM=SORT
000005 //SYSOUT    DD SYSOUT=*
000006 //SYSPRINT  DD SYSOUT=*
000007 //SORTIN    DD *
000008 A1
000009 //SORTOUT   DD SYSOUT=*,
000010 //             DCB=(RECFM=FB,LRECL=80)
000011 //SYSIN     DD *
000012   SORT FIELDS=COPY
000013   OUTREC FIELDS=(1,2,BI,TO=ZD,LENGTH=8)
****** **************************** Bottom of Data ****************************
to obtain
Code:
********************************* TOP OF DATA **********************************
00049649
******************************** BOTTOM OF DATA ********************************
Back to top
View user's profile Send private message
dejunzhu

Active User


Joined: 08 May 2008
Posts: 390
Location: China

PostPosted: Fri Mar 15, 2013 4:47 pm
Reply with quote

Thanks, enrico.
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 How to save SYSLOG as text data via P... All Other Mainframe Topics 2
No new posts Store the data for fixed length COBOL Programming 1
No new posts Populate last day of the Month in MMD... SYNCSORT 2
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Data set Rec-Cnt and Byte-Cnt Testing & Performance 2
Search our Forums:

Back to Top