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

REXX - My program is not creating Bind jcl's in the backend


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

New User


Joined: 21 Aug 2007
Posts: 4
Location: india

PostPosted: Wed Aug 22, 2007 10:20 am
Reply with quote

Hi,

I have one doubt in REXX.My REXX program used to create Bind jcl's in the back end which is stored in the datset,but now it is not working.

I am here by sending the code.If anyone has an idea,just guide me.

Code:

-----------------------------
/*...this will trace every statement  */
/*use with 'TRACE OFF' to turn off within code  */
/*TRACE ALL */
/*------------------*/
/* Main_Driver:  ---*/
/*------------------*/

  Address Isredit
  "MACRO NOPROCESS"
User = UserId()
User2 = substr(User,2, 6)
Linenum = 0
totcntr = 0
Address Ispexec

  Address Isredit
  Call 0300_Get_Element_Typ
  call 0400_Get_From_Env
  Call 0200_Get_Target_Env
  Call 0100_Get_date
  /*  pull LibPick                             */
  /*if LibPick = '' then                       */
  /* do                                        */
  /*   say 'USED DEFAULT - DTF.IT.DTF5.STPLIB' */
  /* LibPick = 'DTF.IT.DTFB.PGMLIB' */
  /* end                                       */
   Call 4005_init_DSN
   Call 2000_Write_Step

   x = outtrap("PdsMbrs.",'*')
     Address TSO "LISTDS '"LibPick"' MEMBERS"
   x = outtrap("off")

   Q = ' '

   Do I = 7 To PdsMbrs.0 By 1

     MbrName = Word(PdsMbrs.I,1)
     if substr(MbrName,1,2) = 'GP' then
       do
        Searchingfor = MbrName || '200'
        Call 4000_Check_load_dt
        if dataisfound = 'Y' then
           do
             if substr(founddate,1, 8) >= EnteredDate then
               do
                say MbrName || ' ' || founddate || ' ' ||  EnteredDate
                totcntr = totcntr + 1
                MbrNameArray.totcntr = MbrName
               end
              Else
                say MbrName || ' ' || founddate || ' - OK '

            End
        end
    End

  Address Ispexec
    ISPEXEC "LMFREE DATAID("D1")"
    If RC <> 0 Then
    say 'LMFREE Return code = ' || rc || ' - ' || MbrName


  Address Isredit
   Call 3000_Write_Steps

   say ' '
   say 'Total records written = ' || totcntr
   say ' '

   Exit

  /*------------------------*/
    0100_Get_Date:
  /*------------------------*/
    say 'Enter Date (yyyymmdd):  '
    pull EnteredDate
    if EnteredDate = '' Then
       do
         EnteredDate = Date(S)
         Say ' '
         say 'Todays Dated Used - ' EnteredDate
         Say ' '
      end


   if length(EnteredDate) = 8 then
      do
        do w = 1 to 8
           if substr(EnteredDate, w, 1) < 0 then
              do
                say 'INVALID DATE - Date must be numeric. Exiting Rexx'
                exit
              end
           if substr(EnteredDate, w, 1) > 9 then
              do
                say 'INVALID DATE - Date must be numeric. Exiting Rexx'
                exit
              end

        end
      end
    else
        do
          say 'INVALID DATE Entered - Exiting Rexx'
        exit
        end

     return

  /*------------------------*/
    0200_Get_Target_Env:
  /*------------------------*/
   say 'Enter Target Environment: '
   pull ENVIRON
   ENVIRON = WORD(ENVIRON,1)
   Select
     When ENVIRON = 'T11' THEN
        DO
          stagenam = 'DTFT'
          MVSEnv   = 'TDB1'
        END
     When ENVIRON = 'T12' THEN
        DO
          stagenam = 'DTF1'
          MVSEnv   = 'TDB2'
        END
     When ENVIRON = 'T13' THEN
        DO
          stagenam = 'DTF2'
          MVSEnv   = 'TDB3'
        END
     When ENVIRON = 'T14' THEN
        DO
          stagenam = 'DTF3'
          MVSEnv   = 'TDB4'
        END
     When ENVIRON = 'T15' THEN
        DO
          stagenam = 'DTF4'
         MVSEnv   = 'TDB5'
       END
    When ENVIRON = 'T16' THEN
       DO
         stagenam = 'DTF5'
         MVSEnv   = 'TDB6'
       END
    When ENVIRON = 'T17' THEN
       DO
         stagenam = 'DTF6'
         MVSEnv   = 'TDB7'
       END
    When ENVIRON = 'T18' THEN
       DO
         stagenam = 'DTF7'
         MVSEnv   = 'TDB8'
       END
    When ENVIRON = 'T19' THEN
       DO
         stagenam = 'DTF8'
         MVSEnv   = 'TDB9'
       END
    When ENVIRON = 'T1A' THEN
       DO
         stagenam = 'DTFA'
         MVSEnv   = 'TDBI'
       END
    When ENVIRON = 'T1B' THEN
       DO
         stagenam = 'DTFB'
         MVSEnv   = 'TDBJ'
       END
    When ENVIRON = 'T1C' THEN
       DO
         stagenam = 'DTFC'
         MVSEnv   = 'TDBK'
       END
    When ENVIRON = 'T1D' THEN
       DO
         stagenam = 'DTFD'
         MVSEnv   = 'TDBL'
       END
    When ENVIRON = 'T1Z' THEN
       DO
         stagenam = 'GLF1'
         MVSEnv   = 'TDBZ'
       END
    Otherwise
          DO
            SAY '****************************************'
            SAY '***** INVALID ENVIRONMENT SELECTED *****'
            SAY '*****      T11 - T12, T13, T14     *****'
            SAY '*****      T15 - T16, T17, T18     *****'
            SAY '*****      T19 - T1A, T1B, T1C     *****'
            SAY '*****      T1D , T1Z               *****'
            SAY '****************************************'
            exit
          END
  End  /*...Select...*/

    return


 /*------------------------*/
   0300_Get_Element_Typ:
 /*------------------------*/
  say 'Enter CICS or STP: '
  pull ElementTyp
  ElementTyp = WORD(ElementTyp,1)
  Select
    When ElementTyp = 'CICS' THEN
       DO
         TarLib  = 'MCI.AD.TEST.MPS.CICS.PGMLIB'
         LibPick = 'DTF.IT.CICS.DTF6.PGMLIB'
       END
    When ElementTyp = 'STP' THEN
       DO
         TarLib  = 'MCI.AD.TEST.MPS.STPLIB'
         LibPick = 'DTF.IT.DTF6.STPLIB'
       END
    When ElementTyp = 'BATCH' THEN
       DO
         TarLib  = 'MCI.AD.TEST.MPS.PGMLIB'
         LibPick = 'DTF.IT.DTF6.STPLIB'
       END
    Otherwise
          DO
            SAY '****************************************'
            SAY '***** INVALID ELEMENT TYPE SELECTED ****'
            SAY '*****   Values are CICS or STP      ****'
            SAY '****************************************'
            exit
          END
  End  /*...Select...*/
    return

 /*------------------------*/
   0400_Get_From_Env:
 /*------------------------*/
  say 'Enter From Environment:'
  pull FromEnv
  FromEnv = WORD(FromEnv,1)
  Select
    When FromEnv = 'DTF' then
       DO
         FROMDBRM   = 'DTFOVRRD'
         if ElementTyp = 'CICS'  THEN
            LibPick = 'DTF.IT.CICS.PROD.PGMLIB'
         else
            LibPick = 'DTF.IT.PROD.STPLIB'
         if ElementTyp = 'BATCH' Then
            LibPick = 'DTF.IT.PROD.PGMLIB'
       END
    When FromEnv = 'T17' then
       DO
         FROMDBRM   = 'T17OVRRD'
         if ElementTyp = 'CICS'  THEN
            LibPick = 'DTF.IT.CICS.DTF6.PGMLIB'
         else
            LibPick = 'DTF.IT.DTF6.STPLIB'
         if ElementTyp = 'BATCH' Then
            LibPick = 'DTF.IT.DTF6.PGMLIB'
       END
    When FromEnv = 'ITF' then
       DO
         FROMDBRM   = 'ITFOVRRD'
         if ElementTyp = 'CICS'  THEN
            LibPick = 'ITF.IT.CICS.PROD.PGMLIB'
         else
            LibPick = 'ITF.IT.PROD.STPLIB'
         if ElementTyp = 'BATCH' Then
            LibPick = 'ITF.IT.PROD.PGMLIB'
       END
    When FromEnv = 'MTF' then
       DO
         FROMDBRM   = 'DTFOVRRD'
         if ElementTyp = 'CICS'  THEN
            LibPick = 'YTF.AD.CICS.PROD.PGMLIB'
         else
            LibPick = 'YTF.AD.PROD.STPLIB'
         if ElementTyp = 'BATCH' Then
            LibPick = 'YTF.AD.PROD.PGMLIB'
       END
    When FromEnv = 'PRD' then
       DO
         FROMDBRM   = 'PRDOVRRD'
         if ElementTyp = 'CICS'  THEN
            LibPick = 'MCI.AD.CICS.PROD.PGMLIB'
         else
            LibPick = 'MCI.AD.PROD.STPLIB'
         if ElementTyp = 'BATCH' Then
            LibPick = 'MCI.AD.PROD.PGMLIB'
       END
    Otherwise
          DO
            SAY '****************************************'
            SAY '***** INVALID ENVIRONMENT SELECTED *****'
            SAY '*****                              *****'
            SAY '***** Currently only T17, DTF, ITF *****'
            SAY '***** MTF AND PROD Allowed         *****'
            SAY '****************************************'
            exit
          END
  End  /*...Select...*/

    return

 /*------------------------*/
   2000_Write_Step:
 /*------------------------*/
   Address Isredit
   "x all"
   "del all x "
   "RESET"
   "Copy 'test.gp.mps32arc.ispslib(JOBCDBLD)' after 0"
   "RESET"
   " C all ??????? &User"
   " C all !!!!!! &User2"
   "F '//*BINDGENSTART'"
   "(LINENUM,COLNUM) = CURSOR"
   "CURSOR = (LINENUM,COLNUM)"
   Return

 /*------------------------*/
   3000_Write_Steps:
 /*------------------------*/

    I = 0
    if totcntr > 0 then
      do
        Call 3100_Write_Copy_Init
        Do I = 1 to totcntr
          Call 3200_Write_Copy_Mbrs
        End
        Call 3300_Write_Close
      End

    I = 0
    Do I = 1 to totcntr
      Call 3400_Write_Step_BindGen
    End

    I = 0
    if ElementTyp = 'CICS' then
     do
      if totcntr > 0 then
      do
        Call 3500_Write_NewC_Init
        Do I = 1 to totcntr
          Call 3600_Write_NewC_Mbrs
        End
        Call 3300_Write_Close
      End
     end

   return

 /*------------------------*/
   3100_Write_Copy_Init:
 /*------------------------*/

   temp = "//STEP010  EXEC PGM=IEBCOPY"
  ' LINE_AFTER  &LINENUM  = "'temp'"'
    Linenum = Linenum + 1

   temp = "//SYSPRINT  DD SYSOUT=*"
  ' LINE_AFTER  &LINENUM  = "'temp'"'
    Linenum = Linenum + 1

   temp = "//SYS001    DD DSN=&LibPick,DISP=SHR"
  ' LINE_AFTER  &LINENUM  = "'temp'"'
    Linenum = Linenum + 1

   temp = "//SYS201    DD DSN=&TarLib,DISP=SHR"
  ' LINE_AFTER  &LINENUM  = "'temp'"'
    Linenum = Linenum + 1

   temp = "//SYSUT3    DD UNIT=DISK,SPACE=(TRK,(1,1))"
  ' LINE_AFTER  &LINENUM  = "'temp'"'
    Linenum = Linenum + 1

   temp = "//SYSUT4    DD UNIT=DISK,SPACE=(TRK,(1,1))"
  ' LINE_AFTER  &LINENUM  = "'temp'"'
    Linenum = Linenum + 1
   temp = "//SYSIN    DD *"
  ' LINE_AFTER  &LINENUM  = "'temp'"'
    Linenum = Linenum + 1

   temp = "     COPY INDD=SYS001,OUTDD=SYS201"
  ' LINE_AFTER  &LINENUM  = "'temp'"'
    Linenum = Linenum + 1

   return


 /*------------------------*/
   3200_Write_Copy_Mbrs:
 /*------------------------*/
  Mbr = MbrNameArray.I
   temp = "     SELECT MEMBER=((&Mbr,,R))"
  ' LINE_AFTER  &LINENUM  = "'temp'"'
    Linenum = Linenum + 1
   return


 /*------------------------*/
   3300_Write_Close:
 /*------------------------*/
   temp = "/*"
  ' LINE_AFTER  &LINENUM  = "'temp'"'
    Linenum = Linenum + 1
   return


 /*------------------------*/
   3400_Write_Step_BindGen:
 /*------------------------*/
   Address Ispexec
   PGMNAME = '&PGMNAME'
   Mbr = MbrNameArray.I
   Address Isredit
   temp = "//BINDGEN  EXEC PBINDSPD,"
  ' LINE_AFTER  &LINENUM  = "'temp'"'
    Linenum = Linenum + 1

   temp = "//         PGMNAME='&Mbr',"
  ' LINE_AFTER  &LINENUM  = "'temp'"'
    Linenum = Linenum + 1

   temp = "//         STAGENAM='&Stagenam',"
  ' LINE_AFTER  &LINENUM  = "'temp'"'
    Linenum = Linenum + 1

   temp = "//         TSOLOGON='&User',"
  ' LINE_AFTER  &LINENUM  = "'temp'"'
    Linenum = Linenum + 1

   temp = '//         APPLSYS='GP','
  ' LINE_AFTER  &LINENUM  = "'temp'"'
    Linenum = Linenum + 1

   temp = '//         APPLSUB='GP','
  ' LINE_AFTER  &LINENUM  = "'temp'"'
    Linenum = Linenum + 1

 temp = "//         DUALBIND='XXXXXXXX',"
  ' LINE_AFTER  &LINENUM  = "'temp'"'
    Linenum = Linenum + 1

 temp = "//         PROCGROP='CO3PD   '"
  ' LINE_AFTER  &LINENUM  = "'temp'"'
    Linenum = Linenum + 1

 temp = "//BINDGEN.PKGTYPE "
 temp = temp || "DD DSN=TEST.GP.MPS52ARC.BIND.PKG(&PGMNAME),"
  ' LINE_AFTER  &LINENUM  = "'temp'"'
    Linenum = Linenum + 1
 temp = "//        DISP=SHR"
  ' LINE_AFTER  &LINENUM  = "'temp'"'
    Linenum = Linenum + 1

 if ElementTyp = 'STP' then
   do
      temp = "//BINDGEN.STPTYPE "
      temp = temp || "DD DSN=TEST.GP.MPS52ARC.BIND.STP(&PGMNAME),"
       ' LINE_AFTER  &LINENUM  = "'temp'"'
         Linenum = Linenum + 1

      temp = "//        DISP=SHR"
       ' LINE_AFTER  &LINENUM  = "'temp'"'
         Linenum = Linenum + 1
   end

 temp = "//BINDGEN.OVERIDE DD DISP=SHR,"
 temp = temp || "DSN=TEST.GP.MPS52ARC.MSTR.PKG(&FROMDBRM)"
  ' LINE_AFTER  &LINENUM  = "'temp'"'
     Linenum = Linenum + 1

  temp = "//*"
   ' LINE_AFTER  &LINENUM  = "'temp'"'
     Linenum = Linenum + 1

   return

/*------------------------*/
  3500_Write_NewC_Init:
/*------------------------*/
 temp = "//STEP010  EXEC PGM=MTPBATCH"
   ' LINE_AFTER  &LINENUM  = "'temp'"'
     Linenum = Linenum + 1

 temp = "//SYSLST    DD SYSOUT=*"
   ' LINE_AFTER  &LINENUM  = "'temp'"'
     Linenum = Linenum + 1
 temp = "//SYSUDUMP  DD SYSOUT=D"
   ' LINE_AFTER  &LINENUM  = "'temp'"'
     Linenum = Linenum + 1

 temp = "//BATCNTL   DD DSN=MCI1.TS.CEMTR50.BATCH.CNTL,DISP=SHR"
   ' LINE_AFTER  &LINENUM  = "'temp'"'
     Linenum = Linenum + 1

 temp = "//SYSIPT    DD *"
   ' LINE_AFTER  &LINENUM  = "'temp'"'
     Linenum = Linenum + 1

 temp = "CICS &MVSENV"
   ' LINE_AFTER  &LINENUM  = "'temp'"'
     Linenum = Linenum + 1

   return
  /*------------------------*/
    3600_Write_NewC_Mbrs:
  /*------------------------*/
   Mbr = MbrNameArray.I
    temp = "CEMT SET PROGRAM (&Mbr) NEWCOPY"
   ' LINE_AFTER  &LINENUM  = "'temp'"'
     Linenum = Linenum + 1

    return


/*------------------------*/
  4000_Check_load_dt:
/*------------------------*/
  Address Ispexec
  dataisfound = 'N'
     ISPEXEC "LMMFIND DATAID("D1") MEMBER("MbrName")"
     If RC <> 0 Then say 'LMFIND Return code = ' || rc
      Do While RC = 0
       ISPEXEC "LMGET DATAID("D1") MODE(INVAR) DATALOC(RECLOC)
       DATALEN(RECLEN) MAXLEN(300)"
       If RC <> 0 Then
       say 'LMGET Return code = ' || rc || ' - ' || MbrName
       if dataisfound = 'N' then
         do
           do j = 1 to length(recloc)
              curtxt =  substr(recloc, j, 11)
              if curtxt = searchingfor then
                do
                  founddate = substr(recloc, j+8, 14)
                  dataisfound = 'Y'
                  J = length(recloc)
                  rc = 99
                end
           end
         End
     End
   return

/*------------------------*/
  4005_init_DSN:
/*------------------------*/

     address ispexec

     DSN = "'" || LibPick || "'"

     DSN_PATH = "LMINIT DATAID(D1) DATASET(" || DSN || ")"

     ISPEXEC DSN_PATH
     If RC <> 0 Then
     say 'LMINIT Return code = ' || rc || ' - ' || MbrName

     ISPEXEC "LMOPEN DATAID("D1") OPTION(INPUT) RECFM(FB)"
     If RC <> 0 Then
     say 'LMOPEN Return code = ' || rc || ' - ' || MbrName
Return
------------------------


Thnaks
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2358
Location: Israel

PostPosted: Wed Aug 22, 2007 10:42 am
Reply with quote

Can you run it with TRACE I?

O.
Back to top
View user's profile Send private message
yamaha

New User


Joined: 21 Aug 2007
Posts: 4
Location: india

PostPosted: Wed Aug 22, 2007 12:10 pm
Reply with quote

Hi,

I ahve used TRACE I,but it si going on executing each line

461 *-* Linenum = Linenum + 1,
>V> "68",
>L> "1",
>O> "69",
463 *-* temp = "//BINDGEN.PKGTYPE ",
>L> "//BINDGEN.PKGTYPE ",
464 *-* temp = temp || "DD DSN=TEST.GP.MPS51ARC.BIND.PKG(&PGMNAME),",
>V> "//BINDGEN.PKGTYPE ",
>L> "DD DSN=TEST.GP.MPS51ARC.BIND.PKG(&PGMNAME),",
>O> "//BINDGEN.PKGTYPE DD DSN=TEST.GP.MPS51ARC.BIND.PKG(&PGMNAME
465 *-* ' LINE_AFTER &LINENUM = "'temp'"',
>L> " LINE_AFTER &LINENUM = "",
>V> "//BINDGEN.PKGTYPE DD DSN=TEST.GP.MPS51ARC.BIND.PKG(&PGMNAME
>O> " LINE_AFTER &LINENUM = "//BINDGEN.PKGTYPE DD DSN=TEST.GP.
51ARC.BIND.PKG(&PGMNAME),",
>L> """,
>O> " LINE_AFTER &LINENUM = "//BINDGEN.PKGTYPE DD DSN=TEST.GP.
***
--------------------------

let me know
Thanks
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2358
Location: Israel

PostPosted: Wed Aug 22, 2007 12:11 pm
Reply with quote

You can read about TRACE in the fine manual.

Then, add a TRACE to your REXX and run it again. It will show you valuable information.

O.
Back to top
View user's profile Send private message
yamaha

New User


Joined: 21 Aug 2007
Posts: 4
Location: india

PostPosted: Wed Aug 22, 2007 12:16 pm
Reply with quote

Hi,

It is showing in this manner.i have read the TRACE I command and ran it.The follwoing is the output it is showing.

------------------------
+++ RC(20) +++,
470 *-* Linenum = Linenum + 1,
>V> "70",
>L> "1",
>O> "71",
472 *-* if ElementTyp = 'STP',
>V> "STP",
>L> "STP",
>O> "1",
**
--------------------------------

Thankyou so much for ur quick help and guide.Pls let me know.
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2358
Location: Israel

PostPosted: Wed Aug 22, 2007 1:17 pm
Reply with quote

You can put "TRACE I" and "TRACE OFF" around suspected lines (like the lines that create the dataset, write into it, or save it).

O.
Back to top
View user's profile Send private message
yamaha

New User


Joined: 21 Aug 2007
Posts: 4
Location: india

PostPosted: Wed Aug 22, 2007 2:37 pm
Reply with quote

Hi,

After executing the code i am getting in this manner,but in backend ii is not creating the JCL's.Let me know.
-----------------------------------------
Enter CICS or STP:
STP ( I ENTERED)
Enter From Environment:

***

T17

,Enter Target Environment:,

T16

,Enter Date (yyyymmdd):,

20070812

,DSN_PATH LMINIT DATAID(D1) DATASET('DTF.IT.DTF6.STPLIB'),

,GPCLOBSP 20031112181523 - OK,

,GPSAMPLE 20070725072709 - OK,

,LMGET Return code = 8 - GP0TEST,

,GP001020 20070426040808 - OK,

,GP001030 20070430063940 - OK,

,GP001040 20070607133359 - OK,

,GP001110 20060406042657 - OK,

,GP001390 20070706022135 - OK,

,GP001430 20060427083829 - OK,

,GP001540 20061229134820 - OK,

,GP001570 20060310081158 - OK,

,GP001610 20060301215818 - OK,

,GP001650 20070529163431 - OK,

,GP001720 20060328041705 - OK,

,GP001730 20060503114854 - OK,

,GP001840 20060525233318 - OK,

,GP001850 20060324153037 - OK,

GP03567M 20070515105120 - OK,

LMGET Return code = 8 - GP03567R

GP035670 20070523005321 - OK,

GP035750 20060615140650 - OK,

GP037410 20070813062603 20070812

GP037420 20060214232340 - OK,

GP037430 20060222100053 - OK,

GP037440 20070503101434 - OK,

GP037450 20060405153619 - OK,

GP037460 20060920070306 - OK,

GP980780 20070119172654 - OK

3000_Write_Steps,

linenum= 0,

,

Total records written = 9,

--------------------------------------------

Please let me know if any ideas.

Thanks
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 Using API Gateway from CICS program CICS 0
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 isfline didnt work in rexx at z/OS ve... CLIST & REXX 7
Search our Forums:

Back to Top