Home      Mainframe Forum      Mainfarme Tutorials      IBM Manuals      Mainframe Interview Questions      Mainframe Books      IT News     SiteMap     Downloads


     
 
MAINFRAME - TIP OF THE DAY : All available storage is assigned to the job or jobstep, If REGION is coded 0K or 0M

Google
 
Web mainframegurukul.com

Create a loop in a JCL

 
Post new topic   Reply to topic    mainframegurukul.com Forum Index -> JCL
  View previous topic :: View next topic  
Author Message
Bart De Weirdt
Member


Joined: 27 Nov 2008
Posts: 4

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Thu Nov 27, 2008 3:23 pm    Post subject: Create a loop in a JCL Reply with quote

Is it possible to loop a certain amount of steps in a JCL?

For example

step010
step020
step030
if step030.rc > 0
then
re-execute step020+step030 until step030.rc = 0
else
step040
endif.
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.

Natarajan
Moderator


Joined: 10 Oct 2008
Posts: 537
Location: chennai

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
1 salutes

PostPosted: Thu Nov 27, 2008 3:35 pm    Post subject: INTRDR in JCL Reply with quote

Bart,

I didnot heard about looping in JCL.
You may need to use JCL INTRDR for this purpose. This will submit another job, or the same job again.
_________________
Natarajan
Chennai
Back to top
View user's profile Send private message Visit poster's website
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Anuj Dhawan
Moderator


Joined: 09 Aug 2008
Posts: 1631
Location: Mumbai, India

Answer was approved by Question owner.
Useful Post
1 votes
Not an useful post
Greate Post!! Salute Author
1 salutes

PostPosted: Thu Nov 27, 2008 3:45 pm    Post subject: Reply with quote

Hello Bart De Weirdt and welcome to the Forums,

You need to re-think how to implement your requirement (the requirement is not to loop in some step - that is your attempt to meet the requirement). If you post the actual requirement, someone may have a suggestion.

I suspect that you want to loop until some condition is met. This could be hours or worse case - never.

If several people implemented their process doing as you want to do, the mainframe would come to a complete halt because all of the initiators/partitions were "looping".
_________________
Regards,
Anuj
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Bart De Weirdt
Member


Joined: 27 Nov 2008
Posts: 4

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Thu Nov 27, 2008 3:58 pm    Post subject: Reply with quote

some details ....

step010
executes a program that extracts parts from a database

step020
calculates in batch the sales prices for all those parts on current date

step030
compares the sales prices with the purchase prices and updates them
it also produces an outputfile (O1) with parts that have different prices in the future

As long as O1 isn't empty, step020 and step030 should be re-executed!

I'm trying to put this logic in the JCL, because the impact is too big if I change the Cobol programs!
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Natarajan
Moderator


Joined: 10 Oct 2008
Posts: 537
Location: chennai

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Thu Nov 27, 2008 4:10 pm    Post subject: internal reader INTRDR in JCL Reply with quote

after step030 include following.
1. include a step to find whether O1 is empty or not.
2. use IF condition after that.
execute INTRDR step to submit this same JCL again dynamically, if O1 is not empty.


If you have any questions on below... let me know.. i will help you.
1. How to find whether file contains the data or not.
2. submit the same job using INTRDR dynamically.
_________________
Natarajan
Chennai
Back to top
View user's profile Send private message Visit poster's website
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Bart De Weirdt
Member


Joined: 27 Nov 2008
Posts: 4

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
1 salutes

PostPosted: Thu Nov 27, 2008 4:59 pm    Post subject: Reply with quote

thx natarajan

checking if the file is empty is no problem, but I've never used the INTRDR ... some help is welcome!

Bart
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Natarajan
Moderator


Joined: 10 Oct 2008
Posts: 537
Location: chennai

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Thu Nov 27, 2008 6:11 pm    Post subject: internal reader INTRDR in JCL Reply with quote

Try this code

Code:

//**********************************************************************
//**************THIS IS A ROUTINE WHICH CALLS ANOTHER JCL ***           
//**********************************************************************
//* STEP02 : RE-SUBMIT THE JCL //***************************************
//STEP02  EXEC PGM=IEBGENER                                             
//SYSTSPRT  DD SYSOUT=*                                                 
//SYSPRINT  DD SYSOUT=*                                                 
//SYSUT1   DD DSN=DXX.XXXX.XXXX.JCLLIB(AUTO),DISP=SHR             
//SYSUT2   DD SYSOUT=(A,INTRDR)                                         
//SYSIN      DD DUMMY                                                   
//***********************************************************     


DXX.XXXX.XXXX.JCLLIB(AUTO) is the JCL location to be submitted.
This can be other JCL or the Same JCL.

Caution : Make sure this loop should be ended. otherwise, this job may go into infinate loop. Since you are going to have IF condition, i assume at some point of time, file is empty and the loop will end there.
_________________
Natarajan
Chennai
Back to top
View user's profile Send private message Visit poster's website
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Bart De Weirdt
Member


Joined: 27 Nov 2008
Posts: 4

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Fri Nov 28, 2008 3:51 pm    Post subject: Reply with quote

Natarajan,

It works perfectly, but I have one last question.

In the program that produces file O1, I set the returncode to 04.
After the execution of the program I test the returncode

if returncode = 04
then
re-execute job (using intrdr)
else
continue with last steps
end-if

but somehow the system takes over and doesn't get to the if-statement!!!

-JOBNAME STEPNAME PROCSTEP RC EXCP CPU SRB CLOCK
-HAPBWP8A HMPPRP8A STEP030 00 334 .00 .00 .01
-HAPBWP8A HMPPRP8A STEP040 04 271 .00 .00 .00
IEF451I HAPBWP8A STEP040 HMPPRP8A - ENDED BY CC 0004 - TIME=1
-HAPBWP8A ENDED. NAME- TOTAL CPU TIME=
-NOT_EXECUTED_STEP_TABLE BEGIN
-JOBNAME STEPNAME PROCSTEP STEPNO
-HAPBWP8A HMPPRP8A STEP02 3
-HAPBWP8A HMPPRP8A STEP050 4
-HAPBWP8A HMPPRP8A STEP060 5
-HAPBWP8A HMPPRP8A STEP998 6

any idea how I could bypass this?
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Anuj Dhawan
Moderator


Joined: 09 Aug 2008
Posts: 1631
Location: Mumbai, India

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Fri Nov 28, 2008 8:57 pm    Post subject: Reply with quote

Hi Brat,

Please post the JCL used & on what condition do you set the RC=4 in the program, I'd guess - when the file is empty ?
_________________
Regards,
Anuj


Last edited by Anuj Dhawan on Sat Nov 29, 2008 3:26 am; edited 2 times in total
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Natarajan
Moderator


Joined: 10 Oct 2008
Posts: 537
Location: chennai

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Fri Nov 28, 2008 9:34 pm    Post subject: Reply with quote

Hi Brat,

As Anuj suggested, if you post your JCL, we dont required to spend much time
to help you.

Any how, let me guess, what you coded.

You might have used wrong syntax of IF RC, Please refer below tutorial for this.
http://www.geocities.com/srcsinc/drona/programming/languages/jcl/jcl.chapter10.html
_________________
Natarajan
Chennai
Back to top
View user's profile Send private message Visit poster's website
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
academyindia4
Guest





Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Mon Feb 01, 2016 11:06 pm    Post subject: Topic deleted by Admin Reply with quote

<< Content deleted By Admin >>
Back to top
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Display posts from previous:   
Post new topic   Reply to topic    mainframegurukul.com Forum Index -> JCL 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

Related topics
 Topics   Replies   Author   Views   Last Post 
No new posts SORT OUTFIL HEADER Example 5 murali gummadi 12722 Mon Feb 01, 2016 11:01 pm
academyindia4 View latest post
No new posts Presence of mind......too good example !!! 5 Anuj Dhawan 6654 Wed Sep 25, 2013 10:44 am
Mr.Madura View latest post
This topic is locked: you cannot edit posts or make replies. In cics what is new copy.please give me a example. 4 mainframe5 15010 Fri May 04, 2012 10:58 pm
DikDude View latest post
No new posts what is SPAM RECORDS IN VSAM please give me a example. 2 mainframe5 5459 Tue Nov 25, 2008 8:46 am
Anuj Dhawan View latest post
No new posts for debugging , i need to display variables in hexadecimal 6 danig 8498 Thu Apr 17, 2008 1:34 pm
danig View latest post
 


Cobol Tutorial
This cobol tutorial covers most of the important topics like STRING, UNSTRING, COMP, COMP-3.....
DB2 Tutorial
DB2 Tutorial focuses on DB2 COBOL Programming. Explains in simple language. Some Chapters are locked, Forum members have free access to these chapters
CICS Tutorial
This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming...
JCL Tutorial
This is most popular JCL tutorial from mainframegurukul. It does contain important jcl ....
SORT Tutorial
This Tutorial covers all important aspects of DFSORT. Has more SORT examples
INTERVIEW Questions
This page covers important interview questions
Mainframe Jobs
Mainframe Jobs posted by members of mainframegurukul forum
FaceBook Page
MainframeGurukul FaceBook Page
LinkedIn Page
MainframeGurkul Linkedin Page

This widget requires Flash Player 9 or better







Go to top of the page
 

Online ABEND Reference ||  JCL References ||  COBOL References ||  VSAM References ||  Tutorials by Drona Series ||  SQL tutorial ||  BOOKS  ||  DB2 INTERVIEW QUESTIONS ||  COBOL INTERVIEW QUESTIONS  ||  JCL INTERVIEW QUESTIONS ||  JCL2 INTERVIEW QUESTIONS ||  VSAM INTERVIEW QUESTIONS ||  CICS INTERVIEW QUESTIONS  ||  Online tutorials ||  Online ABEND Reference ||  JCL References ||  COBOL References ||  VSAM References ||  Tutorials by Drona Series ||  SQL tutorial ||  BOOKS  ||  SiteMap  ||  Expeditor Tutorial  ||  FILE-AID Tutorial  ||  Changeman Tutorial  ||  COBOL   ||  DB2   ||  JCL  ||  CICS  ||  VSAM  ||  DB2 Interview Questions ( 110 )   || Simple JCL Tutorials  || JCL Tutorial from MainframeGurukul.com   || Simple JCL Tutorial - Chapter1 ;|| Mainframe Forum - Tutorials  || Mainframe Tutorials || Mainframe CICS tutorial|| Mainframe COBOL Tutorial

Drona Educational Forums - Mainframe Cobol DB2 CICS Board
Powered by phpBB

mainframetopic-3631.html