ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » Mainframe, CICS, TXSeries » GET converts EBCDIC to ASCII?

Post new topic  Reply to topic Goto page Previous  1, 2, 3  Next
 GET converts EBCDIC to ASCII? « View previous topic :: View next topic » 
Author Message
bruce2359
PostPosted: Tue Oct 09, 2012 5:45 am    Post subject: Reply with quote

Poobah

Joined: 05 Jan 2008
Posts: 9396
Location: US: west coast, almost. Otherwise, enroute.

A best-practice is for the developer to initialize all of the app data portion of the input buffer to nulls or blanks BEFORE the get. If the next get call fails, it will be really easy to recognize NO data vs. corrupted data.
_________________
I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Tue Oct 09, 2012 7:17 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20696
Location: LI,NY

bruce2359 wrote:
A best-practice is for the developer to initialize all of the app data portion of the input buffer to nulls or blanks BEFORE the get. If the next get call fails, it will be really easy to recognize NO data vs. corrupted data.

Not quite getting you. Would he not have received the truncated error?
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
mqjeff
PostPosted: Tue Oct 09, 2012 7:20 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

fjb_saper wrote:
bruce2359 wrote:
A best-practice is for the developer to initialize all of the app data portion of the input buffer to nulls or blanks BEFORE the get. If the next get call fails, it will be really easy to recognize NO data vs. corrupted data.

Not quite getting you. Would he not have received the truncated error?


While , it's still recommended practice to provide an empty buffer, *as well as* recommended practice to ALWAYS check the MQRC/CC before accessing the buffer.
Back to top
View user's profile Send private message
bruce2359
PostPosted: Tue Oct 09, 2012 8:17 am    Post subject: Reply with quote

Poobah

Joined: 05 Jan 2008
Posts: 9396
Location: US: west coast, almost. Otherwise, enroute.

fjb_saper wrote:
bruce2359 wrote:
A best-practice is for the developer to initialize all of the app data portion of the input buffer to nulls or blanks BEFORE the get. If the next get call fails, it will be really easy to recognize NO data vs. corrupted data.

Not quite getting you. Would he not have received the truncated error?

He'd get the msg too big error, but no data would be in the buffer from prior successful gets.
_________________
I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live.
Back to top
View user's profile Send private message
sumithar
PostPosted: Tue Oct 09, 2012 9:41 am    Post subject: Reply with quote

Apprentice

Joined: 13 Jun 2008
Posts: 47

bruce2359 wrote:
sumithar wrote:
OK, so I got to the bottom of this. What happens is that if the message read from the queue is greater than the specified length in the variable buf-len then somehow the MQGMO-CONVERT option gets "corrupted", i.e. the conversion doesn't happen anymore.

Nothing got corrupted.

Unless the accept-truncated-message GMO is specified, the get call fails when MSG length exceeds buffer size. If the call fails, no MSG is delivered, therefore no message can be converted.
.


Sorry I didn't make myself clear.

I'm checking the completion code and have this in place
Code:
****2080 - MESSAGE LENGTH TOO LARGE **********       
     IF WS-MQ-RC = (2080 OR 2010)                     
        ADD 1                TO WS-QUEUE-GET-CTR     
        MOVE WS-MQ-RC        TO AUDIT-ERROR-CODE     
        PERFORM 2100-PROCESS-LENGTH-ERR THRU 2100-EXIT
        GO TO 2000-EXIT                               
     END-IF
.
I can see that I'm getting a 2080 in the situation I've specified. What I do then is issue another MQGET call (in the 2100- paragraph) this time with a large enough buffer size and then write out the errant message into an error file which I can look at later on.

What I'm trying to say is that when the MQGET encounters an error due to the length, the subsequent MQGETs are being impacted even if messages are the right length in the sense that they are not being converted from ASCII to EBCDIC. This is what I termed as the MQGMO-CONVERT getting corrupted.

I wonder if having the Accpeted Truncated message option in GMO will alleviate that issue.

Also, I'm initializing the buffer into which I am GETting the data before each GET.
Back to top
View user's profile Send private message
rekarm01
PostPosted: Tue Oct 09, 2012 2:11 pm    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 1415

sumithar wrote:
Code:
****2080 - MESSAGE LENGTH TOO LARGE **********
     IF WS-MQ-RC = (2080 OR 2010)

Hopefully, the application is also checking for any other non-zero MQRC.

sumithar wrote:
Also, I'm initializing the buffer into which I am GETting the data before each GET.

What about also initializing the MQMD and GMO parameters before each GET? Particularly after a failure due to MQRC 2080?
Back to top
View user's profile Send private message
mvic
PostPosted: Tue Oct 09, 2012 2:58 pm    Post subject: Reply with quote

Jedi

Joined: 09 Mar 2004
Posts: 2080

bruce2359 wrote:
A best-practice is for the developer to initialize all of the app data portion of the input buffer to nulls or blanks BEFORE the get. If the next get call fails, it will be really easy to recognize NO data vs. corrupted data.

It's really easy to recognise a nonzero completion code / reason code. Why waste CPU cycles clearing out a buffer before an MQGET? Sure it can't do any harm to your data, but I'd say think twice about the energy and performance implications of writing code like that. IMHO.


Last edited by mvic on Tue Oct 09, 2012 3:03 pm; edited 1 time in total
Back to top
View user's profile Send private message
mvic
PostPosted: Tue Oct 09, 2012 2:59 pm    Post subject: Reply with quote

Jedi

Joined: 09 Mar 2004
Posts: 2080

mqjeff wrote:
While , it's still recommended practice to provide an empty buffer, *as well as* recommended practice to ALWAYS check the MQRC/CC before accessing the buffer.

I'd go for the second half of that, not the first half.
Back to top
View user's profile Send private message
mvic
PostPosted: Tue Oct 09, 2012 3:02 pm    Post subject: Reply with quote

Jedi

Joined: 09 Mar 2004
Posts: 2080

sumithar wrote:
What I'm trying to say is that when the MQGET encounters an error due to the length, the subsequent MQGETs are being impacted even if messages are the right length in the sense that they are not being converted from ASCII to EBCDIC. This is what I termed as the MQGMO-CONVERT getting corrupted.

Sounds wrong. Did you open a PMR with IBM?

Quote:
I wonder if having the Accpeted Truncated message option in GMO will alleviate that issue.

Only tell MQ you will accept a truncated message if you really want to accept a truncated message. Do you want that?

Quote:
Also, I'm initializing the buffer into which I am GETting the data before each GET.

Don't bother. See my previous posts.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Tue Oct 09, 2012 3:17 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20696
Location: LI,NY

sumithar wrote:

What I'm trying to say is that when the MQGET encounters an error due to the length, the subsequent MQGETs are being impacted even if messages are the right length in the sense that they are not being converted from ASCII to EBCDIC. This is what I termed as the MQGMO-CONVERT getting corrupted.

I wonder if having the Accpeted Truncated message option in GMO will alleviate that issue.

Also, I'm initializing the buffer into which I am GETting the data before each GET.

So are you setting the options before every get?
Are you sure that in your loop you are not just dropping the convert option when you hit the error? Hence subsequent messages without convert?
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
mvic
PostPosted: Tue Oct 09, 2012 3:20 pm    Post subject: Reply with quote

Jedi

Joined: 09 Mar 2004
Posts: 2080

fjb_saper wrote:
So are you setting the options before every get?
Are you sure that in your loop you are not just dropping the convert option when you hit the error? Hence subsequent messages without convert?

Best suggestion so far.
Back to top
View user's profile Send private message
bruce2359
PostPosted: Tue Oct 09, 2012 3:49 pm    Post subject: Reply with quote

Poobah

Joined: 05 Jan 2008
Posts: 9396
Location: US: west coast, almost. Otherwise, enroute.

The resolution for Message-too-big-for-buffer error is to increase buffer length to.a size larger than your longest message, recompile.
_________________
I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live.
Back to top
View user's profile Send private message
bruce2359
PostPosted: Tue Oct 09, 2012 4:09 pm    Post subject: Reply with quote

Poobah

Joined: 05 Jan 2008
Posts: 9396
Location: US: west coast, almost. Otherwise, enroute.

One of the items output from the mqget call is the actual length of the message in the queue. This is especially useful for the message-too-big-for-buffer failure.
_________________
I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live.
Back to top
View user's profile Send private message
mvic
PostPosted: Wed Oct 10, 2012 5:48 am    Post subject: Reply with quote

Jedi

Joined: 09 Mar 2004
Posts: 2080

bruce2359 wrote:
The resolution for Message-too-big-for-buffer error is to increase buffer length to.a size larger than your longest message, recompile.

I do not agree. Yes you need a bigger buffer, but there is no need to rebuild your application each time! Just free the buffer you have allocated, and ask the runtime library for a bigger buffer.

Having said that, I am not sure what runtime facilities are available in the language the OP is using. I was thinking about the C runtime when I made my comments.
Back to top
View user's profile Send private message
sumithar
PostPosted: Wed Oct 10, 2012 7:31 am    Post subject: Reply with quote

Apprentice

Joined: 13 Jun 2008
Posts: 47

fjb_saper wrote:
sumithar wrote:

What I'm trying to say is that when the MQGET encounters an error due to the length, the subsequent MQGETs are being impacted even if messages are the right length in the sense that they are not being converted from ASCII to EBCDIC. This is what I termed as the MQGMO-CONVERT getting corrupted.

I wonder if having the Accpeted Truncated message option in GMO will alleviate that issue.

Also, I'm initializing the buffer into which I am GETting the data before each GET.

So are you setting the options before every get?
Are you sure that in your loop you are not just dropping the convert option when you hit the error? Hence subsequent messages without convert?


Yes, this is the full sequence.
Code:
2000-PROCESS-QUEUE-MESSAGES.                       
-----------------------------*                     
                                                   
    INITIALIZE WS-RRBF362-LAYOUT.                 
    MOVE MQMI-NONE          TO MQMD-MSGID.         
    MOVE MQCI-NONE          TO MQMD-CORRELID.     
                                                   
    COMPUTE MQGMO-OPTIONS = MQGMO-NONE      +     
                            MQGMO-NO-WAIT   +     
                            MQGMO-SYNCPOINT +     
                            MQGMO-CONVERT   +     
                            MQGMO-FAIL-IF-QUIESCING
                                                   
    CALL  MQGET  USING      WS-MQ-HCONN           
                            WS-MQ-HOBJ             
                            MQMD                   
                            MQGMO                 
                            WS-MQ-BUF-LEN         
                            WS-RRBF362-LAYOUT     
                            WS-MQ-DATA-LEN         
                            WS-MQ-CC               
                            WS-MQ-RC. 


I understand now that initialize statement is not strictly necessary...

What I could potentially do is set the value of WS-MQ-BUF-LEN to be very large. I could define a constant for what I expect the actual max message length to be, let's say WS-MAX-MSG-LEN or some such thing.
Then when I GET i won't get 2080 error.
I can then compare WS-MQ-DATA-LEN (the actual length of retrieved message) with WS-MAX-MSG-LEN and if greater treat it as a length error and write out into error file.

This being COBOL it's not as straightforward as C to allocate memory dynamically (at least I've never done it!)

I can talk to the SYSPROG people about the PMR.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Goto page Previous  1, 2, 3  Next Page 2 of 3

MQSeries.net Forum Index » Mainframe, CICS, TXSeries » GET converts EBCDIC to ASCII?
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.