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

Using different values for Skeleton dialog variables in loop


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

New User


Joined: 20 Jun 2015
Posts: 26
Location: INDIA

PostPosted: Thu Sep 03, 2015 5:28 pm
Reply with quote

Hi all,

I am using )DO loop in JCL skeleton to create multiple DB2 BIND steps. I have generated different values for dialog variable (say, OWNER) in the REXX EXEC as shown below:
OWNER1 = TGAWTBT
OWNER2 = TGBWTBT
and so on..

I also figured to manipulate the dialog variable to be used in the skeleton (like STEP name below). But I am getting "OWNER1" in the output whereas I intend to get "TGAWTBT".

I refered the below URL from our forum (in addition to many others).
job Step to be run n number of times changing sysin card
However, I need to have a different values in place of "PART1" or "PART2" of the SYSIN card output.

I have been instructed to have only one Skeleton JCL. So, I can't loop the FTINCL command for this step, generate multiple parts and then club them to form a single JCL.

Skeleton:
Code:

)DO SNUM = 1 TO &COLLCNT
)SET TEMP1 = OWNER&SNUM

//STEP15R&SNUM  EXEC PGM=IKJEFT01,DYNAMNBR=20,COND=(0,NE)
//SYSTSIN  DD *
DSN SYSTEM(GR0C)                           
    BIND OWNER(&TEMP1)      -       
     FLAG        (I)             -
     CURRENTDATA (NO)            -
     RELEASE     (DEALLOCATE)    -
     ENABLE      (*)             -
     SQLERROR    (NOPACKAGE)     
)ENDDO


Current result:

Code:

//STEP15R1  EXEC PGM=IKJEFT01,DYNAMNBR=20,COND=(0,NE)
//SYSTSIN  DD *
DSN SYSTEM(GR0C)                     
    BIND OWNER (OWNER1)      -
     FLAG        (I)             -
     CURRENTDATA (NO)            -
     RELEASE     (DEALLOCATE)    -
     ENABLE      (*)             -
     SQLERROR    (NOPACKAGE)     


Desired result:
Code:

//STEP15R1  EXEC PGM=IKJEFT01,DYNAMNBR=20,COND=(0,NE)
//SYSTSIN  DD *
DSN SYSTEM(GR0C)                     
    BIND OWNER (TGAWTBT)      -
     FLAG        (I)             -
     CURRENTDATA (NO)            -
     RELEASE     (DEALLOCATE)    -
     ENABLE      (*)             -
     SQLERROR    (NOPACKAGE)     


I request your guidance to achieve the intended result.
Back to top
View user's profile Send private message
don.leahy

Active Member


Joined: 06 Jul 2010
Posts: 765
Location: Whitby, ON, Canada

PostPosted: Thu Sep 03, 2015 5:57 pm
Reply with quote

If I were faced with this, I would set up the function that invokes FTINCL to store the list of OWNERs in an ISPF table.

Then I would use the )DOT ...)ENDDOT skeleton commands to tailor JCL for each OWNER in the table.
Back to top
View user's profile Send private message
venksiv

New User


Joined: 20 Jun 2015
Posts: 26
Location: INDIA

PostPosted: Thu Sep 03, 2015 6:05 pm
Reply with quote

Thank you for your reply, don.leahy!

I am referring to the documentation at
Control Statements

I will achieve it with a little explanation on how this works. Could you please help me?[/url]
Back to top
View user's profile Send private message
don.leahy

Active Member


Joined: 06 Jul 2010
Posts: 765
Location: Whitby, ON, Canada

PostPosted: Thu Sep 03, 2015 6:19 pm
Reply with quote

I suggest that you also read up on ISPF Tables. These tables, not to be confused with DB2 tables, are easy to set up and use. Most of the time they are temporary in nature and are deleted when the dialog completes.

My suggestion is that you change the function (easy if it is Rexx) that invokes FTINCL. Use TBCREATE service to create the ISPF table, and then the TBADD service to add a row for each value of &OWNER.

In the skeleton, use the )DOT control statement. )DOT means 'DO Table' and has actually been available longer than the )DO statement. )DOT table_name causes file tailoring to loop through each row in the table, tailoring the skeleton JCL that appears between the )DOT and )ENDDOT statements.
Back to top
View user's profile Send private message
Mickeydusaor

Active User


Joined: 24 May 2006
Posts: 258
Location: Salem, Oregon

PostPosted: Thu Sep 03, 2015 7:28 pm
Reply with quote

you have several ways of doing this.

change the following to
1. SET TEMP1 = OWNER&SNUM change to SET TEMP1 = OWNER.&SNUM

2. BIND OWNER (OWNER1) change to BIND OWNER (&OWNER.&SNUM)
Back to top
View user's profile Send private message
venksiv

New User


Joined: 20 Jun 2015
Posts: 26
Location: INDIA

PostPosted: Fri Sep 04, 2015 11:06 am
Reply with quote

Hi Don,

Great suggestion! After reading your post and re-reading the other post I referenced in my initial message, I realize that I haven't properly read the reference. I tried the sample code using ISPF Table and )DOT which Pandora-Box had shared. It's working perfectly and seems to be the solution I am looking for.

Hi Mickeydusaor,

I tried your suggestion in my code. I got the text "&OWNER1" instead of the value "TGAWTBT" I expected there. To be more precise, I got the variable name instead of the value I have in the EXEC.

New result:
Code:

//STEP15R1  EXEC PGM=IKJEFT01,DYNAMNBR=20,COND=(0,NE)
//SYSTSIN  DD *
DSN SYSTEM(GR0C)                     
    BIND OWNER (&OWNER1)      -
     FLAG        (I)             -
     CURRENTDATA (NO)            -
     RELEASE     (DEALLOCATE)    -
     ENABLE      (*)             -
     SQLERROR    (NOPACKAGE)


I will try the )DOT solution and share my findings here.

I truly value every single input you give me. Enlightens!! Thanks for your time.
Back to top
View user's profile Send private message
venksiv

New User


Joined: 20 Jun 2015
Posts: 26
Location: INDIA

PostPosted: Fri Sep 04, 2015 1:53 pm
Reply with quote

Hi all,

I tried )DOT concept. Unfortunately, this works only for the looping part. Meaning, JCL is tailored correctly if this (bind) is the only step in the skeleton. I am getting ISPG117 error with abend code of ISPFILTR if I have other steps in the same skeleton.

I am not sure about how to fix this issue using this reference post. I need the JCL in a PDS after I execute the job but this post deals with only ZTEMPF.

I need to have other steps in the same job that would execute once, like load module and DBRM copy steps as depicted below:

Code:
JOB statement
STEP01 - copy load module
STEP02 - copy dbrm
STEP031 - bind with QUALIFIER1
STEP032 - bind with QUALIFIER2
.
.
STEP03x - bind with QUALIFIERx
STEP04 - send email to intimate the completion of the task


If )DOT is used, should it be the only step used in the JCL? I am curious to know how the JOB statement is built only once in the result.

Please share the proper method to use )DOT if I wish to have other control statements in File Tailoring [eg. )DO, )IF, etc] in order to construct other JCL steps.
Back to top
View user's profile Send private message
venksiv

New User


Joined: 20 Jun 2015
Posts: 26
Location: INDIA

PostPosted: Fri Sep 04, 2015 4:12 pm
Reply with quote

Issue resolved!! icon_smile.gif

The issue (message ISPG117 with abend code = ISPFILTR) occurred while operating on other skeletons (control card for constructing email text) between the ISPF table creation and the JCL skeleton [that contained )DOT]. When I placed the segment of code that constructs multiple steps using )DOT section of Skeleton immediately after the ISPF table creation the issue got resolved. It smoothly operated on the other skeletons after creating the JCL.

Logically, I will first create the JCL and then create the control cards. If both are successful, i will submit the job which solves the purpose. This way the dynamic JCL creation with dynamic values worked fine. icon_smile.gif

REXX EXEC:
Code:

JCLPDS     = USERID()||".TEST.SUBMIT.JCL"

ADDRESS ISPEXEC                                 
"ISPEXEC LIBDEF ISPSLIB DATASET ID('"SKELPDS"')"
"ISPEXEC LIBDEF ISPFILE DATASET ID('"JCLPDS"')"
"TBCREATE CTBL NAMES(CNTR PACKAGE OWNER QUALIFR)",
"NOWRITE REPLACE"                                 
A = 0                             
DO COLLCNT                       
   A = A + 1                     
   CNTR = A                       
   INTERPRET "PACKAGE = BIND.COLL"||A||".PACKAG"
   INTERPRET "OWNER = BIND.COLL"||A||".OWNR"   
   INTERPRET "QUALIFR = BIND.COLL"||A||".QUAL" 
   ADDRESS ISPEXEC "TBADD CTBL"                 
END 

/* JCL SKELETON */                       
ADDRESS ISPEXEC "TBTOP  CTBL"           
ADDRESS ISPEXEC                         
"FTOPEN"                                 
"FTINCL RTSWTBT$"                       
"FTCLOSE NAME(RTSWTBT$) LIBRARY(ISPFILE)"

/* EMAIL TEXT SKELETON */                                   
IF  ERROR_FLAG = 'N' THEN                                   
    DO                                                     
      "FTOPEN"                                             
      "FTINCL EMAIL1"                          /* SUCCESS */
      "FTCLOSE NAME(EMAIL1) LIBRARY(ISPFILE)"               
      ADDRESS TSO "DELETE '"REQFILE"'"                     
    END                                                     

SUBJCL = JCLPDS||'('||RTSWTBT$||')'

ADDRESS TSO       
M = OUTTRAP('MSG.')
"SUBMIT '"SUBJCL"'"
M = OUTTRAP('OFF')
"FREE FI(ISPFILE)"

EXIT


Skeleton:
Code:

)DOT CTBL                                                               
//*********************************************************************/
//***       B I N D   S T E P   F O R   D B 2   P R O G R A M       ***/
//*********************************************************************/
//STEP15R&CNTR  EXEC PGM=IKJEFT01,DYNAMNBR=20,COND=(0,NE)               
//STEPLIB  DD DISP=SHR,DSN=SYSAPF.DBMS.DB2GR0C.SDSNLOAD                 
//DBRMLIB  DD DISP=SHR,DSN=&DBRMLIB                                     
//SYSTSIN  DD *                         
DSN SYSTEM(GR0C)                         
    BIND PACKAGE     (&PACKAGE)      -   
         OWNER       (&OWNER)        -   
         QUALIFIER   (&QUALIFR)         -
         MEMBER      (&PGMNAME)      -   
     FLAG        (I)             -
     CURRENTDATA (NO)            -
     RELEASE     (DEALLOCATE)    -
     ENABLE      (*)             -
     SQLERROR    (NOPACKAGE)     
END                               
//*   
)ENDDOT
//*********************************************************************/
//*** S E N D S   S T A T U S   E M A I L   T O   R E Q U E S T O R ***/
//*********************************************************************/
//STEP25R  EXEC PGM=IEBGENER,COND(STEP20R,LT,4)                         
//SYSPRINT DD SYSOUT=*                                                 
//SYSOUT   DD SYSOUT=*                                                 
//SYSIN    DD DUMMY                                                     
//SYSUT2   DD SYSOUT=(S,TCPSMTP)                                       
)IF &ERRFLAG = 0 THEN                                                   
)DO                                                                     
//SYSUT1   DD DISP=SHR,DSN=&JCLPDS(EMAIL1)                             
//*                                                                     
)ENDDO                                                                 


The result was as expected with 'TGAWTBT', 'TGBWTBT',... in the multiple bind steps.

Glad it finally worked! icon_smile.gif
Back to top
View user's profile Send private message
venksiv

New User


Joined: 20 Jun 2015
Posts: 26
Location: INDIA

PostPosted: Fri Sep 04, 2015 4:15 pm
Reply with quote

Please be informed that I have removed certain JCL statements (DD statements) in the skeleton and result. Please have all JCL statements in case you wish to construct JCL for processing. I intended to post the working logic.
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 INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
This topic is locked: you cannot edit posts or make replies. REXX - Do - Not able to LOOP CLIST & REXX 10
No new posts Null values are considered in Total c... DFSORT/ICETOOL 6
No new posts step by step trace 4 ISPF dialog call... TSO/ISPF 17
Search our Forums:

Back to Top