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

CICS eibresp 22 while reading VSAM File Sequentially


IBM Mainframe Forums -> CICS
Post new topic   Reply to topic
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
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Apr 22, 2014 1:50 am
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: 8696
Location: Dubuque, Iowa, USA

PostPosted: Tue Apr 22, 2014 1:57 am
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
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Apr 22, 2014 2:06 am
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
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

Global Moderator


Joined: 21 Sep 2010
Posts: 3051
Location: NYC,USA

PostPosted: Tue Apr 22, 2014 3:13 am
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,

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
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

Global Moderator


Joined: 21 Sep 2010
Posts: 3051
Location: NYC,USA

PostPosted: Tue Apr 22, 2014 3:29 am
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
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

Global Moderator


Joined: 21 Sep 2010
Posts: 3051
Location: NYC,USA

PostPosted: Tue Apr 22, 2014 3:39 am
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Apr 22, 2014 3:47 am
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
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

Superior Member


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

PostPosted: Tue Apr 22, 2014 4:06 pm
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
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
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: 2501
Location: Atlanta, Georgia, USA

PostPosted: Tue Apr 22, 2014 11:07 pm
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

Global Moderator


Joined: 21 Sep 2010
Posts: 3051
Location: NYC,USA

PostPosted: Wed Apr 23, 2014 4:09 am
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Apr 23, 2014 4:26 am
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CICS

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 1
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Using API Gateway from CICS program CICS 0
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top