IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Read of TDQ fails in LENGERR


IBM Mainframe Forums -> CICS
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Tracy Hansen

New User


Joined: 31 Mar 2017
Posts: 5
Location: United States

PostPosted: Wed Apr 05, 2017 12:10 am
Reply with quote

Basic issue: Read of TDQ fails in LENGERR even though length does not exceed the defined length.

Background: I am testing a process that is completely successful in production, but is failing in test. The process is new in test because we have moved to a new mainframe. The new mainframe had to create the TDQ for test.

This is the failing read:
EXEC CICS
READQ TD QUEUE(WS-TD-QUEUE)
INTO(WS-IMPORTED-RCD)
LENGTH(WS-IMPORTED-LENGTH)
END-EXEC.

WS-IMPORTED-LENGTH is hard coded to +10007.
The returned length upon the LENGERR is +00699.
The returned string is not accurate; only the first six characters are returned (based on a display via tracing with the IBM Debug Tool) with the rest of the string displaying as spaces.

A visual display of the TDQ in TSO shows the data set does have a length of 10007; the first record has data present through column 3415.

The database staff have confirmed that all components are set up in test as they are in production.

One of the staff suggested that perhaps something was out of sync in test, but I have not found anything that appears out of sync.

Any help would be extremely appreciated.
Thank you in advance.
Back to top
View user's profile Send private message
RahulG31

Active User


Joined: 20 Dec 2014
Posts: 446
Location: USA

PostPosted: Wed Apr 05, 2017 12:34 am
Reply with quote

Please check:

https://www.ibm.com/support/knowledgecenter/en/SSGMCP_5.3.0/com.ibm.cics.ts.applicationprogramming.doc/commands/dfhp4_read.html

Quote:
When reading fixed-length records into an area longer than the record being accessed, the LENGERR condition is raised for COBOL, C, PL/I, and assembler-language applications if the LENGTH option is specified.


.
Back to top
View user's profile Send private message
Tracy Hansen

New User


Joined: 31 Mar 2017
Posts: 5
Location: United States

PostPosted: Wed Apr 05, 2017 12:42 am
Reply with quote

RahulG31 thank you for your reply.

I am not sure I understand. The link you provided is for the READ of a file, not a READQ on a TDQ. While the LENGERR is the same for a READQ, it does not explain my issue. As I mentioned in my post, while a LENGERR is returned, the record is defined as +10007, but has an returned length of +00699...much less than +10007. The returned length it self is inaccurate as well since a display of the record in TSO shows it is 3415 characters long not the returned +00699.

Thank you for trying to help.
Back to top
View user's profile Send private message
RahulG31

Active User


Joined: 20 Dec 2014
Posts: 446
Location: USA

PostPosted: Wed Apr 05, 2017 12:50 am
Reply with quote

My mistake Tracy. Please ignore.
Back to top
View user's profile Send private message
RahulG31

Active User


Joined: 20 Dec 2014
Posts: 446
Location: USA

PostPosted: Wed Apr 05, 2017 12:59 am
Reply with quote

how long is WS-IMPORTED-RCD ?
Back to top
View user's profile Send private message
Tracy Hansen

New User


Joined: 31 Mar 2017
Posts: 5
Location: United States

PostPosted: Wed Apr 05, 2017 1:03 am
Reply with quote

It is defined in the program as +10007. The record in TSO contains 3415 and is defined as VB. WS-IMPORTED-LENGTH, upon the LENGERR failure, contains +00699.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Wed Apr 05, 2017 2:43 am
Reply with quote

How is WS-IMPORTED-LENGTH defined? Post the definitions for the various variables used in your CICS READQ TD command.

From the V5.3 Reference manual, there's only a couple of ways to get LENGERR:
Quote:
22 LENGERR
Occurs if READQ names an INTO area that cannot hold all the data that is to be returned to the application or an invalid length has been supplied. The check is made after the XTDIN exit has been invoked.
Back to top
View user's profile Send private message
Tracy Hansen

New User


Joined: 31 Mar 2017
Posts: 5
Location: United States

PostPosted: Wed Apr 05, 2017 3:07 am
Reply with quote

In Working Storage:
05 WS-TD-QUEUE PIC X(04) VALUE 'IMPT'.
...
05 WS-IMPORTED-LENGTH PIC S9(4) COMP VALUE +0.
...
01 WS-IMPORTED-RECORD.
05 WS-IMPORTED-RCD.
10 WS-IMPORTED-TYPE PIC X(05).
10 FILLER PIC X(10002).

In the Procedure Division:
MOVE +10007 TO WS-IMPORTED-LENGTH.
MOVE SPACES TO WS-IMPORTED-RECORD.

EXEC CICS
READQ TD QUEUE(WS-TD-QUEUE)
INTO(WS-IMPORTED-RCD)
LENGTH(WS-IMPORTED-LENGTH)
END-EXEC.

Data Set Information in TSO:
General Data
Management class . . : STANDEF
Storage class . . . : STANDARD
Volume serial . . . : AKDSTF
Device type . . . . : 3390
Data class . . . . . : STANDARD
Organization . . . : PS
Record format . . . : VB
Record length . . . : 10011
Block size . . . . : 10015
1st extent cylinders: 1
Secondary cylinders : 1
Data set name type :
SMS Compressible. . : NO

I do not know why the physical data set is defined in TSO as 10011 and the TDQ and variables set to 10007, but I do know they are the same in production and working.

Please let me know if you have any other questions.
Thank you for your assistance.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Wed Apr 05, 2017 5:46 am
Reply with quote

Quote:
I do not know why the physical data set is defined in TSO as 10011 and the TDQ and variables set to 10007
Because the LRECL for a variable length data set is 4 higher than the maximum record length allowed, due to the 4-byte RDW (Record Descriptor Word) the operating system adds to the front of each record to indicate how long it is. You may be on the wrong forum -- the Beginners and Students Forum is more for people who have little to no mainframe experience and hence don't know what an RDW is.

What is the TRUNC option set to in your program compile? TRUNC(BIN) is what you need. TRUNC(STD) would change the 10007 to 0007 (because it forces the value to match the PICTURE clause and hence would remove the first digit) and TRUNC(OPT) most likely would do the same. Look at the first page of the compile output to find the compiler options used.

And, by the way, your previous post that WS-IMPORTED-LENGTH is hard-coded to 10007 is incorrect -- there is a MOVE for it.
Back to top
View user's profile Send private message
Tracy Hansen

New User


Joined: 31 Mar 2017
Posts: 5
Location: United States

PostPosted: Wed Apr 05, 2017 9:35 pm
Reply with quote

Robert,
Thank you for your assistance. The code was compiled with TRUNC(STD) and re-compiling with TRUNC(BIN) worked.
The READ is now successful.
It is now failing with a DUPREC but that should be resolved when I test with new data.

I have fifteen years experience programming, but most of it was spent using a CASE Tool where I did not have to do more than check the condition codes. Additionally, all my experience has been on-the-job training. I do not have formal education in IT and I know I likely missed some of the more technical aspects that I would have learned with formal education.

The last couple of years I took on responsibility for a group of legacy processes written in COBOL. However, even senior programmers in my shop did not have a clue with this one.

Thanks again for the help.
Tracy
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Wed Apr 05, 2017 9:41 pm
Reply with quote

TRUNC is a common culprit with COBOL programs that are having storage issues -- many sites use TRUNC(OPT) which does not allow the programmer to know in advance how COMP variables will work. One alternative you might want to consider is making all COMP variables COMP-5 instead. COMP-5 will ALWAYS use the memory size and not the PICTURE size.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CICS

 


Similar Topics
Topic Forum Replies
No new posts Error to read log with rexx CLIST & REXX 11
No new posts Random read in ESDS file by using RBA JCL & VSAM 6
No new posts VSAM return code 23 - for a Random read COBOL Programming 4
No new posts ICETOOL to Read records SMF CEF it is... DFSORT/ICETOOL 4
No new posts dsnrexx fails without error message CLIST & REXX 9
Search our Forums:

Back to Top