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

VSAM Read error in Easytrieve


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Aravinthkumar

New User


Joined: 09 Feb 2009
Posts: 5
Location: India

PostPosted: Sat Feb 19, 2011 5:13 pm
Reply with quote

Hi,

I am trying to write an easytrieve code which in turn calls a COBOL program to read a VSAM file. As I understand, Easytrieve automatically opens the file so that read operation can be performed. When I try to read the VSAM file through the COBOL call, the read fails with a file status of 47 (Trying to read a VSAM file that is not opened in INPUT or I-O mode). So, I even tried to open the file again through the COBOL call wherein the open was successful but the subsequent call to read the VSAM file failed with file status 47.

The reason being am trying to read the file through the COBOL call is that the code to read that particular file already exists and performs few operations on the retrieved record and our requirement is to call the existing COBOL code to achieve this instead of coding the same set of logic again.

Could someone please suggest what am I missing here?

I tried having FILE <VSAM DD name> VS in easytrieve code and without this statement as well but still getting the same file status - 47.

Is there any restriction in reading the file through a COBOL code from Easytrieve?

I can confirm that the COBOL code is perfect as this is running for long time but I couldn't find an existing Easytrieve code that calls this COBOL code.

Please let me know if any additional information is required.

Thanks & Regards,
Aravinth Kumar J.
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Sat Feb 19, 2011 7:32 pm
Reply with quote

Quote:

The reason being am trying to read the file through the COBOL call is that the code to read that particular file already exists and performs few operations on the retrieved record and our requirement is to call the existing COBOL code to achieve this instead of coding the same set of logic again.


Never seen such a load of crap. Why calling a cobol routine for vsam access, if Easytrev has it all?
So who ever thought out that requirement is brain dead.
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Sat Feb 19, 2011 8:06 pm
Reply with quote

PeterHolland wrote:
Quote:

The reason being am trying to read the file through the COBOL call is that the code to read that particular file already exists and performs few operations on the retrieved record and our requirement is to call the existing COBOL code to achieve this instead of coding the same set of logic again.


Never seen such a load of crap. Why calling a cobol routine for vsam access, if Easytrev has it all?
So who ever thought out that requirement is brain dead.

Reusable code. The standard in my shop is that all I/O and data accesses are done in dynamically-linked external subroutines, and programs call those subroutines.

(Did this cause us a wee bit of trouble when we converted from MVS PL/I to Enterprise PL/I? Why yes, yes it did.)
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sun Feb 20, 2011 2:24 am
Reply with quote

Hello and welcome to the forum,

If part of "the rules" is that you must call the existing COBOL program (without changing it) you may have to tell "them" this will not work. . .
Back to top
View user's profile Send private message
Aravinthkumar

New User


Joined: 09 Feb 2009
Posts: 5
Location: India

PostPosted: Sun Feb 20, 2011 3:15 am
Reply with quote

dick scherrer wrote:
Hello and welcome to the forum,

If part of "the rules" is that you must call the existing COBOL program (without changing it) you may have to tell "them" this will not work. . .


Thanks Dick!!!That will be my next move but thought I can check whether I am missing something before going back.

But to confirm there isn't any problem with the COBOL code. This is called by other programs but everything coded in COBOL again. This is the first time we are trying to call it from an Easytrieve code.

Regards,
Aravinth Kumar J.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sun Feb 20, 2011 9:24 am
Reply with quote

Hello,

Easytrieve calls COBOL code as easily as COBOL code calls COBOL code. . . However, Easytrieve is a different running environment than COBOL.

With the existing processes that work correctly, how is the vsam file OPENed? In which program(s)?
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Sun Feb 20, 2011 4:10 pm
Reply with quote

Read the chapter "Subprograms" in the manual :
"CA-Easytrieve/Plus Reference Guide".

Beside that you can not mix Easytrev IO and called programs IO, it is or
only Easytrev or only called programs.
Back to top
View user's profile Send private message
Aravinthkumar

New User


Joined: 09 Feb 2009
Posts: 5
Location: India

PostPosted: Sun Feb 20, 2011 5:24 pm
Reply with quote

dick scherrer wrote:
Hello,

Easytrieve calls COBOL code as easily as COBOL code calls COBOL code. . . However, Easytrieve is a different running environment than COBOL.

With the existing processes that work correctly, how is the vsam file OPENed? In which program(s)?


Hi Dick,

The existing COBOL programs call the subprogram to perform open, read and close operations on the VSAM file. The subprogram just receives a value which tells what operation has to be perfomed on the VSAM file.

I even tried similarly from Easytrieve code to call the subprogram to open the file before performing read operation. The open was successful but the subsequent read operation failed with file status 47.

Does it has something to do with DD statement in JCL/FILE statement in Easytrieve code? jst started thinking wild icon_confused.gif

Regards,
Aravinth Kumar J.
Back to top
View user's profile Send private message
Aravinthkumar

New User


Joined: 09 Feb 2009
Posts: 5
Location: India

PostPosted: Sun Feb 20, 2011 5:26 pm
Reply with quote

PeterHolland wrote:
Read the chapter "Subprograms" in the manual :
"CA-Easytrieve/Plus Reference Guide".

Beside that you can not mix Easytrev IO and called programs IO, it is or
only Easytrev or only called programs.


Hi PeterHolland,

I had a look at the manual but couldn't find anything that could help me resolving this. Still scrolling the manual from top to bottom - doesn't help much. icon_surprised.gif

Regards,
Aravinth Kumar J.
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Sun Feb 20, 2011 7:14 pm
Reply with quote

Well it says enough about Linkage conventions, parameter lists etc.

Your calling sequence could be something like this :

CALL cobolprg USING ('OPEN' 'ddname')
CALL cobolprg USING ('GET' buffer)

Maybe you need to find out which parameters are accepted by your cobol
routine.
Once again use the Easytrev vsam io handling.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sun Feb 20, 2011 10:43 pm
Reply with quote

Hello,

I still have (at least) one confusion icon_confused.gif

If the subroutine does the open/close/read why is the vsam file referenced in the Easytrieve code? All that should be needed is the record layout. . .
Back to top
View user's profile Send private message
Aravinthkumar

New User


Joined: 09 Feb 2009
Posts: 5
Location: India

PostPosted: Mon Feb 21, 2011 5:40 pm
Reply with quote

The environment parameter on JOB statement in Easytrieve code made the difference. As I understand from the manual, it is installation specific which can be set to either NONE or COBOL. This decides in which environment the called programs will be executed.

It was defaulted to NONE in my case and an override of COBOL to ENVIRONMENT resolved the problem.

A lesson learnt!!!

Thanks to Dick - I have now removed FILE statement in Easytrieve code and all the IO operations are taken care by the called COBOL program.

Thanks to PeterHolland - It was you who made me go back and have a fresh look at the manual to identify the culprit!!!

Regards,
Aravinth Kumar J.
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Mon Feb 21, 2011 11:19 pm
Reply with quote

What can i say? Good luck with your requirement.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Feb 22, 2011 1:09 am
Reply with quote

Good to hear it is working - thank you for posting the resolution icon_smile.gif

d
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Error to read log with rexx CLIST & REXX 11
No new posts Error when install DB2 DB2 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
No new posts CLIST - Virtual storage allocation error CLIST & REXX 5
No new posts Merge two VSAM KSDS files into third ... JCL & VSAM 6
Search our Forums:

Back to Top