|
View previous topic :: View next topic
|
| Author |
Message |
Ajay Patil
New User
Joined: 18 Apr 2013 Posts: 5 Location: USA
|
|
|
|
Hi All,
I am running a query through jcl to pull data from table.
Query has three parts part 1, part 2 and part 3.
I have to run the same query for n number of times lets say for 1000 records it needs to be run 10 times.
Now I want to use only 1 step in the job and change the part 2 of the query to create 10 different steps dynamically and submit them under one job.
All of this using REXX.
Is this possible to do using REXX? |
|
| Back to top |
|
 |
superk
Global Moderator

Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
| Sure, in any number of ways. |
|
| Back to top |
|
 |
Pandora-Box
Global Moderator
.jpg)
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
| Can you show us what is part 2 atleast a sample? |
|
| Back to top |
|
 |
Robert Sample
Global Moderator

Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
If you are asking whether you can submit job A that uses REXX to generate 10 different steps in job A, then the answer is that what you want to do cannot be done -- period. Once a job is submitted and passes through the converter / interpreter of JES, it cannot be changed -- period.
If you want job A to generate job B with 10 steps and submit it through the internal reader to the system, then this can be done -- and has been explained on this forum MANY times; use the Search function.
If you want something else, you will need to explain what you are attempting to do. |
|
| Back to top |
|
 |
Ajay Patil
New User
Joined: 18 Apr 2013 Posts: 5 Location: USA
|
|
|
|
Pandora-Box.
Its a simple file with 15 digit number used in where condition.
ex
'00014546589',
'00014565832',
'00067018564'
Robert Sample
yes I was looking for REXX to generate 10 different steps for job A and then submit job A.
superk,
Could you please guide me how this can be achieved.
Thanks everyone for your quick reply. |
|
| Back to top |
|
 |
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2454 Location: Hampshire, UK
|
|
|
|
15 digit number? What you have shown are 3 11-digit numbers with no context in which to place them! Sample input and sample output might help us to understand.
So you are talking about a foreground execution generating a ten step job and then submitting it? |
|
| Back to top |
|
 |
Ajay Patil
New User
Joined: 18 Apr 2013 Posts: 5 Location: USA
|
|
|
|
Hi Nic Clouston
lets say below is the query.
SELECT A.ABS_bnv
,B.ABS_bnv
FROM PROD.AAA_BBB_CCC A
,PROD.ZZZ_XXX_NNN B
WHERE
AND A.ABC_ID IN
( '00014546589',
'00014565832',
'00067018564' )
AND A.XYZ = B.XYZ
AND A.HJH = B.HJH
Part 2 contains only
'00014546589',
'00014565832',
'00067018564'
Rest of the query is static.
1st half is part1 and second half is part 3.
Yes I want to generate 10 steps under one job with varying part2 and then submit this job.
For ex in below step.
queue "//step001 exec pgm=inzutilb,parm='asd',region=6m, "
queue "// cond=(4,lt) "
queue "//steplib dd dsn=xyz.zxz,disp=shr "
queue "// dd dsn=zaz.aza,disp=shr "
queue "// dd dsn=afd.sdf,disp=shr "
queue "//sysprint dd sysout=* "
queue "//utprint dd sysout=* "
queue "//sysudump dd sysout=* "
queue "//* "
queue "//sysctl01 dd dummy "
queue "//* "
queue "//sysrec01 dd dsn=ABC.BCD,disp=shr "
queue "//sysin dd dsn=abc.abc.abc(part1),disp=shr "
queue "// dd dsn=abc.abc.abc(mem1),disp=shr "
queue "// dd dsn=abc.abc.abc(part2),disp=shr "
Now I want this step to be generated lets say 10 times with varying sysin
mem1 mem2 mem3 so on till mem10.
Then all these steps should be submitted under one job.
No of step to be created will vary for every run hence I need steps to be created dynamically.
Thanks |
|
| Back to top |
|
 |
Akatsukami
Global Moderator

Joined: 03 Oct 2009 Posts: 1787 Location: Bloomington, IL
|
|
|
|
Piece of pie. Create a skeleton with suitable items (job name, step name and library and member containing keys to be searched for ought to be enough, I trow) as variables; include everything but the job card in a )DOT construct. Create a Rexx script that reads the list of libraries and members, and adds them with a fabricated step name (the literal "STEP" concatenated with record counter should be sufficient) to an ISPF table. Tailor the skeleton and submit the resulting job.
That'll be Rs. 5,000, thank you  |
|
| Back to top |
|
 |
Ajay Patil
New User
Joined: 18 Apr 2013 Posts: 5 Location: USA
|
|
|
|
Thanks a lot Akatsukami for providing the solution.
Could you please provide an example. This will help me to understand it better. |
|
| Back to top |
|
 |
Akatsukami
Global Moderator

Joined: 03 Oct 2009 Posts: 1787 Location: Bloomington, IL
|
|
|
|
| Ajay Patil wrote: |
Thanks a lot Akatsukami for providing the solution.
Could you please provide an example. This will help me to understand it better. |
As you do not purport that Rexx is among your skills, Ajay -- and also to remind others that talk is cheap, but whiskey costs money:
| Code: |
/* Rexx */
/*********************************************************************/
/* */
/* Written Heisei 25.06.24 by Akatsukami-sama. */
/* */
/*********************************************************************/
trace o
sig = x2c("E69989A3A3859540C88589A2858940F2F54BF0F64BF2F440")
sig = sig || x2c("82A840C19281A3A2A49281948960A2819481")
tsoid = userid()
cnt = 0
address ispexec "TBCREATE TAD NAMES(CNTR LIBRARY MEMBER)",
"NOWRITE REPLACE"
"EXECIO 1 DISKR TULIN"
do while (rc=0)
pull record
parse var record library member .
cnt = cnt + 1
select
when (cnt<10) then cntr = "000"cnt
when (cnt<100) then cntr = "00"cnt
when (cnt<1000) then cntr = "0"cnt
otherwise cntr = cnt
end
address ispexec "TBADD TAD"
"EXECIO 1 DISKR TULIN"
end
address ispexec "TBTOP TAD"
address ispexec "FTOPEN TEMP"
address ispexec "FTINCL SAD"
address ispexec "FTCLOSE"
address ispexec "VGET ZTEMPF"
"SUBMIT '"ztempf"'"
exit
|
The SAD skeleton
| Code: |
//&TSOID.FOO JOB ,'INZILADUN',CLASS=S,MSGCLASS=1,SCHENV=JOB@ANY,
// TYPRUN=SCAN
)DOT TAD
//STEP&CNTR EXEC PGM=INZUTILB,PARM='ASD',REGION=6M,
// COND=(4,LT)
//STEPLIB DD DSN=XYZ.ZXZ,DISP=SHR
// DD DSN=ZAZ.AZA,DISP=SHR
// DD DSN=AFD.SDF,DISP=SHR
//SYSPRINT DD SYSOUT=*
//UTPRINT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//*
//SYSCTL01 DD DUMMY
//*
//SYSREC01 DD DSN=ABC.BCD,DISP=SHR
//SYSIN DD DSN=ABC.ABC.ABC(PART1),DISP=SHR
// DD DSN=&LIBRARY(&MEMBER),DISP=SHR
// DD DSN=ABC.ABC.ABC(PART2),DISP=SHR
)ENDDOT |
Run in the background job
| Code: |
//FOOISPF JOB ,'Generic ISPF',CLASS=S,MSGCLASS=1,SCHENV=JOB@ANY,
// REGION=0M
//*
//STEP20 EXEC ISPFB,
// DYNAMNBR=25
//ISPPROF DD DSN=&PROF,DISP=(,DELETE),UNIT=TEMPDISK,
// SPACE=(CYL,(2,1,2)),DCB=(RECFM=FB,LRECL=80,BLKSIZE=8880)
//SYSPRINT DD SYSOUT=*
//ISPLOG DD DUMMY
//SYSTSPRT DD SYSOUT=*,
// DCB=(RECFM=FBA,LRECL=133,BLKSIZE=0,DSORG=PS)
//ISPFILE DD DSN=BAR.TOOLS.CNTL,DISP=SHR
//SYSPROC DD DSN=FOO.WORK.CLIST,DISP=SHR
//ISPLLIB DD DSN=FOO.WORK.LOAD,DISP=SHR
//ISPSLIB DD DSN=FOO.WORK.SKELS,DISP=SHR
//ISPTLIB DD DSN=BAR.TOOLS.ISPTLIB,DISP=SHR
//ISPTABL DD DSN=FOO.SFTEST.ISP.ISPTLIB,DISP=SHR
//PLIDUMP DD DUMMY
//TULIN DD *
ABC.ABC.ABC MEM1
ABC.ABC.ABC MEM2
FOO.BAR SNAFU
NOTARY.SOJAC JANFU
//SYSTSIN DD *
ISPSTART CMD(%FOO100) |
it generates the JCL
| Code: |
//MYIDFOO JOB ,'INZILADUN',CLASS=S,MSGCLASS=1,SCHENV=JOB@ANY,
// TYPRUN=SCAN
//STEP0001 EXEC PGM=INZUTILB,PARM='ASD',REGION=6M,
// COND=(4,LT)
//STEPLIB DD DSN=XYZ.ZXZ,DISP=SHR
// DD DSN=ZAZ.AZA,DISP=SHR
// DD DSN=AFD.SDF,DISP=SHR
//SYSPRINT DD SYSOUT=*
//UTPRINT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//*
//SYSCTL01 DD DUMMY
//*
//SYSREC01 DD DSN=ABC.BCD,DISP=SHR
//SYSIN DD DSN=ABC.ABC.ABC(PART1),DISP=SHR
// DD DSN=ABC.ABC.ABC(MEM1),DISP=SHR
// DD DSN=ABC.ABC.ABC(PART2),DISP=SHR
//STEP0002 EXEC PGM=INZUTILB,PARM='ASD',REGION=6M,
// COND=(4,LT)
//STEPLIB DD DSN=XYZ.ZXZ,DISP=SHR
// DD DSN=ZAZ.AZA,DISP=SHR
// DD DSN=AFD.SDF,DISP=SHR
//SYSPRINT DD SYSOUT=*
//UTPRINT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//*
//SYSCTL01 DD DUMMY
//*
//SYSREC01 DD DSN=ABC.BCD,DISP=SHR
//SYSIN DD DSN=ABC.ABC.ABC(PART1),DISP=SHR
// DD DSN=ABC.ABC.ABC(MEM2),DISP=SHR
// DD DSN=ABC.ABC.ABC(PART2),DISP=SHR
//STEP0003 EXEC PGM=INZUTILB,PARM='ASD',REGION=6M,
// COND=(4,LT)
//STEPLIB DD DSN=XYZ.ZXZ,DISP=SHR
// DD DSN=ZAZ.AZA,DISP=SHR
// DD DSN=AFD.SDF,DISP=SHR
//SYSPRINT DD SYSOUT=*
//UTPRINT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//*
//SYSCTL01 DD DUMMY
//*
//SYSREC01 DD DSN=ABC.BCD,DISP=SHR
//SYSIN DD DSN=ABC.ABC.ABC(PART1),DISP=SHR
// DD DSN=FOO.BAR(SNAFU),DISP=SHR
// DD DSN=ABC.ABC.ABC(PART2),DISP=SHR
//STEP0004 EXEC PGM=INZUTILB,PARM='ASD',REGION=6M,
// COND=(4,LT)
//STEPLIB DD DSN=XYZ.ZXZ,DISP=SHR
// DD DSN=ZAZ.AZA,DISP=SHR
// DD DSN=AFD.SDF,DISP=SHR
//SYSPRINT DD SYSOUT=*
//UTPRINT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//*
//SYSCTL01 DD DUMMY
//*
//SYSREC01 DD DSN=ABC.BCD,DISP=SHR
//SYSIN DD DSN=ABC.ABC.ABC(PART1),DISP=SHR
// DD DSN=NOTARY.SOJAC(JANFU),DISP=SHR
// DD DSN=ABC.ABC.ABC(PART2),DISP=SHR |
Talk is cheap, but whiskey costs money; Rs. 50,000, to be precise  |
|
| Back to top |
|
 |
Ajay Patil
New User
Joined: 18 Apr 2013 Posts: 5 Location: USA
|
|
|
|
I appreciate your help Akatsukami.
Thanks a lot.. |
|
| Back to top |
|
 |
Pandora-Box
Global Moderator
.jpg)
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
| But why do you need 10 jobs if you could store the result from SYSREC00 to SYSREC09? |
|
| Back to top |
|
 |
venksiv
New User
Joined: 20 Jun 2015 Posts: 26 Location: INDIA
|
|
|
|
Thank you, Pandora-Box, for sharing the sample code. I learnt ISPF table and )DOT concepts from your example. Yet to explore more to make use of this concept in my code. link to my post
My sincere thanks. |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|