View previous topic :: View next topic
|
Author |
Message |
rss0213
New User
Joined: 20 Jan 2010 Posts: 26 Location: Alabama
|
|
|
|
Hi. I'm trying to load the value of a BINARY data element (PIC s9(05) BINARY) from numeric data (PIC 9(05)), but I'm not getting the desired results. See below. please advise how to do this. I've tried MOVE, COMPUTE, and ADD - all produce the same results. Why is there a zero on the end of the target field?
Code: |
20 ZMQMS-MQ-MESSAGE-LEN PIC 9(005). |
Code: |
16 WS-MESSAGE-LEN PIC S9(05) BINARY. |
Code: |
DISPLAY '-MQIO- ZMQMS-MQ-MESSAGE-LEN: '
ZMQMS-MQ-MESSAGE-LEN.
MOVE ZMQMS-MQ-MESSAGE-LEN TO
WS-MESSAGE-LEN.
DISPLAY '-MQIO- WS-MESSAGE-LEN: '
WS-MESSAGE-LEN. |
OUTPUT:
Code: |
-MQIO- ZMQMS-MQ-MESSAGE-LEN: 5704
-MQIO- WS-MESSAGE-LEN: 57040 |
|
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Count your digits in the output from your DISPLAY. I make that four.
Put ">" "<" (or similar) around each field you DISPLAY, then you can see every time. Saved me and those I've suggested it to many, many hours over the years. |
|
Back to top |
|
|
rss0213
New User
Joined: 20 Jan 2010 Posts: 26 Location: Alabama
|
|
|
|
I'm not sure what you mean. The original message length value is 5704. The receiving variable gets 57040. How is that? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Brain fade here . . . .
Quote: |
Count your digits in the output from your DISPLAY. I make that four. |
Code: |
20 ZMQMS-MQ-MESSAGE-LEN PIC 9(005). |
How did the 9(005) become a length of four?
Been one of those days between my ears . . .
Do be gentle . . .
d |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
rss0213 wrote: |
I'm not sure what you mean. The original message length value is 5704. The receiving variable gets 57040. How is that? |
How many digits are in "5704"? |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
Your PIC 9(005) variable probably has 5704 and a space - hence the suggestion to use '>' and '<' to clearly delineate your variable value. The space will be converted to a zero during the move, hence the BINARY variable value is 57040. |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3051 Location: NYC,USA
|
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
Scott,
well, since MQS delivers the message size in binary (part of each message header)
it could be that the idiot that converted the binary value to a display value (used as your input) created a small problem.
the message length is usually contained in a fullword binary field.
so, S9(05) as the display field is not a good choice.
so, as several have said, investigate the value contained in the display field. |
|
Back to top |
|
|
rss0213
New User
Joined: 20 Jan 2010 Posts: 26 Location: Alabama
|
|
|
|
I found the issue. A group-level MOVE statement in a different area of the program was stomping on the data area contained in ZMQMS-MQ-MESSAGE-LEN. That group-level item contained a LENGTH field with PIC 9(04).
Mystery solved. Thanks for helping everyone! |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Good to hear it is resolved - thank you for letting us know
d |
|
Back to top |
|
|
|