MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

File status checking in Easytrieve

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
hvijayakumar
Beginner


Joined: 05 Aug 2006
Posts: 7
Topics: 3

PostPosted: Fri Mar 02, 2007 5:07 am    Post subject: File status checking in Easytrieve Reply with quote

Hi,

I need to check for FILE-STATUS of a sequential file in Easytrieve. I also searched for the same in the forum. I got only posts regarding checking the FILE-STATUS for VSAM file not for any SEQUENTIAL file.

Please can anybody help me in solving this...

Thanks in advance for your replies..

Hari
Back to top
View user's profile Send private message
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Fri Mar 02, 2007 5:13 am    Post subject: Reply with quote

At the top of this page is a link to manuals - there is an easytrieve manual there and it has lots of references to file status in it. Did you look there? If you did not you should have because that is what you are meant to do before posting.
_________________
Utility and Program control cards are NOT, repeat NOT, JCL.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Fri Mar 02, 2007 6:28 am    Post subject: Reply with quote

hvijayakumar,

Please explain as to what you are doing , so that we can suggest an alternative solution.

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
hvijayakumar
Beginner


Joined: 05 Aug 2006
Posts: 7
Topics: 3

PostPosted: Fri Mar 02, 2007 7:58 am    Post subject: Reply with quote

Hi ,

I am sorry , If I am not clear in my previous post.

I need to do the following.

I want to GET a sequential file. On successfull get, I need return code as zero and on unsuccessful get, I need return code as 12.

The code which I have used (but it is not working)
FILE FILEIN

JOB INPUT NULL

GET FILEIN STATUS
IF FILEIN:FILE-STATUS EQ 0
RETURN-CODE = 00
ELSE
DISPLAY FILEIN:FILE-STATUS
RETURN-CODE = 12
END-IF

STOP


Thanks
Hari
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Fri Mar 02, 2007 8:09 am    Post subject: Reply with quote

hvijayakumar,


Try this

Code:

  FILE FILEIN               
                           
  JOB INPUT NULL           
                           
    GET FILEIN             
                           
    IF EOF FILEIN           
       RETURN-CODE = 12     
    ELSE                   
       RETURN-CODE = 00     
    END-IF                 
    STOP                   
                           


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Fri Mar 02, 2007 8:09 am    Post subject: Reply with quote

Reading the manual GET does not set file-status - you use READ and after thar=t - according to the manual, you can do something like IF FILE-STATUS EQ ....
It is all there if you dig around. DIG.
_________________
Utility and Program control cards are NOT, repeat NOT, JCL.
Back to top
View user's profile Send private message
hvijayakumar
Beginner


Joined: 05 Aug 2006
Posts: 7
Topics: 3

PostPosted: Fri Mar 02, 2007 9:18 am    Post subject: Reply with quote

Hi Kolusu,

The code which u have given works fine. But I need to do that after checking the FILE-STATUS of the mentioned file ( by not checking the EOF condition).


Thanks
Hari
Back to top
View user's profile Send private message
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Fri Mar 02, 2007 9:41 am    Post subject: Reply with quote

your syntax for checking the file status is incorrect.

Quote:
IF FILEIN:FILE-STATUS EQ 0


should be

Code:
IF FILE-STATUS EQ 0


Quote:
System-Defined Fields
Three special data fields are provided for each file:
RECORD-LENGTH
Contains one of the following:
■ For fixed-length records, the value specified for record length on the FILE statement.
■ For variable or undefined-length records, the length of the data in the current record (does not include the space for the record-descriptor-word, it is automatically maintained by the system).
RECORD-COUNT
Contains the number of logical I/O operations performed for the file.
FILE-STATUS
Contains a code that indicates the result of the most recent I/O operation.

_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Fri Mar 02, 2007 10:23 am    Post subject: Reply with quote

Quote:

The code which u have given works fine. But I need to do that after checking the FILE-STATUS of the mentioned file ( by not checking the EOF condition).


hvijayakumar,

I just don't get it. If your intention is to check if there any records then my code will work fine. There is no exclusive OPEN/CLOSE statements in easytrieve.

I am reading the file only ONCE with a GET statement and if the file does have atleast one record you haven't reached the EOF , so you will set the return code to 0. Now if the first read itself encountered EOF then the return code will be 12.

As I told you need to define the requirement clearly. It is just a simple programming exercise and you are complicating it for no reason.

Nic/Dbz,

File-status in easytrieve is valid only for VSAM/ISAM files only. For normal sequential files there is no file-status checking.

And the syntax shown is correct because When using multiple files, you should qualify FILE-STATUS with the filename

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu


Last edited by kolusu on Fri Mar 02, 2007 11:25 am; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Fri Mar 02, 2007 10:33 am    Post subject: Reply with quote

got it, thx kolusu
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Fri Mar 02, 2007 10:36 am    Post subject: Reply with quote

ditto
_________________
Utility and Program control cards are NOT, repeat NOT, JCL.
Back to top
View user's profile Send private message
hvijayakumar
Beginner


Joined: 05 Aug 2006
Posts: 7
Topics: 3

PostPosted: Sat Mar 03, 2007 4:37 am    Post subject: Reply with quote

Ok Thanks...

I am beginner in Easytrieve.....I was trying to find out whether file-status can be checked for sequential file or not ....Now I got the solution from your replies.

Sorry If i am troubling with simple questions....


Thanks
Hari
Back to top
View user's profile Send private message
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Sat Mar 03, 2007 7:44 am    Post subject: Reply with quote

Hari,

1. thx for 'your' feedback

2. as you can tell, you are not the only Easytrieve beginner
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
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


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group