Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Binary to Numeric in EZtrieve

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CA Products
View previous topic :: :: View next topic  
Author Message
S0C7

New User


Joined: 19 May 2006
Posts: 26

PostPosted: Mon May 12, 2008 3:42 pm    Post subject: Binary to Numeric in EZtrieve
Reply with quote

Hi,

How do I convert a Binary field into a numeric field in Eztrieve. I want the values in all the individual bits of 1 byte.

Thanks.
Back to top
View user's profile Send private message

CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Mon May 12, 2008 6:15 pm    Post subject: Re: Binary to Numeric in EZtrieve
Reply with quote

S0C7 wrote:
How do I convert a Binary field into a numeric field in Eztrieve.
By defination. binary is numeric....
Quote:
I want the values in all the individual bits of 1 byte.
I'm not sure of what you want, but I think a simple move to a numeric display field should provide what you need.....
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Mon May 12, 2008 6:26 pm    Post subject:
Reply with quote

Are you saying that you want to see eight ones or zeros for each byte of data. c'1' = x'f1' = b'11110001'. Eztrieve doesn't have a build in function for doing that.
Back to top
View user's profile Send private message
S0C7

New User


Joined: 19 May 2006
Posts: 26

PostPosted: Mon May 12, 2008 11:43 pm    Post subject:
Reply with quote

Craq Giegerich wrote:
Are you saying that you want to see eight ones or zeros for each byte of data. c'1' = x'f1' = b'11110001'. Eztrieve doesn't have a build in function for doing that.


Yah Craq, I need to identify individual bits and find out if its a 0 or a 1. Is there any way I can do that? I have a code in my shop that uses individual bits to store flags. So a byte actually stores 8 flags. I need to find these individual bit values and modify my existing Eztrieve code.

Looking forwad to ur reply.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Tue May 13, 2008 12:05 am    Post subject:
Reply with quote

How about Format 2 of the Assignment Statement?

Quote:
DEFINE F1 W 2 P MASK HEX
DEFINE F2 W 2 P VALUE X'123D'
JOB INPUT NULL NAME MYPROG
F1 = F2 AND X'FFFE'
DISPLAY SKIP 2 +
'F1 = F2 AND X''FFFE'' = ' F1
F1 = F2 OR X'000F'
DISPLAY SKIP 2 +
'F1 = F2 OR X''000F'' = ' F1
F1 = F2 XOR X'FFFF'
DISPLAY SKIP 2 +
'F1 = F2 XOR X''FFFF'' = ' F1
F1 = F2 XOR F2
DISPLAY SKIP 2 +
'F1 = F2 XOR F2 = ' F1
STOP

Produce:
Resulting
Value
F1 = F2 AND X'FFFE' = 123C
F1 = F2 OR X'000F' = 123F
F1 = F2 XOR X'FFFF' = EDC2
F1 = F2 XOR F2 = 0000

Where:
Quote:
Format 2 (Logical Expression)
Format 2 of the Assignment statement sets the value of field-name-1 equal to the result of evaluating a logical expression. The value of field-name-2 is logically acted upon by the value of field-name-3 or literal-2. The lengths of all values must be the same and literal-2 must be hexadecimal. The logic operators are processed as follows:
AND zero bits in field-name-3 or literal-2 are carried forward to field-name-2 and the result is placed in field-name-1.
OR one bit in field-name-3 or literal-2 is carried forward to field-name-2 and the result is placed in field-name-1.
XOR corresponding bits of field-name-3 or literal-2, and field-name-2 must be opposite (zero and one) to result in a one bit in field-name-1.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue May 13, 2008 1:57 am    Post subject:
Reply with quote

Hello,

Another way to get the 1's and 0's for a byte is:

Code:

FILE FILEB   
BYTE1 1 1 A 

*my actual file has 80 bytes. . . could be anything. . .

FBYTE W 1 B     
FBIT7 W 1 A     
FBIT6 W 1 A     
FBIT5 W 1 A     
FBIT4 W 1 A     
FBIT3 W 1 A     
FBIT2 W 1 A     
FBIT1 W 1 A     
FBIT0 W 1 A     


JOB INPUT FILEB


DISPLAY BYTE1             
MOVE BYTE1 TO FBYTE       
DISPLAY FBYTE             
IF FBYTE > 127             
   MOVE '1' TO FBIT7       
   FBYTE = FBYTE - 128     
  ELSE                     
   MOVE '0' TO FBIT7       
END-IF                     
IF FBYTE > 63             
   MOVE '1' TO FBIT6       
   FBYTE = FBYTE - 64     
  ELSE                     
   MOVE '0' TO FBIT6       
END-IF                     
IF FBYTE > 31             
   MOVE '1' TO FBIT5       
   FBYTE = FBYTE - 32     
  ELSE                     
   MOVE '0' TO FBIT5       
END-IF                     
IF FBYTE > 15             
   MOVE '1' TO FBIT4       
   FBYTE = FBYTE - 16     
  ELSE                     
   MOVE '0' TO FBIT4       
END-IF                     
IF FBYTE > 7               
   MOVE '1' TO FBIT3       
   FBYTE = FBYTE - 8       
  ELSE                     
   MOVE '0' TO FBIT3       
END-IF                     
IF FBYTE > 3               
   MOVE '1' TO FBIT2       
   FBYTE = FBYTE - 4       
  ELSE                     
   MOVE '0' TO FBIT2       
END-IF                     
IF FBYTE > 1               
   MOVE '1' TO FBIT1       
   FBYTE = FBYTE - 2       
  ELSE                     
   MOVE '0' TO FBIT1       
END-IF                     
IF FBYTE = 1               
   MOVE '1' TO FBIT0       
  ELSE                     
   MOVE '0' TO FBIT0       
END-IF                     
DISPLAY FBIT7             
DISPLAY FBIT6             
DISPLAY FBIT5             
DISPLAY FBIT4   
DISPLAY FBIT3   
DISPLAY FBIT2   
DISPLAY FBIT1   
DISPLAY FBIT0   



Code:
//FILEB  DD *
)   


gives:
)
93
0
1
0
1
1
1
0
1

I ran several characters thru and the 1&0's looked right.

My test input was 80-byte data, not just 1 byte. I only used one byte for demonstration.
Back to top
View user's profile Send private message
S0C7

New User


Joined: 19 May 2006
Posts: 26

PostPosted: Tue May 13, 2008 11:27 am    Post subject:
Reply with quote

Thanks a lot guys.... this really helped a lot.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue May 13, 2008 11:30 am    Post subject: Reply to: Binary to Numeric in EZtrieve
Reply with quote

You're welcome - good luck icon_smile.gif

d
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CA Products All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Validate date and numeric fields and ... Rick Silvers DFSORT/ICETOOL 6 Thu May 11, 2017 6:51 pm
No new posts Check Binary Values for symbols gandikk CA Products 3 Tue Mar 21, 2017 5:11 am
No new posts Converting decimal to numeric using I... Balaryan DFSORT/ICETOOL 4 Thu Feb 02, 2017 11:27 pm
No new posts resume binary ftp in z/os meykh2014 All Other Mainframe Topics 6 Sun Jan 22, 2017 10:01 am
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us