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: ---*/
/*------------------*/
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
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
/*------------------------*/
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
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: