Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 8165
Location: East Dubuque, Illinois, USA

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 opening a dataset after reading it fr... arunsoods DFSORT/ICETOOL 5 Wed Oct 04, 2017 3:54 pm
No new posts Execute JCL step based on the content... sprikitik JCL & VSAM 2 Tue Oct 03, 2017 10:03 am
This topic is locked: you cannot edit posts or make replies. PS file data should be passed as symb... d_sarlie JCL & VSAM 15 Tue Oct 03, 2017 5:18 am
No new posts Garbage on output file Hervey Martinez SYNCSORT 4 Wed Sep 27, 2017 12:50 am
No new posts File Aid tool to compare numeric data balaji81_k Compuware & Other Tools 2 Tue Sep 26, 2017 3:35 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us