Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Check File Status while opening a file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Check File Status while opening a file
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    Post subject: Reply to: Check File Status while opening a file
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: 7931
Location: Bellevue, IA

PostPosted: Thu Mar 29, 2012 5:31 pm    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
This topic is locked: you cannot edit posts or make replies. session stuck in TPX with status ACL amitc23 CA Products 1 Tue Dec 13, 2016 12:53 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
This topic is locked: you cannot edit posts or make replies. Natural ADABAS Opening with CTS enikhilk Mainframe Jobs 0 Wed Nov 30, 2016 5:37 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us