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

Issue in order of execution of the JOB via REXX


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Ramsee

New User


Joined: 06 Jan 2011
Posts: 53
Location: Chennai

PostPosted: Thu Oct 17, 2013 10:07 pm
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: 1788
Location: Bloomington, IL

PostPosted: Thu Oct 17, 2013 10:48 pm
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

Global Moderator


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

PostPosted: Fri Oct 18, 2013 2:20 am
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: 53
Location: Chennai

PostPosted: Fri Oct 18, 2013 7:27 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts Compile Several JCL JOB Through one r... CLIST & REXX 4
No new posts Running REXX through JOB CLIST & REXX 13
No new posts Error to read log with rexx CLIST & REXX 11
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts isfline didnt work in rexx at z/OS ve... CLIST & REXX 7
Search our Forums:

Back to Top