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

Check File Status while opening a file


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
jar_tar

New User


Joined: 08 Oct 2008
Posts: 2
Location: Turkey

PostPosted: Thu Mar 29, 2012 4:51 pm
Reply with quote

How can I check all files' status which are assign to a single job dd card ?

If I have a two or more file in my JCL dd card and the second file have some errors, I cant handle error by checking file status code, in this case
file status code is always return as 0. When i chage order of files, erroneous file become first and i can handle error of file.

Please see that below.

JCL Code:
Code:

....
//FMWORK   DD   DSN=TYTR.F010PSN.TYTRGY10,DISP=OLD
//                DD   DSN=TREP.F010PSN.REPMUH74,DISP=OLD
....


Cobol Code:
Code:

....
OPEN INPUT WORK.     
IF FMWORK-STAT NOT =
   DISPLAY 'ERROR'
END-IF.             
....
Back to top
View user's profile Send private message
Peter cobolskolan

Active User


Joined: 06 Feb 2012
Posts: 104
Location: Sweden

PostPosted: Thu Mar 29, 2012 5:10 pm
Reply with quote

To be able to check file status you have to suppply File Status WS-varname ( a Pic XX variable) in your Select for the file.
You dont have to worry about if you have 1 or more files concatenated in yor JCL.
Pls supply your COBOL-code for your Select and the code where you check, otherwise its difficult to help you in this matter.
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: Thu Mar 29, 2012 5:31 pm
Reply with quote

Quote:
How can I check all files' status which are assign to a single job dd card ?
You completely and totally misunderstand file status in COBOL. A file status is set based on a "file" -- which can be one data set assigned to a DD statement, or two data sets concatenated to a DD statement, or 37 data sets concatenated to a DD statement, or .... When the open is done, and the first data set for the DD statement opens without issue, then you'll typically get a 00 file status for the open. You need to check the file status not just for the open, but for every read as well -- especially if there's a chance you've got problems with concatenated data sets.
Back to top
View user's profile Send private message
jar_tar

New User


Joined: 08 Oct 2008
Posts: 2
Location: Turkey

PostPosted: Fri Mar 30, 2012 1:28 pm
Reply with quote

Robert Sample wrote:
Quote:
How can I check all files' status which are assign to a single job dd card ?
You completely and totally misunderstand file status in COBOL. A file status is set based on a "file" -- which can be one data set assigned to a DD statement, or two data sets concatenated to a DD statement, or 37 data sets concatenated to a DD statement, or .... When the open is done, and the first data set for the DD statement opens without issue, then you'll typically get a 00 file status for the open. You need to check the file status not just for the open, but for every read as well -- especially if there's a chance you've got problems with concatenated data sets.


Thank you, this was very helpful. As you said i didnt got wat does file status really means.
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 -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
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 Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top