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

using return codes in the next step


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

Active User


Joined: 24 Jun 2006
Posts: 101

PostPosted: Fri Sep 08, 2006 12:59 am
Reply with quote

I want to write a program such that in the first step it will check whether the particular dsn is available or not. if it is not available the output RC value is 12. then i have to create a dsn. but when running, the job failed at step 1 itself due to the RC 12. i want to execute the step when the RC for the above step is 12. i have used cond parameter in the exec statement but it is not working. Can anyone provide a snippet for this.

Thanks,
Bala
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Fri Sep 08, 2006 1:19 am
Reply with quote

The first step could be done:
Code:

//STEP1    EXEC PGM=IDCAMS                       
//SYSPRINT DD   SYSOUT=*                         
//SYSIN    DD   *                                 
  LISTCAT ENT(MYHLQ.MY.DATASET)               
/*                                               
//*                                               


Personally, I detest using COND statements, and I would make the second step:
Code:

// IF (STEP1.RC = 4) THEN                                 
//STEP2    EXEC PGM=IEFBR14                               
//DD1      DD   DSN=MYHLQ.MY.DATASET,                   
//         DISP=(,CATLG,DELETE),UNIT=SYSDA,               
//         SPACE=(CYL,(1,1),RLSE),RECFM=FB,LRECL=80       
// ENDIF                                                   


Or, if desired:
Code:

//STEP2    EXEC PGM=IEFBR14,COND=(4,NE,STEP1)           
//DD1      DD   DSN=MYHLQ.MY.DATASET,                 
//         DISP=(,CATLG,DELETE),UNIT=SYSDA,             
//         SPACE=(CYL,(1,1),RLSE),RECFM=FB,LRECL=80     
//*                                                     
Back to top
View user's profile Send private message
kbmkris

Active User


Joined: 24 Jun 2006
Posts: 101

PostPosted: Fri Sep 08, 2006 1:41 am
Reply with quote

hi superk,

it is not working, i have shown my sysprint message here.


********************************* TOP OF DATA *******************************
IDCAMS SYSTEM SERVICES TIME: 16:06

VERIFY DATASET(K4CCBK1.IIRS.VSAM.SORT )
IKJ56228I DATA SET K4CCBK1.IIRS.VSAM.SORT NOT IN CATALOG OR CATALOG CAN
IKJ56228I NOT BE ACCESSED
IDC3003I FUNCTION TERMINATED. CONDITION CODE IS 12

IDC0002I IDCAMS PROCESSING COMPLETE. MAXIMUM CONDITION CODE WAS 12
******************************** BOTTOM OF DATA *****************************
Back to top
View user's profile Send private message
krishna_sureka

New User


Joined: 05 Sep 2006
Posts: 7
Location: Pune

PostPosted: Fri Sep 08, 2006 2:10 am
Reply with quote

Have you tried with COND=ONLY ?
Back to top
View user's profile Send private message
kbmkris

Active User


Joined: 24 Jun 2006
Posts: 101

PostPosted: Fri Sep 08, 2006 2:13 am
Reply with quote

krishna_sureka wrote:
Have you tried with COND=ONLY ?


can you give a snippet. i am not aware of what you are saying.

Thanks,
Bala
Back to top
View user's profile Send private message
kbmkris

Active User


Joined: 24 Jun 2006
Posts: 101

PostPosted: Fri Sep 08, 2006 5:29 am
Reply with quote

hi,

can anyone suggest me to resolve this problem.

Thanks,
Bala
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Fri Sep 08, 2006 5:41 pm
Reply with quote

What exactly is the problem? Just stating that "it is not working" doesn't help much.

Why don't you post all of your JCL? (make sure you use the BBCode tags).
Back to top
View user's profile Send private message
kbmkris

Active User


Joined: 24 Jun 2006
Posts: 101

PostPosted: Fri Sep 08, 2006 5:55 pm
Reply with quote

superk wrote:
What exactly is the problem? Just stating that "it is not working" doesn't help much.

Why don't you post all of your JCL? (make sure you use the BBCode tags).


here is the code i am using:-
Code:

//STEP2   EXEC PGM=IDCAMS                                           
//SYSIN   DD *                                                       
  VERIFY DATASET(K4CCBK1.IIRS.VSAM.SORT )                             
/*                                                                   
//SYSPRINT DD SYSOUT=*                                               
//*******************************************************************
//STEP3   EXEC PGM=IDCAMS,COND=ONLY                                 
//SYSIN   DD *                                                       
  DEFINE CLUSTER                        -                             
  (NAME(K4CCBK1.IIRS.VSAM.SORT)       -                             
  TRACK(10,10) VOLUME(STRBB2)           -                             
  KEYS(6,0) RECORDSIZE(80,80)           -                             
  INDEXED)                              -                             
  DATA (NAME(K4CCBK1.IIRS.VSAM.SORT.DATA)) -                       
  INDEX (NAME(K4CCBK1.IIRS.VSAM.SORT.INDEX))                       
/*                                                                   
//SYSPRINT DD SYSOUT=*


i want the step3 to be executed only if the step2 fails i.e. only if the specified VSAM file is not available. i think this is the information you have asked.

Thanks,
Bala
Back to top
View user's profile Send private message
kgumraj

Active User


Joined: 01 May 2006
Posts: 151
Location: Hyderabad

PostPosted: Fri Sep 08, 2006 5:58 pm
Reply with quote

Hi,
use the cond parameter in step2 as COND=ANY
it will execute

Kiran G R
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Fri Sep 08, 2006 6:41 pm
Reply with quote

Well, it works for me just fine the way I originally described:
Code:

//STEP2   EXEC PGM=IDCAMS                                           
//SYSIN   DD *                                                       
  VERIFY DATASET(K4CCBK1.IIRS.VSAM.SORT)                             
/*                                                                   
//SYSPRINT DD SYSOUT=*                                               
//*******************************************************************
//STEP3   EXEC PGM=IDCAMS,COND=(12,NE,STEP2)                                 
//SYSIN   DD *                                                       
  DEFINE CLUSTER                        -                             
  (NAME(K4CCBK1.IIRS.VSAM.SORT)       -                             
  TRACK(10,10) VOLUME(STRBB2)           -                             
  KEYS(6,0) RECORDSIZE(80,80)           -                             
  INDEXED)                              -                             
  DATA (NAME(K4CCBK1.IIRS.VSAM.SORT.DATA)) -                       
  INDEX (NAME(K4CCBK1.IIRS.VSAM.SORT.INDEX))                       
/*                                                                   
//SYSPRINT DD SYSOUT=*


However, I'm curious as to why you want two job steps when one will suffice:
Code:

//STEP2   EXEC PGM=IDCAMS                                           
//SYSIN   DD *                                                       
  VERIFY DATASET(K4CCBK1.IIRS.VSAM.SORT)             
  IF LASTCC>0 THEN DO   
    DEFINE CLUSTER                        -                             
    (NAME(K4CCBK1.IIRS.VSAM.SORT)       -                             
    TRACK(10,10) VOLUME(STRBB2)           -                             
    KEYS(6,0) RECORDSIZE(80,80)           -                             
    INDEXED)                              -                             
    DATA (NAME(K4CCBK1.IIRS.VSAM.SORT.DATA)) -                       
    INDEX (NAME(K4CCBK1.IIRS.VSAM.SORT.INDEX))
    REPRO (should be one here somewhere)
    SET MAXCC=0
  END               
/*                                                                   
//SYSPRINT DD SYSOUT=*                                               
Back to top
View user's profile Send private message
kbmkris

Active User


Joined: 24 Jun 2006
Posts: 101

PostPosted: Fri Sep 08, 2006 7:05 pm
Reply with quote

THANK YOU SUPERK

BALA
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 Return codes-Normal & Abnormal te... JCL & VSAM 7
No new posts How to append a PS file into multiple... JCL & VSAM 3
No new posts convert file from VB to FB and use tr... DFSORT/ICETOOL 8
No new posts VSAM return code 23 - for a Random read COBOL Programming 4
No new posts Forcing a step to run (even if abended) JCL & VSAM 8
Search our Forums:

Back to Top