Help with binary data



Unicenter CA-Easytrieve Plus Report Generator: CA's information retrieval and data management tool

Help with binary data

Postby masterchecho » Thu Jun 24, 2010 2:13 am

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
masterchecho
 
Posts: 10
Joined: Tue May 25, 2010 1:49 am
Has thanked: 0 time
Been thanked: 0 time

Re: Help with binary data

Postby Robert Sample » Thu Jun 24, 2010 2:18 am

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.
Robert Sample
Global moderator
 
Posts: 3720
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: Help with binary data

Postby dick scherrer » Thu Jun 24, 2010 3:01 am

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.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Help with binary data

Postby masterchecho » Thu Jun 24, 2010 3:33 am

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

masterchecho
 
Posts: 10
Joined: Tue May 25, 2010 1:49 am
Has thanked: 0 time
Been thanked: 0 time

Re: Help with binary data

Postby Robert Sample » Thu Jun 24, 2010 6:29 am

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.
Robert Sample
Global moderator
 
Posts: 3720
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: Help with binary data

Postby dick scherrer » Thu Jun 24, 2010 6:43 am

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
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Help with binary data

Postby NicC » Thu Sep 09, 2010 5:03 pm

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.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: Help with binary data

Postby dick scherrer » Thu Sep 09, 2010 11:53 pm

Hi Nic,

Raj has been excused from further participation. . .

d
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times


Return to CA-Easytrieve

 


  • Related topics
    Replies
    Views
    Last post