View previous topic :: View next topic
|
Author |
Message |
Vedam
New User
Joined: 24 Apr 2007 Posts: 23 Location: India
|
|
|
|
Hi,
I have redefined a COMP variable as follows:
01 WS-TEST-VAR1 PIC S9(6) COMP.
01 WS-TEST-VAR2 REDEFINES WS-TEST-VAR1.
05 WS-TEST-VAR3 PIC X(2).
I moved +123456 to WS-TEST-VAR1
when I used display option against WS-TEST-VAR3, it is showing spaces. What could be the possible reason? I have used the compiler option TRUNC(STD) and TRUNC(BIN) |
|
Back to top |
|
|
agkshirsagar
Active Member
Joined: 27 Feb 2007 Posts: 691 Location: Earth
|
|
|
|
Are you sure of this?
I guess you should get WS-TEST-VAR3 = x'0001'.. |
|
Back to top |
|
|
Vedam
New User
Joined: 24 Apr 2007 Posts: 23 Location: India
|
|
|
|
Yeah..i am sure that nothng is displayed when I display the variable WS-TEST-VAR3 |
|
Back to top |
|
|
agkshirsagar
Active Member
Joined: 27 Feb 2007 Posts: 691 Location: Earth
|
|
|
|
Did you do hex on while looking in spool.
Sometimes you get confused when nothing is displayed but in actual there may be some o/p. |
|
Back to top |
|
|
Vedam
New User
Joined: 24 Apr 2007 Posts: 23 Location: India
|
|
|
|
I think hex is off. What should be the correct output? should the variable value be truncated while displaying? |
|
Back to top |
|
|
agkshirsagar
Active Member
Joined: 27 Feb 2007 Posts: 691 Location: Earth
|
|
|
|
I repeat,you should get WS-TEST-VAR3 = x'0001'.
Try doing hex on in spool o/p |
|
Back to top |
|
|
muthuvel
Active User
Joined: 29 Nov 2005 Posts: 217 Location: Canada
|
|
|
|
Vedam,
This is the piece of code and output i got
Code:
Code: |
01 A1 PIC S9(6).
01 X1 REDEFINES A1.
05 D1 PIC X(2).
PROCEDURE DIVISION.
0000-INIT.
MOVE +123456 TO A1
DISPLAY 'VALUE OF D: ' , D1
GOBACK
.
0000-EXIT.
EXIT
. |
and my job output is
Code: |
********************************
VALUE OF D: 12 |
|
|
Back to top |
|
|
agkshirsagar
Active Member
Joined: 27 Feb 2007 Posts: 691 Location: Earth
|
|
|
|
Muthu,
It's good that you tried but not with correct variable declaration.
Try with -
01 A1 PIC S9(6) COMP. And please let us know.. |
|
Back to top |
|
|
muthuvel
Active User
Joined: 29 Nov 2005 Posts: 217 Location: Canada
|
|
|
|
Abhijit,
I am sorry man.I tried both the code and pasted the wrong one :lol:
You are right the output in hexadecimal is D=x'0001' |
|
Back to top |
|
|
Vedam
New User
Joined: 24 Apr 2007 Posts: 23 Location: India
|
|
|
|
can you please tell me the syntax to do hex on in Spool. I am not able to do so. |
|
Back to top |
|
|
agkshirsagar
Active Member
Joined: 27 Feb 2007 Posts: 691 Location: Earth
|
|
|
|
Don't be.
it is always better to try something instead of waiting for an answer.
Now explanation, why I was so sure of my answer..
COMP = Binary
1 bit sign and rest binary representation of number.
Now +123456 = 0000 0000 0000 0001 1110 0010 0100 0000
X(02) will overlap with first two bytes- so X'0001'. |
|
Back to top |
|
|
muthuvel
Active User
Joined: 29 Nov 2005 Posts: 217 Location: Canada
|
|
|
|
Copy the Sysout to a Flat File of Record length 80 using XDC .
In the copied file ,open it in view mode and type "HEX ON " in command window.
You will see the required output in the below format
Code: |
4004444444444444444444444444444444444444444444444444444444444
0010000000000000000000000000000000000000000000000000000000000 |
See it in up-down fashion,and you will get the need. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
For SDSF it's SET HEX ON and SET HEX OFF
Quote: |
Don't be.
it is always better to try something instead of waiting for an answer. |
Yes, an excellent philosophy. WELL SAID. |
|
Back to top |
|
|
Vedam
New User
Joined: 24 Apr 2007 Posts: 23 Location: India
|
|
|
|
In HEX mode I got the required output. Thanks all for l your clarification.
One more question, when the hex is off, why should the data be shown as spaces? |
|
Back to top |
|
|
agkshirsagar
Active Member
Joined: 27 Feb 2007 Posts: 691 Location: Earth
|
|
|
|
Quote: |
why should the data be shown as spaces? |
X'00' and X'01' are non displayable characters in EBCDIC code.
Space is X'40' so dont mistake non displayable characters with spaces.
see EBCDIC chart present in downloads section of this site.
Good luck. |
|
Back to top |
|
|
Phrzby Phil
Senior Member
Joined: 31 Oct 2006 Posts: 1042 Location: Richmond, Virginia
|
|
|
|
If you browse or view/edit a dataset, as opposed to SYSOUT, then the non-printing chars show as periods "." (as in a core dump).
HEX ON shows three rows:
top = display
2nd = left nibbles
3rd = right nibbles |
|
Back to top |
|
|
|