Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Issue in order of execution of the JOB via REXX

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
Ramsee

New User


Joined: 06 Jan 2011
Posts: 52
Location: Chennai

PostPosted: Thu Oct 17, 2013 10:07 pm    Post subject: Issue in order of execution of the JOB via REXX
Reply with quote

Hi All,

Warm greetings,

I written the following code and i expect the two JOB's (A and B) to be executed in ascending order by unfortunately the if i execute the REXX program once the submission is happening in the following order
1) JOB B,
2) JOB A and once again
3) JOB-B

Please find the below code:
Code:

TRACE N
/* Libraray definition   -- starts -- */
FILEDSN = 'USER.TEST.ACTUAL'
SKELIB  = 'USER.TEST.SKELE'
/* Libraray definition   -- ends-- */
CLRSCRN
SAY 'PLEASE ENTER THE E-MAIL ID: '
PULL mail_id

IF datatype(mail_id) <> 'CHAR'
THEN SAY 'ENTERED MAIL-ID is wrong:'

SAY 'PLEASE ENTER THE COMPANY NAME:'
PULL company_name

IF datatype(company_name) <> 'CHAR'
THEN SAY 'ENTERED COMPANY NAME is wrong:'

SAY 'Please enter the Company number :'
PULL companynumber

IF datatype(companynumber) <> 'NUM'
THEN SAY 'Company number entered is wrong:'

SAY 'Please enter date to be converted(YYYYMMDD):'
PULL date_process

ADDRESS ISPEXEC
"LIBDEF ISPFILE DATASET ID('"||FILEDSN||"')"
"LIBDEF ISPSLIB DATASET ID('"||SKELIB||"')"

"FTOPEN TEMP"

SKUSR=USERID()
SKDSN1=SKUSR||'.UNZIP.FILE'
SKDSN2=SKUSR||'.UNZIP.EXTRACT.FILE'
SKCMPFLE=SKUSR||'.COMPANY.NUM'

"FTINCL JOBA"  /* JOB A */

IF (RC \=0) THEN

DO

SAY "RETURN CODE OF THE FIRST JOB :" || RC ZERRSM ZERRLM
EXIT
 END

"FTCLOSE"
"VGET ZTEMPF"
ADDRESS TSO "SUBMIT '"ZTEMPF"'"

/*   JOB A details are collectred from screen */

/* JOB B process starts   */
"FTOPEN TEMP"
"FTINCL JOBB"   /*JOB B*/

ADDRESS TSO
STATUS1 = SYSDSN("'"SKCMPFLE"'")


IF STATUS1 = 'OK' THEN
DO
   "DELETE '"SKCMPFLE"'"
END

cmpnum = RIGHT(companynumber,11,'0')
say cmpnum

"ALLOC FI(XYOUT) DA('"SKCMPFLE"') NEW SPACE(50,20)
 DSORG(PS) RECFM(F B) LRECL(80) BLKSIZE(27920)"

PUSH cmpnum

"EXECIO * DISKW XYOUT (FINIS"
"FREE F(XYOUT)"

TRACE I
ADDRESS TSO
filestat2 = "'ZK5OPCR.TSO.LOG(A"date1")'"
say 'filestat2' =filestat2
ADDRESS TSO
STATUS2=SYSDSN("'"filestat2"'")

IF STATUS2 = 'OK' THEN
DO
  "DELETE '"filestat2"'"
END

"ALLOC FI(XXOUT) DA('ZK5OPCR.TSO.LOG(A"date1")') SHR"

PUSH "DATE of Extraction :" date_process
"EXECIO * DISKW XXOUT (FINIS"
"FREE F(XXOUT)"
"FTCLOSE"
"VGET ZTEMPF"
ADDRESS TSO "SUBMIT '"ZTEMPF"'"
RETURN


Now If i execute the above code the jobs are submitted unevenly.

I need to execute the JOBA and then JOBB.

Kindly help me out my mistake in the above code.

Thanks a lot for the time.
Back to top
View user's profile Send private message

Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1753
Location: Bloomington, IL

PostPosted: Thu Oct 17, 2013 10:48 pm    Post subject:
Reply with quote

Submitting two jobs in a particular order never guarantees that they will be executed in that order. As alternatives, you can:
  • Use a scheduling system to guarantee order
  • Form them into a DJC network, if your machine runs JES3
  • Have the last step of job A submit job B
  • Make them into a single job.

I leave it to you to decide which best fits your needs and resources.
Back to top
View user's profile Send private message
Pedro

Senior Member


Joined: 01 Sep 2006
Posts: 2033
Location: Silicon Valley

PostPosted: Fri Oct 18, 2013 2:20 am    Post subject: Reply to: Issue in order of execution of the JOB via REXX
Reply with quote

It sounds like the result is that two Job A and two Job B are submitted. Does it happen every time?

I think you have residual data in the data set from prior executions. I noticed you set variable FILEDSN with a permanent data set and use it in LIBDEF ISPFILE. But then use FTOPEN TEMP and ZTEMPF. "LIBDEF ISPFILE" and "FTOPEN TEMP" are conflicting usages. Perhaps it is getting confused and using the same data set from a previous execution. I do not think you should use LIBDEF ISPFILE and rely on using a temporary data set.
Back to top
View user's profile Send private message
Ramsee

New User


Joined: 06 Jan 2011
Posts: 52
Location: Chennai

PostPosted: Fri Oct 18, 2013 7:27 pm    Post subject: Reply to: Issue in order of execution of the JOB via REXX
Reply with quote

Thanks a lot Mr.Pedro and Mr.Akatsukami for your time and valuable suggesstion on my issue.

I discussed with my collegue and he found an error that i have given TSO SUBMIT twice in my REXX program so control in ZTEMPF is not clear in executing the JOB's. so i changed my code accordingly with one TSO SUBMIT.

Now i was able to submit JOB A and then JOB B. now JOB B should be a Successor of JOB A , instead both the JOB's ran simultaneously.

So I merged the JOB A and JOB B into a single and i got my expected output.

Once again thanks a ton for your time and suggesstion.
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 -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts REXX cdoe to purge a JOB from spool a... Sulabh Agrawal CLIST & REXX 11 Thu Mar 09, 2017 11:36 am
No new posts Overriding PS data in rexx Shaheen Shaik CLIST & REXX 8 Fri Mar 03, 2017 5:08 pm
No new posts REXX compiled via RXTCOMP sergeyken CLIST & REXX 7 Tue Feb 07, 2017 9:41 pm
This topic is locked: you cannot edit posts or make replies. Calling REXX code from ISPF panel sanchita dey TSO/ISPF 4 Mon Jan 02, 2017 5:13 pm
No new posts Order BY AND Index Nileshkul DB2 2 Sat Dec 31, 2016 6:33 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us