View previous topic :: View next topic
|
Author |
Message |
samzee71
New User
Joined: 01 Feb 2010 Posts: 8 Location: Dallas, TX, USA
|
|
|
|
I am using File Tailoring to generate jobs using templates in the skeleton library.
The template job JOBN0001 has 1100 rows, and JOBN0002 has 600 rows.
Issue:
The final generated job JOBN0001 is good and contains all 1100 rows from template JOBN0001.
The job JOBN0002 is also generated with 1100 rows instead of 600 rows.
In JOBN0002, rows 1-600 are ok, from the template job JOBN0002. Then it includes rows 601-1100 from JOBN0001.
I guess the temp buffer area needs some initialization.
Please advice a solution.
The code is below:
TMPDSN = "AAAA.BBBB.CCCC.DDDD"
JOBID = '1'
/* BUILD JOBS USING TEMPLATE JOBS */
DO UNTIL JOBID = 4
JOBID = RIGHT(JOBID,2,'0')
JOBNAME = "JOBN00" || JOBID
TMPJOB = JOBNAME
ADDRESS TSO "ALLOC FI(TMPJCL) DA('"TMPDSN"("TMPJOB")') SHR"
ADDRESS ISPEXEC "FTOPEN TEMP" /*File Tailoring*/
ADDRESS ISPEXEC "FTINCL" JOBNAME /*File Tailoring*/
ADDRESS ISPEXEC "FTCLOSE" /*File Tailoring*/
ADDRESS ISPEXEC "VGET (ZTEMPN)"
ADDRESS TSO "EXECIO * DISKR "ZTEMPN" (FINIS STEM SKEL."
ADDRESS TSO "EXECIO * DISKW TMPJCL (FINIS STEM SKEL."
ADDRESS TSO "FREE FI(TMPJCL)"
ADDRESS TSO "EXECIO * DISKW JCLFILE (STEM JCL. FINIS)"
JOBID = JOBID + 1
END |
|
Back to top |
|
|
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
I believe as though you have too many moving parts.
Not using TEMP output, going directly into your dataset
This setup has worked for me many times.
Try this:
Code: |
/* LIBDEF for PDS for Output of File Tailoring */
ADDRESS ISPEXEC "LIBDEF ISPFILE DATASET ID('"TMPDSN"')"
/* BUILD JOBS USING TEMPLATE JOBS */
DO UNTIL JOBID = 4
JOBID = RIGHT(JOBID,2,'0')
JOBNAME = "JOBN00" || JOBID
ADDRESS ISPEXEC "FTOPEN" /*File Tailoring*/
ADDRESS ISPEXEC "FTINCL" JOBNAME /*File Tailoring*/
ADDRESS ISPEXEC "FTCLOSE NAME("JOBNAME")" /*File Tailoring*/
JOBID = JOBID + 1
/* You may or may not need these two lines below (I did need them) */
ADDRESS TSO "ALLOC FI(TMPJCL) DA('"TMPDSN"') SHR"
ADDRESS TSO "FREE FI(TMPJCL)"
END |
Read more: ibmmainframes.com/viewtopic.php?p=342190#342190#ixzz4zwge5Qdg |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2023 Location: USA
|
|
|
|
This statement writes the content of stem JCL.
samzee71 wrote: |
Code: |
ADDRESS TSO "EXECIO * DISKW JCLFILE (STEM JCL. FINIS)" |
|
but from your fragment of code it's not clear how the stem itself is prepared?
Also: JCLFILE is constant DDNAME. Depending on DISP value, it can be either overridden, or appended - for 4 of created jobs? |
|
Back to top |
|
|
samzee71
New User
Joined: 01 Feb 2010 Posts: 8 Location: Dallas, TX, USA
|
|
|
|
Thanks.
I initialized the STEM variable to make it work.
SKEL. = ''
Also, removed this statement:
ADDRESS TSO "EXECIO * DISKW JCLFILE (STEM JCL. FINIS)" |
|
Back to top |
|
|
samzee71
New User
Joined: 01 Feb 2010 Posts: 8 Location: Dallas, TX, USA
|
|
|
|
Working code:
Code: |
TMPDSN = "AAAA.BBBB.CCCC.DDDD"
JOBID = '1'
/* BUILD JOBS USING TEMPLATE JOBS */
DO UNTIL JOBID = 4
JOBID = RIGHT(JOBID,2,'0')
JOBNAME = "JOBN00" || JOBID
ADDRESS TSO "ALLOC FI(TMPJCL) DA('"TMPDSN"("JOBNAME")') SHR"
ADDRESS ISPEXEC "FTOPEN TEMP" /*File Tailoring*/
ADDRESS ISPEXEC "FTINCL" JOBNAME /*File Tailoring*/
ADDRESS ISPEXEC "FTCLOSE" /*File Tailoring*/
ADDRESS ISPEXEC "VGET (ZTEMPN)"
ADDRESS TSO "EXECIO * DISKR "ZTEMPN" (FINIS STEM SKEL."
ADDRESS TSO "EXECIO * DISKW TMPJCL (FINIS STEM SKEL."
ADDRESS TSO "FREE FI(TMPJCL)"
SKEL. = ''
JOBID = JOBID + 1
END |
[/code] |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2023 Location: USA
|
|
|
|
Though this is not directly related to this topic issue, but I can never pass by any senseless, and/or useless statements:
Code: |
TMPDSN = "AAAA.BBBB.CCCC.DDDD"
/* BUILD JOBS USING TEMPLATE JOBS */
DO JOBID = 1 To 4
JOBNAME = "JOBN00" || RIGHT(JOBID,2,'0')
ADDRESS TSO "ALLOC FI(TMPJCL) DA('"TMPDSN"("JOBNAME")') SHR"
ADDRESS ISPEXEC "FTOPEN TEMP" /*File Tailoring*/
ADDRESS ISPEXEC "FTINCL" JOBNAME /*File Tailoring*/
ADDRESS ISPEXEC "FTCLOSE" /*File Tailoring*/
ADDRESS ISPEXEC "VGET (ZTEMPN)"
ADDRESS TSO "EXECIO * DISKR" ZTEMPN "(FINIS STEM SKEL."
ADDRESS TSO "EXECIO * DISKW TMPJCL (FINIS STEM SKEL."
ADDRESS TSO "FREE FI(TMPJCL)"
END |
1) loop variable supposed to be controlled by DO statement, not by several arithmetic calculation spread all over the code
2) special formatting (of JOBID) must be done ONLY where it is REALLY needed
3) "...* DISKR ... (STEM" is preparing the stem variable in full; no need to perform any reset of it
4) (minor thing, but still...) distribute quotes/spaces more reasonable, to clarify the code
Code: |
ADDRESS TSO "EXECIO * DISKR" ZTEMPN "(FINIS STEM SKEL."
/* the one above is more reasonable than the original one:
ADDRESS TSO "EXECIO * DISKR "ZTEMPN" (FINIS STEM SKEL." */ |
|
|
Back to top |
|
|
samzee71
New User
Joined: 01 Feb 2010 Posts: 8 Location: Dallas, TX, USA
|
|
|
|
Thanks alot to all for useful tips and solutions. I just started working on REXX. |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2023 Location: USA
|
|
|
|
I forgot one more tricky thing.
Code: |
ADDRESS TSO "EXECIO * DISKW TMPJCL (FINIS STEM SKEL." |
actually ignores the stem size set after DISKR in SKEL.0
Instead, it writes all lines till the first either undefined (e.g. 'STEM.nnn' value), or empty line (e.g. '' - empty string)
To make the code more robust, it is recommended to use this format:
Code: |
ADDRESS TSO "EXECIO" SKEL.0 "DISKW TMPJCL (FINIS STEM SKEL." |
|
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
As a contractor I have found that moving from site to site there are often different rules and settings at each one and as such always tend to use ISPFILE as one that I have defined myself. The one constant I have found is that ISPFILE is the default output at every site I have worked.
It keeps it simple for me that every REXX that I create will work pretty much unchanged at any site that I work without having to wander about looking at names and DD allocations.
And of course, you could always DELETE / REDEFINE the ISPFILE so that you know it will be empty each time, and if you still get naff results then it is time to review your code
Code: |
"FREE FI(ISPFILE)"
"DEL '"UID".ISPFILE'"
"ALLOC FI(ISPFILE) DA('"UID".ISPFILE') NEW TRACKS SPACE(5 5)
RECFM(F B)LRECL(80)"
.
.
.
.
/* EDIT The tailored file and submit manually */
"ISPEXEC FTOPEN"
"ISPEXEC FTINCL DEFRAG1A"
"ISPEXEC FTCLOSE"
"ISPEXEC EDIT DATASET('"UID".ISPFILE')"
.
.
.
.
.
/* Just submit the little bugger */
"ISPEXEC FTOPEN"
"ISPEXEC FTINCL DEFRAG1B"
"ISPEXEC FTCLOSE"
"SUBMIT '"UID".ISPFILE'"
|
|
|
Back to top |
|
|
Willy Jensen
Active Member
Joined: 01 Sep 2015 Posts: 712 Location: Denmark
|
|
|
|
I too prefer to write directly to ISPFILE, but I tried allocating a pds member to ISPFILE and it did not work, so I am using the ISPF temporary dataset here. I will investigate the failing pds output later, the manual indicates that it should work.
Anyway, this sample works for me. I like to use the REPRO command to copy between datasets with like attributes. And I also like to test statements for failures.
Code: |
address ispexec "vget ztempn"
do jobid=1 to 2
jobnr=right(jobid,2,0) /* used in the skeleton */
address ispexec
"ftopen temp"
if rc<>0 then exit xmsg('ftopen' jobid 'failed rc' rc,8)
"ftincl zskel"jobid
if rc<>0 then exit xmsg('ftincl' jobid 'failed rc' rc,8)
"ftclose"
if rc<>0 then exit xmsg('ftclose' jobid 'failed rc' rc,8)
address tso
"alloc dd(skelout) da('wj.lib.data1(job"jobnr")') shr reuse"
if rc<>0 then exit xmsg('alloc' jobid 'failed rc' rc,8)
"repro infile("ztempn") outfile(skelout)"
if rc<>0 then exit xmsg('repro' jobid 'failed rc' rc,8)
end
address tso "free dd(skelout)"
exit 0
XMsg: if arg(1)<>'' then say arg(1);return word(arg(2) 0,1)
|
|
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
I may be going mad .............. but
I can recall from the dark and distant past that ISPFILE was always a PS file
And it's quite easy to use ISPFILE for multiple jobs for submission too.
I always prefer the easy option |
|
Back to top |
|
|
|