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 

Not exist file

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


Joined: 19 Feb 2009
Posts: 50
Topics: 10

PostPosted: Wed Mar 09, 2011 1:29 am    Post subject: Not exist file Reply with quote

If a dataset(flat file) is not present or not created, using a cobol program, through file status code handling, we can write a message "Input file not created" to the output file. If it is present, we can execute necessary process.

Rqmt is to write the output dataset with "file not present" if input file not present.
Is it possible to do the similar logic in DFSORT/JCL just to avoid the program element. I understand we can do a check for file exist or not in IDCAMS. My shop production team trying to ignore/eleminate JCL's with IF ELSE ENDIF logics.
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: Wed Mar 09, 2011 12:03 pm    Post subject: Reply with quote

radkrish82,

Use the following IDCAMS job which will give you the desired results. The OUT dataset will have the message depending on the return code.

Code:

//STEP0100 EXEC PGM=IDCAMS                         
//SYSPRINT DD SYSOUT=*                             
//IN       DD *                                     
FILE HAS AT LEAST 1 RECORD                         
EMPTY FILE                                         
ERROR CONDITION RC = 8                             
FILE NOT PRESENT                                   
//OUT      DD SYSOUT=*                             
//SYSIN    DD *                                     
  PRINT IDS('your file in question') CHARACTER COUNT(1) 
  IF LASTCC = 0 THEN DO                             
     REPRO IFILE(IN) OFILE(OUT) COUNT(1)           
     END                                           
  ELSE IF LASTCC = 4 THEN DO                       
       REPRO IFILE(IN) OFILE(OUT) COUNT(1) SKIP(1) 
     END                                           
  ELSE IF LASTCC = 8 THEN DO                       
     REPRO IFILE(IN) OFILE(OUT) COUNT(1) SKIP(2)   
     END                                           
  ELSE IF LASTCC = 12 THEN DO                       
     REPRO IFILE(IN) OFILE(OUT) COUNT(1) SKIP(3)   
     END                                           
//*

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


Joined: 19 Feb 2009
Posts: 50
Topics: 10

PostPosted: Thu Mar 10, 2011 7:15 am    Post subject: Reply with quote

Thanks, Kolusu. It worked well.
In case of symbolic representation of the file name, how do we represent with in the same step. It requires manipulation in a seperate step. correct? Is it possible to substitute the symbolics with in the same step?

Code:
eg.,  set symb=test
File name : AAA.BBB.CCC.&symb
Back to top
View user's profile Send private message
superk
Advanced


Joined: 19 Dec 2002
Posts: 684
Topics: 5

PostPosted: Thu Mar 10, 2011 9:36 am    Post subject: Reply with quote

Take a few minutes to think about what you're asking and assess the situation. If you use a JCL symbolic for a portion of the dataset name, then you have to use that somewhere in the JCL. But where? If you code a DD statement for it, the JCL will fail because of the "dataset not found" problem. So, the only place you can use it without causing a failure is in a PARM=... statement. The issue here is that you'll have to supply the program to be used in that step, and define the process for it to follow to meet your requirements.
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 -> Utilities 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