Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

CICS eibresp 22 while reading VSAM File Sequentially

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CICS
View previous topic :: :: View next topic  
Author Message
abhishek chhawcharia

New User


Joined: 21 Mar 2009
Posts: 10
Location: Ohio

PostPosted: Tue Apr 22, 2014 1:38 am    Post subject: CICS eibresp 22 while reading VSAM File Sequentially
Reply with quote

HI All,

I am facing a problem of getting a eibresp of 22 while reading a VSAM file. I am doing a STARTBR as I am trying to read the file sequentially.

EXEC CICS
STARTBR
FILE ('PHREVSAM')
RIDFLD(PHREVSAM-KEY)
GTEQ
RESP(RESPONSE-CODE)
END-EXEC.


The response code is coming as 0 for the above command.

After this I am doing,

EXEC CICS READNEXT
DATASET('PHREVSAM')
INTO(PHREVSAM-REC)
LENGTH(PHREVSAM-LEN)
RIDFLD(PHREVSAM-KEY)
RESP(RESPONSE-CODE)
END-EXEC

While PHREVSAM-LEN is defined as PIC 9(5) VALUE 22000 as 22000 is the total length of each record in VSAM file.

I am not sure what I doing here wrong. Any help or comment will be appreciated.

Abhishek
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7232

PostPosted: Tue Apr 22, 2014 1:50 am    Post subject: Reply to: CICS eibresp 22 while reading VSAM File Sequential
Reply with quote

What length have you defined for PHREVSAM-REC? Check on the compile listing.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7913
Location: Bellevue, IA

PostPosted: Tue Apr 22, 2014 1:57 am    Post subject:
Reply with quote

From the Application Programming Reference manual on READFROM:
Quote:
LENGTH(data-area)

specifies the length, as a halfword binary value, of the data area where the record is to be put. On completion of the READNEXT command, the LENGTH parameter contains the actual length of the record.
PIC 9(5) would be incorrect -- try PIC S9(04) COMP instead.
Back to top
View user's profile Send private message
abhishek chhawcharia

New User


Joined: 21 Mar 2009
Posts: 10
Location: Ohio

PostPosted: Tue Apr 22, 2014 2:04 am    Post subject: Reply to: CICS eibresp 22 while reading VSAM File Sequential
Reply with quote

I tried doing that and changing the declaration as below.

05 PHREVSAM-LEN PIC S9(04) COMP .

But I still get the same error as 22.

Also the length of my VSAM file is 22000.

Abhishek
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7232

PostPosted: Tue Apr 22, 2014 2:06 am    Post subject: Reply to: CICS eibresp 22 while reading VSAM File Sequential
Reply with quote

22,000 isn't going to fit in COMP PIC 9(4), unless you are using compiler option TRUNC(BIN).

If you are not using TRUNC(BIN), define it as COMP-5 PIC 9(4).
Back to top
View user's profile Send private message
abhishek chhawcharia

New User


Joined: 21 Mar 2009
Posts: 10
Location: Ohio

PostPosted: Tue Apr 22, 2014 2:11 am    Post subject: Reply to: CICS eibresp 22 while reading VSAM File Sequential
Reply with quote

I tried changing the declaration to COMP-5 PIC 9(4). It still give me resposnse code of 22 in first read and the PHREVSAM-REC is spaces....

Abhishek icon_question.gif
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1610
Location: NY,USA

PostPosted: Tue Apr 22, 2014 3:13 am    Post subject:
Reply with quote

Quote:
LENGTH(data-area)
specifies the length, as a halfword binary value, of the data area where the record is to be put. On completion of the READNEXT command, the LENGTH parameter contains the actual length of the record.


If you read the bold one then after READNEXT you would be getting the actual length and you should not be populating this field but however your below statement say's you do so. Please try keeping it initialized to zero while you do a READNEXT.

Quote:
While PHREVSAM-LEN is defined as PIC 9(5) VALUE 22000 as 22000 is the total length of each record in VSAM file.


fyi,

http://publib.boulder.ibm.com/infocenter/cicsts/v3r1/index.jsp?topic=%2Fcom.ibm.cics.ts31.doc%2Fdfhp4%2Fcommands%2Fdfhp4_readnext.htm
Back to top
View user's profile Send private message
abhishek chhawcharia

New User


Joined: 21 Mar 2009
Posts: 10
Location: Ohio

PostPosted: Tue Apr 22, 2014 3:27 am    Post subject: Reply to: CICS eibresp 22 while reading VSAM File Sequential
Reply with quote

Hi Rohit,

I read the sentence in bold and corrected the field declaration to COMP-5 PIC 9(4) but I still get the same error message. VSAM record length is 22000.
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1610
Location: NY,USA

PostPosted: Tue Apr 22, 2014 3:29 am    Post subject:
Reply with quote

Have you still given the VALUE clause, if yes then try keeping without it? also can you please tell what value are you getting into EIBRESP2 ? can you also check for the FCT entry to be a Fixed Record as you say?
Back to top
View user's profile Send private message
abhishek chhawcharia

New User


Joined: 21 Mar 2009
Posts: 10
Location: Ohio

PostPosted: Tue Apr 22, 2014 3:31 am    Post subject:
Reply with quote

Hi Rohit,

I have removed the value and made the declaration as below.

PHREVSAM-LEN COMP-5 PIC 9(4).

And I still get the error. Do you think adding the value clause will make any difference?
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1610
Location: NY,USA

PostPosted: Tue Apr 22, 2014 3:39 am    Post subject:
Reply with quote

Quote:
Do you think adding the value clause will make any difference?


No, can you also verify COMP-5 (Native Binary) is supported by your compiler ? Also I hope after compilation with COMP-5 a NEW COPY has been done icon_smile.gif
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7232

PostPosted: Tue Apr 22, 2014 3:47 am    Post subject: Reply to: CICS eibresp 22 while reading VSAM File Sequential
Reply with quote

Quote:
If you specify the INTO option, the LENGTH argument must be a data area that specifies the largest record the program accepts. If the retrieved record is longer than the value specified in the LENGTH option, the record is truncated to the specified value and the LENGERR condition occurs. In this case, the LENGTH data area is set to the length of the record before truncation


If you have read a short record, and then read a longer one, you'll get the 22.

Are your records variable in length?

I would MOVE LENGTH OF record-area TO record-area-length before each of your reads.

You could show the length (which contains the pre-truncated value) when you show the 22.
Back to top
View user's profile Send private message
abhishek chhawcharia

New User


Joined: 21 Mar 2009
Posts: 10
Location: Ohio

PostPosted: Tue Apr 22, 2014 7:26 am    Post subject:
Reply with quote

NO, the records are fixed length of 22000 bytes.

So what you are saying is I should move the length of PHREVSAM-REC to PHREVSAM-LEN before every read??
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Tue Apr 22, 2014 4:06 pm    Post subject: Re: Reply to: CICS eibresp 22 while reading VSAM File Sequen
Reply with quote

With COMP and 22000, you assign a value to this field which won't fit in it, said that ,you've two choices -- as has been said, you should either specify the TRUNC(BIN) compiler option or define this field as COMP-5 but then, as said earlier, your compiler might/might not supports this.

And you should also note that if you use COMP-5 and use TRUNC option as well, there is no use of that - as these two don't talk to each other.
Back to top
View user's profile Send private message
abhishek chhawcharia

New User


Joined: 21 Mar 2009
Posts: 10
Location: Ohio

PostPosted: Tue Apr 22, 2014 8:43 pm    Post subject:
Reply with quote

Hi All,

Thanks for the responses. MOVE LENGTH OF statement fixed the issue and now the VSAM file read and write is happening correctly.

Appreciate all your help.

Abhishek
Back to top
View user's profile Send private message
Mickeydusaor

Active User


Joined: 24 May 2006
Posts: 258
Location: Salem, Oregon

PostPosted: Tue Apr 22, 2014 10:50 pm    Post subject:
Reply with quote

If you had coded your CICS statements as below you would not have had any of these issues.

Code:

EXEC CICS READNEXT
       DATASET ('PHREVSAM')
       INTO      (PHREVSAM-REC)
       LENGTH  (length of PHREVSAM-REC)
       RIDFLD   (PHREVSAM-KEY)
       RESP      (RESPONSE-CODE)
       END-EXEC
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2502
Location: Atlanta, Georgia, USA

PostPosted: Tue Apr 22, 2014 11:07 pm    Post subject: Reply to: CICS eibresp 22 while reading VSAM File Sequential
Reply with quote

Mickey,

I think he had the halfword defined in WS with a value clause and he used TRUNC(OPT) during compilation.

This causes high-order truncation, because the picture clause is 4 and the value exceeds 9999. But, the LENGTH OF is the better way to go.

COMP-5 was introduced with OS/390 COBOL 2.2 (about 15 years ago). But, if the OP is running a non-friendly COMP-5 compiler, he'd have to use TRUNC(BIN) in order to negate any truncation of non COMP-5 binary fields.

Sidenote: Always use KEYLENGTH in a FILE API because if the file becomes REMOTE, then the CICS System Programmer doesn't need to scurry around and find this value for the FCT entry. The KEYLENGTH keyword (and value) is NOT Function Shipped to a Remote File for any File API.

HTH....
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1610
Location: NY,USA

PostPosted: Wed Apr 23, 2014 4:09 am    Post subject:
Reply with quote

Bill,

I would just like to understand more here on how
Quote:
LENGTH OF is the better way to go.
got resolved the probelm and when there was COMP-5 in place? IS it always necessary to use LENGTH OF? As TS should still be able to get success if COMP-5 was in place and as per him it was (may be , I guessing!!)
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7232

PostPosted: Wed Apr 23, 2014 4:26 am    Post subject: Reply to: CICS eibresp 22 while reading VSAM File Sequential
Reply with quote

First question is "which Bill"?

COMP/COMP-4/BINARY PIC 9(4) with TRUNC(OPT) (likely) or TRUNC(STD) (definitely) cannot hold more than 9999 as a value. the compiler does decimal truncation to the PICture size.

COMP-5 (or any of the above with TRUNC(BIN)) does binary truncation to the field size, The PICture is just used to define the field size. PIC 9 to PIC 9(4) gets a half-word, but the maximum value of any of those is 64k-1.

LENGTH OF field gets a value representing the length of the field in question (saves counting, looking at the listing, "knowing").

If the length of the data is required to be passed to CICS, and if CICS then sets that value to the actual length used, it will need to be re-set each time.

I'd suspect that the length of the field turned out to be less than 22,000, or that the actual records are larger than thought to be. Using LENGTH OF instead of a literal takes away the effort of ensure that the literal is, and remains, correct.

Just from reading the link, it would seem that LENGTH(...) is not needed for fixed-length records anyway...
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CICS All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts CICS START AND CANCEL blayek CICS 1 Wed Dec 07, 2016 3:27 am
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts How does a called pgm know if its cal... Graeme Westerman COBOL Programming 4 Tue Nov 29, 2016 9:25 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us