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
 
to check file/dataset exist or not

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
radhakrishnan82

Active User


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

PostPosted: Sat Mar 05, 2011 6:04 pm    Post subject: to check file/dataset exist or not
Reply with quote

With reference to topic http://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: 436
Location: chennai, India

PostPosted: Sat Mar 05, 2011 6:25 pm    Post subject:
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    Post subject:
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: 436
Location: chennai, India

PostPosted: Sat Mar 05, 2011 6:44 pm    Post subject:
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: 436
Location: chennai, India

PostPosted: Sat Mar 05, 2011 6:45 pm    Post subject:
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    Post subject:
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: 436
Location: chennai, India

PostPosted: Sat Mar 05, 2011 7:00 pm    Post subject:
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: 8165
Location: East Dubuque, Illinois, USA

PostPosted: Sat Mar 05, 2011 7:19 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Copy 4 byte of data from the last rec... arunsoods DFSORT/ICETOOL 9 Fri Oct 06, 2017 12:15 pm
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

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