View previous topic :: View next topic
|
Author |
Message |
Ramsee
New User
Joined: 06 Jan 2011 Posts: 53 Location: Chennai
|
|
|
|
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 |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
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 |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2547 Location: Silicon Valley
|
|
|
|
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 |
|
|
Ramsee
New User
Joined: 06 Jan 2011 Posts: 53 Location: Chennai
|
|
|
|
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 |
|
|
|