MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

how to interpret binary values

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
yadav2005
Intermediate


Joined: 10 Jan 2005
Posts: 348
Topics: 144

PostPosted: Thu Nov 15, 2007 4:00 pm    Post subject: how to interpret binary values Reply with quote

Members,

I have a dataset when see in browse mode:
Code:

----+
.. ..
.. ..
.. ..
.. ..

When i put Hex on
Code:

.. ..
00400
01001
-----
.. ..
004FF
020FF

I am reading this file into a program , i want to insert / override equivalent of binary 2 to be inserted in cols 4 - 5 for the first record ,basically it is a binary data PIC S9(04) COMP which takes 2 bytes , can somebody help me ? Also how can i interpret the Binary values stored in 2 bytes in pos 4 -5 to what exactly is the value ?
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Thu Nov 15, 2007 4:41 pm    Post subject: Reply with quote

yadav2005,

You can use the following DFSORT job to view the contents of the binary values.
If you have both negative/positive values then use FI format and if you are sure that you only have positive values then use BI format

Code:

//STEP0100 EXEC PGM=SORT                             
//SYSOUT   DD SYSOUT=*                               
//SORTIN   DD DSN=YOUR BINARY INPUT FILE,
//            DISP=SHR                           
//SORTOUT  DD SYSOUT=*                               
//SYSIN    DD *                                       
  SORT FIELDS=COPY                                   
  OUTREC FIELDS=(p,m,FI,M26)
//*
//* p  = position of the binary field in the file
//* m  = length of the binary filed
//* m26 = pre-defined edit mask explained in the below link


DFSORT Edit Masks

Hope this helps...
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
mf_user
Intermediate


Joined: 01 Jun 2003
Posts: 372
Topics: 105

PostPosted: Fri Oct 17, 2008 6:46 am    Post subject: My Question on M26 Mask Reply with quote

Hi,

I supplied below low-values in SYSIN and got the below displayed in SYSOUT !

Code:

000F2F
012F0F


Code:

+000004345241855


Sysin:

Code:

//SORTOUT  DD SYSOUT=*     
//SYSIN    DD *             
  SORT FIELDS=COPY         
  OUTREC FIELDS=(1,6,FI,M26)


But, when I check each byte individually it is shown differently.....

For 00 - +000
For 01 - +001
For 02 - +002
For FF - +255
For 20 - +032 etc

Would you please explain.

Thanks.
_________________
MF
==
Any training that does not include the emotions, mind and body is incomplete; knowledge fades without feeling.
==
Back to top
View user's profile Send private message Send e-mail
Dibakar
Advanced


Joined: 02 Dec 2002
Posts: 700
Topics: 63
Location: USA

PostPosted: Fri Oct 17, 2008 9:52 am    Post subject: Reply with quote

MF,

I guess you are making a basic mistake by looking at each byte seperately and not as a whole. Remember a decimal number '123' is not 1, 2, 3 but 100+20+3.

Similarly a hexadecimal number, '0102ff20ff' is ff + (20*16) + ff*(16**2) + ff*(16**3) + 2*(16**4) + 1*(16**5), bracketed operations are in decimal. Not 01, 02, ff, 20, ff

To clarify further you can try open a calculator in scientifc mode. Put '0102ff20ff' as hex number. Then select decimal to see the transformation.

Diba.
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Fri Oct 17, 2008 10:29 am    Post subject: Reply with quote

mf_user,


Read this for a better understanding of the various data formats

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CA20/C.1
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
mf_user
Intermediate


Joined: 01 Jun 2003
Posts: 372
Topics: 105

PostPosted: Fri Oct 17, 2008 11:48 am    Post subject: Reply with quote

Dibakar, using CALC in PC is better idea. Thanks.
_________________
MF
==
Any training that does not include the emotions, mind and body is incomplete; knowledge fades without feeling.
==
Back to top
View user's profile Send private message Send e-mail
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Fri Oct 17, 2008 12:06 pm    Post subject: Reply with quote

Quote:
'0102ff20ff' is ff + (20*16) + ff*(16**2) + ff*(16**3) + 2*(16**4) + 1*(16**5)


You have it wrong. It would be the following in decimal:

(15*16**0)+(15*16**1)+(0*16**2)+(2*16**3)+(15*16**4)+(15*16**5)+(2*16**6)+(0*16**7)+(1*16**8)
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Dibakar
Advanced


Joined: 02 Dec 2002
Posts: 700
Topics: 63
Location: USA

PostPosted: Tue Nov 11, 2008 9:58 pm    Post subject: Reply with quote

Opps, I missed this post and the correction. Thanks Frank.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group