Page 1 of 1

Insert binary value through overlay

PostPosted: Tue Aug 03, 2010 11:35 am
by richagoyal
Hi,

I want to overwrite a binary value in my file through overlay on a particular condition.

  OUTREC IFTHEN=(WHEN=(5,13,CH,EQ,C'CE10040000005'),
         OVERLAY=(368:C'US',370:C'CE'))
  SORT FIELDS=COPY                           


apart from this I want to overwrite a binary field with 200 at a position 380 on same above mentioned condition .

Can anybody help me in this ?

Re: Insert binary value through overlay

PostPosted: Tue Aug 03, 2010 12:06 pm
by richagoyal
Hi ,

We can do in this way :

  OUTREC IFTHEN=(WHEN=(5,13,CH,EQ,C'CE10040000005'), 
         OVERLAY=(368:C'US',370:C'CE',380:X'00C8'))


hex value of 200 - 00C8.

Re: Insert binary value through overlay

PostPosted: Tue Aug 03, 2010 11:26 pm
by Frank Yaeger
Yes, that will work. FYI, here's another way to do it with DFSORT that doesn't require knowing that 200 = X'00C8'.

 OUTREC IFTHEN=(WHEN=(5,13,CH,EQ,C'CE10040000005'), 
         OVERLAY=(368:C'US',370:C'CE',380:+200,TO=BI,LENGTH=2))

Re: Insert binary value through overlay

PostPosted: Wed Aug 04, 2010 5:42 pm
by richagoyal
Thanks Frank its working !

Just want to know how binary values will be stored internally and is there any way we can see how they are stored like we can see hex values .

Re: Insert binary value through overlay

PostPosted: Wed Aug 04, 2010 11:04 pm
by skolusu
richagoyal wrote:Thanks Frank its working !

Just want to know how binary values will be stored internally and is there any way we can see how they are stored like we can see hex values .


richagoyal,

Read this FI format positive/negative number and BI for positive number

Re: Insert binary value through overlay

PostPosted: Wed Aug 04, 2010 11:42 pm
by Frank Yaeger
is there any way we can see how they are stored like we can see hex values


Your question doesn't make a lot of sense - hex IS a representation of the bits that are stored.

So when we show +200 as hex 00C4, that is how it is stored internally - in bit representation that would be:
0000000011000100

But we normally use hex to represent the bits rather than 1s and 0s.