View previous topic :: View next topic |
Author |
Message |
konakav Beginner
Joined: 13 Jul 2004 Posts: 12 Topics: 3
|
Posted: Tue Jul 13, 2004 10:51 am Post subject: Usage of mask in Easytrieve |
|
|
Hi,
I have a doubt in easytrieve.
i want to display the binary format data in to a specific format.
how to display the binary value using MASK.
for ex (i tried to packed decimal it's working fine) :
packed decimal
Code: | SEQUENCE W 2 P MASK('ZZ9-') HEADING 'RCODE' |
Could any one let me know how to use mask for binary data type?
Code: | SEQUENCE W 4 B MASK('what is the format here') |
Thanks,
Venu. |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
Posted: Tue Jul 13, 2004 12:07 pm Post subject: |
|
|
Konakav,
As far as I know there is no edit mask for binary data items in Easytrieve. If you really want to see the value of binary item, you can move it to another numeric item with edit mask on it.The only mask allowed on a binary item is hex.
For binary numbers, the high-order (left-most) bit is taken as the sign, regardless of field length. In any manipulation, easytrieve shifts the field and propagates the high-order bit. For example, a one-byte binary field containing a hexadecimal FF has the numeric value -1.
Code: |
DEFINE W-BINARY W 04 B 0
DEFINE W-NUM W 09 N 0 MASK('ZZZZZZZZ9-')
W-BINARY = -1
W-NUM = W-BINARY
DISPLAY 'THE BINARY NUMBER IS:' W-NUM
|
Hope this helps...
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
konakav Beginner
Joined: 13 Jul 2004 Posts: 12 Topics: 3
|
Posted: Wed Jul 14, 2004 1:55 am Post subject: |
|
|
Hi kolusu,
Thanks for your reply.
I tried with your example but its showing the binary value as 0 in the generated report.
Through file-aid, i observed that the value of binary field is 1.
Can u please tell why its giving like that...
Thanks,
Venu. |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
Posted: Wed Jul 14, 2004 5:13 am Post subject: |
|
|
Konakav,
Please post your code.
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
konakav Beginner
Joined: 13 Jul 2004 Posts: 12 Topics: 3
|
Posted: Wed Jul 14, 2004 8:28 am Post subject: |
|
|
Please find the below code.
Input file fields:
SEQ 45 4 B
working storage fields:
WSEQ W 4 B
WNUM W 9 N MASK('ZZZZZZZZ9-') VALUE -1 +
HEADING 'ESTSQ'
WNUM = WSEQ
It's working fine but the value it's showing as 0.
reading from input file and moving it to working storage binary varible and then
moving again to numeric filed.
finally displaying numeric field (WNUM).
Thanks for your support,
Venu |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
Posted: Wed Jul 14, 2004 9:12 am Post subject: |
|
|
Konakav,
Quote: |
reading from input file and moving it to working storage binary varible and then
moving again to numeric filed. finally displaying numeric field (WNUM).
|
First thing is you need to define the binary field with 0 decimals which makes it a signed variable.
i.e
Should be defined as
Also you don't need a working storage variable for the move. you directly move the input file field to the working storage variable which is defined as NUMERIC.
i.e
Code: |
WNUM = SEQ
DISPLAY W-NUM
|
Hope this helps...
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
konakav Beginner
Joined: 13 Jul 2004 Posts: 12 Topics: 3
|
Posted: Wed Jul 14, 2004 10:23 am Post subject: |
|
|
Yeah !!! i got it Kolusu.
Thanks a lot
Venu |
|
Back to top |
|
|
|
|