View previous topic :: View next topic |
Author |
Message |
hvijayakumar Beginner
Joined: 05 Aug 2006 Posts: 7 Topics: 3
|
Posted: Fri Mar 02, 2007 5:07 am Post subject: File status checking in Easytrieve |
|
|
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 |
|
 |
Nic Clouston Advanced
Joined: 01 Feb 2007 Posts: 1075 Topics: 7 Location: At Home
|
Posted: Fri Mar 02, 2007 5:13 am Post subject: |
|
|
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 |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Fri Mar 02, 2007 6:28 am Post subject: |
|
|
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 |
|
 |
hvijayakumar Beginner
Joined: 05 Aug 2006 Posts: 7 Topics: 3
|
Posted: Fri Mar 02, 2007 7:58 am Post subject: |
|
|
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 |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Fri Mar 02, 2007 8:09 am Post subject: |
|
|
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 |
|
 |
Nic Clouston Advanced
Joined: 01 Feb 2007 Posts: 1075 Topics: 7 Location: At Home
|
Posted: Fri Mar 02, 2007 8:09 am Post subject: |
|
|
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 |
|
 |
hvijayakumar Beginner
Joined: 05 Aug 2006 Posts: 7 Topics: 3
|
Posted: Fri Mar 02, 2007 9:18 am Post subject: |
|
|
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 |
|
 |
dbzTHEdinosauer Supermod
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
|
Posted: Fri Mar 02, 2007 9:41 am Post subject: |
|
|
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 |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Fri Mar 02, 2007 10:23 am Post subject: |
|
|
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 |
|
 |
dbzTHEdinosauer Supermod
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
|
Posted: Fri Mar 02, 2007 10:33 am Post subject: |
|
|
got it, thx kolusu _________________ Dick Brenholtz
American living in Varel, Germany |
|
Back to top |
|
 |
Nic Clouston Advanced
Joined: 01 Feb 2007 Posts: 1075 Topics: 7 Location: At Home
|
Posted: Fri Mar 02, 2007 10:36 am Post subject: |
|
|
ditto _________________ Utility and Program control cards are NOT, repeat NOT, JCL. |
|
Back to top |
|
 |
hvijayakumar Beginner
Joined: 05 Aug 2006 Posts: 7 Topics: 3
|
Posted: Sat Mar 03, 2007 4:37 am Post subject: |
|
|
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 |
|
 |
dbzTHEdinosauer Supermod
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
|
Posted: Sat Mar 03, 2007 7:44 am Post subject: |
|
|
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 |
|
 |
|
|