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

to check file/dataset exist or not


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
radhakrishnan82

Active User


Joined: 31 Mar 2005
Posts: 435
Location: chennai, India

PostPosted: Sat Mar 05, 2011 6:04 pm
Reply with quote

With reference to topic ibmmainframes.com/viewtopic.php?t=11350
I am getting the following meesage. Instead of returning RC, my shop cancels it. how do i handle this?

Code:
[size=9]IAT6140 JOB ORIGIN FROM GROUP=ANYLOCAL, DSP=IR , DEVICE=INTRDR  , 0000         
07:31:45 ---- IAT6853 THE CURRENT DATE IS SATURDAY,  05 MAR 2011 ----         
07:31:45 ************************************                                 
07:31:45 LIAT040 - Allocating SWA > 16M line.                                 
07:31:45 ************************************                                 
07:31:45 IAT4401  LOCATE FOR STEP=STEP10  DD=FILEIN   DSN=AAA.BBB.CCC.DDD1
07:31:45 IAT4404 DATASET NOT FOUND ON MAIN PROCESSOR WSTC                     
07:31:45 IAT4801 JOB XXXXXXXZ (XXXX11111) EXPRESS CANCELED BY INTERPRETER DSP   [/size]
Back to top
View user's profile Send private message
radhakrishnan82

Active User


Joined: 31 Mar 2005
Posts: 435
Location: chennai, India

PostPosted: Sat Mar 05, 2011 6:25 pm
Reply with quote

I am using the below code now.

Code:
//STEP010  EXEC PGM=IDCAMS                                             
//SYSUDUMP DD SYSOUT=*                                                 
//SYSOUT   DD SYSOUT=*                                                 
//SYSPRINT DD SYSOUT=*                                                 
//SYSIN    DD *                                                         
  PRINT IDS('AAA.BBB') COUNT(1)         
  IF LASTCC=12 THEN SET MAXCC=4                                         
/*                                                                     
//*                                                       
// IF (STEP010.RC=0) THEN
//STEP020 EXEC PGM=PGM1
// ELSE
//STEP030 EXEC PGM=PGM2
// ENDIF
             


Even the file is empty, STEP020 is executing. It shouldnt execute as per the IF condition. STEP020 is executing and abends with file not located.
can anyone pls help why is it executing astep020 even if file in step010 doesnt exist.
Back to top
View user's profile Send private message
kratos86

Active User


Joined: 17 Mar 2008
Posts: 148
Location: Anna NGR

PostPosted: Sat Mar 05, 2011 6:39 pm
Reply with quote

Are the first step returning non-zero return code?

Please post the log of your job for anyone to look and help you.
Back to top
View user's profile Send private message
radhakrishnan82

Active User


Joined: 31 Mar 2005
Posts: 435
Location: chennai, India

PostPosted: Sat Mar 05, 2011 6:44 pm
Reply with quote

Quote:
Even the file is empty, STEP020 is executing. It shouldnt execute as per the IF condition. STEP020 is executing and abends with file not located.
can anyone pls help why is it executing astep020 even if file in step010 doesnt exist.


In step20, I want to use the file that I checked whether it is present or not.
Hence it has given me the error (file not foud) before going into the execution.

My reqmt is to check file 1whether a file is present or not.
If present, process file1 as input and create 2 output files
If not present, write "file not present' in file1.
Back to top
View user's profile Send private message
radhakrishnan82

Active User


Joined: 31 Mar 2005
Posts: 435
Location: chennai, India

PostPosted: Sat Mar 05, 2011 6:45 pm
Reply with quote

Quote:
Are the first step returning non-zero return code?

I am using the non existing file in the second step. Hence it puts me in syntax error in the job that the file is not available. Job not executed.
How should I handle such case.
Back to top
View user's profile Send private message
kratos86

Active User


Joined: 17 Mar 2008
Posts: 148
Location: Anna NGR

PostPosted: Sat Mar 05, 2011 6:56 pm
Reply with quote

Still you did not answer my question... What is the return code from the first step??
Back to top
View user's profile Send private message
radhakrishnan82

Active User


Joined: 31 Mar 2005
Posts: 435
Location: chennai, India

PostPosted: Sat Mar 05, 2011 7:00 pm
Reply with quote

The job didnt executed. If I run with other existing files, condition code is returning 4 for empty files. I verified. Problem with my code is that iam using the non-exsting file in the second step which results in "file not found error " job not executed.

Code:
//STEP010  EXEC PGM=IDCAMS                                             
//SYSUDUMP DD SYSOUT=*                                                 
//SYSOUT   DD SYSOUT=*                                                 
//SYSPRINT DD SYSOUT=*                                                 
//SYSIN    DD *                                                         
  PRINT IDS('AAA.BBB') COUNT(1)         
  IF LASTCC=12 THEN SET MAXCC=4                                         
/*                                                                     
//*                                                       
// IF (STEP010.RC=0) THEN
//STEP020 EXEC PGM=SORT
//SORTIN  DD DSN=AAA.BBB  --> it says file not available, job not executed
// ELSE
//STEP030 EXEC PGM=PGM2
// ENDIF
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: Sat Mar 05, 2011 7:19 pm
Reply with quote

If you are running JES3 at your site, the entire job has data set verification done before the job starts running. JES2 does data set verification before each step -- one of the differences in the two. This means that under JES3, unlike JES2, the JCL you have will never work. You can split it into 2 steps, or find another approach, but the approach you are using will not work.
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 7
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
Search our Forums:

Back to Top