Page 1 of 1

Help with binary data

PostPosted: Thu Jun 24, 2010 2:13 am
by masterchecho
Hi all,
I have a problem handling binary data, especifically when my easytrieve is reading a 1 digit binary data.
In my input file in position 28 i have a 1 digit binary which contains the tens of a date ,in example "10" of 2010.In the pgm is declared as YEAR 28 1 B
The problem is when i have to do some operations with that ,because when am displaying the content of the 1 digit binary easytrieve shows me the decimal value , i.e 16 , and when i work with 1digit binary the value is 16 too.

What do i need to do in order to not loose the "10" ?
I tried to move to a numeric variable lenght eq 2 ?
I tried to assign to a numeric variable lenght eq 2 ? but am still having the decimal value.

thanks a lot.
Sergio

Re: Help with binary data

PostPosted: Thu Jun 24, 2010 2:18 am
by Robert Sample
Hex value '10' is sixteen -- NOT ten. Ten in hexadecimal is X'0A'.

If you truly have a '10' in the byte to represent the number 10, you may need to code a conversion in your program.

Re: Help with binary data

PostPosted: Thu Jun 24, 2010 3:01 am
by dick scherrer
Hello,

Suggest you post a few records in hex showing positions 20 thru 35. Use copy/paste and the Code tag to preseve alignment and improve readability.

Then explain what you want to do with these fields.

Re: Help with binary data

PostPosted: Thu Jun 24, 2010 3:33 am
by masterchecho
this is a sample from position 20 to 30, if look at position 28 you will notice the 10.This nbr 10 represent the tens of the year, in other words an external and unknown process extract the the tens of date (the 10 of 2010 or 09 from 2009) and write it into position 28 in 1-digit binary.

It seems that easytrieve convert the data when read it to a decimal value, i.e read the position 28 and think that position 28 comes in hex and convert the hex to decimal ...10 ==> 16. Because i have tried to moved it to a numeric of 2 lenght, but is still showing me the 16 because of the conversion.

What i need is to preserve the number 10 in order my calculations.


              S1 ...`....
              EF406470103
              2100269105F
Position  20


Re: Help with binary data

PostPosted: Thu Jun 24, 2010 6:29 am
by Robert Sample
Actually, you don't understand the data you have and that is why you are misleading us. What you actually have is an SMF style date, which is defined in the manual as
Date when the record was moved into the SMF
buffer, in the form 0cyydddF (where c is 0 for
19xx and 1 for 20xx, yy is the current year
(0-99), ddd is the current day (1-366), and F
is the sign).
So if you tell Easytrieve you have a 4-byte packed decimal field starting at byte 27, it will return 0110053, which means (20)10 day 053 or February 22, 2010. You do not have to convert anything.

Re: Help with binary data

PostPosted: Thu Jun 24, 2010 6:43 am
by dick scherrer
Hello,

It seems that easytrieve convert the data when read it to a decimal value,
Easytrieve can only try to do what you tell it to do. . .

The only "conversion" was the code used to manipulate the data - Easytrieve made no "decisions".

Good luck :)

d

Re: Help with binary data

PostPosted: Thu Sep 09, 2010 5:03 pm
by NicC
raj21 wrote:A binary file (commonly, but not necessarily, with the extension .bin) is a computer file which may contain any type of data, encoded in binary form for computer storage and processing purposes; for example, computer document files containing formatted text. Many binary file formats contain parts that can be interpreted as text; binary files that contain only textual data—without, for example, any formatting information—are called plain text files. In many cases, plain text files are considered to be different from binary files because binary files are made up of more than just plain text. When downloading, a completely functional program without any installer is also often called program binary, or binaries (as opposed to the source code).


Raj - I suspect you are spamming. You obviously do not know anything about binary data on the mainframe - and this IS a MAINFRAME forum.

Re: Help with binary data

PostPosted: Thu Sep 09, 2010 11:53 pm
by dick scherrer
Hi Nic,

Raj has been excused from further participation. . .

d