Page 1 of 4

How to pass input from Rexx to JCL

PostPosted: Mon Mar 25, 2013 4:38 pm
by Sonal C
Hi,

I tried to search on this topic in google but couldn't find any sample of JCL.

I have piece of rexx code as:

/*REXX*/
Say "enter your name:"
pull name
Ref_JCL:
ADDRESS TSO
"Submit 'ABCD.JCLLIB(REFJCL)' "


My Requirement:

I have to pass the input NAME from this rexx to a JCL, which will show the output in SPOOL.

My Doubts:
1) Tried to use Utility as IRXJCL, job failed with MAXCC=3637
2) Tried to use Utility IEBGENER, job failed with MAXCC=12 and out was wrong
3) Tried to use Utility IEFBR14, job ran with MAXCC-0 but no output in Spool

Please help me in understansing how shall I pass input from Rexx to JCL

Thanks
Sonal

Re: How to pass input from Rexx to JCL

PostPosted: Mon Mar 25, 2013 6:51 pm
by enrico-sorichetti
google and search the forum examples of ISPF FILE TAILORING
FTINCL is the buzzword

here ( this forum )

or here http://ibmmainframes.com

and here a direct link to a working snippet
http://ibmmainframes.com/about55549.html

Re: How to pass input from Rexx to JCL

PostPosted: Tue Mar 26, 2013 5:51 pm
by Sonal C
Thank you for your reply Enrico.

I tried to go through the Snippet present in link given by you, but couldnt understand it.

Can you please help me in understanding the syntax of passing variable values from Rexx to JCL?

any simple syntax or code for a line or 2.

Regards,
Sonal

Re: How to pass input from Rexx to JCL

PostPosted: Tue Mar 26, 2013 6:20 pm
by Robert Sample
any simple syntax or code for a line or 2.
Not everything people want to do on a mainframe can be handled so easily. Sometimes there is a lot of set up and background processing required. Many times people compare the task to doing the same thing on a PC, but there's no real comparison -- IBM mainframes have almost 50 years of development history and function entirely differently (architecture is different, screen processing is different, I/O is different, ..) than a PC.

Re: How to pass input from Rexx to JCL

PostPosted: Tue Mar 26, 2013 6:27 pm
by Sonal C
I want to have understatnding on the topic. If you will put any simple syntax I will try to modify it according to my requirement.

That's why I had asked you to give a sample code which will help me in understand the functinality.

Since I am beginner in Rexx I feel I should go step by step.

Regards,
Sonal

Re: How to pass input from Rexx to JCL

PostPosted: Tue Mar 26, 2013 6:39 pm
by NicC
What you are wanting to do is not beginner's Rexx/ISPF. But it is doable if you study the manual along with the snippet linked to by Enrico and look at samples in the forum.

Re: How to pass input from Rexx to JCL

PostPosted: Tue Mar 26, 2013 6:49 pm
by Sonal C
I have already posted REXX code. Now I am giving the jcl which will be called by Rexx.

//JOBA JOB ,CLASS=B,MSGCLASS=A
//STEP01 EXEC PGM=IKJEFT01,DYNAMNBR=30
//SYSPRINT DD SYSOUT=*
//SYSEXEC DD DISP=SHR,DSN=MYREXX PDS
//SYSTSPRT DD SYSOUT=*
//SYSTSIN DD *
&name
/*
//

Let me know if I am doing it correctly? &name is correct way of taking input from Rexx or not?

The variable name name is same which I am using in Rexx.

Regards,
Sonal

Re: How to pass input from Rexx to JCL

PostPosted: Tue Mar 26, 2013 6:53 pm
by NicC
Why do you not read the manual as requested and study the snippets. Yes &name will work IF you are using file tailoring to edit the job.

Re: How to pass input from Rexx to JCL

PostPosted: Tue Mar 26, 2013 7:32 pm
by enrico-sorichetti
OK, the snippet I pointed to was/is a bit sophisticated for a beginner

but since I am in a good mood here is a simpler snippet ( TESTED naturally )

the REXX SCRIPT
/*REXX - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
/*                                                                   */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
Trace "O"

Parse Source _sys _how _cmd .

If Sysvar(SYSISPF) /= "ACTIVE" Then Do
   Say left(_cmd,8)"- Ispf is not active. Command not executed"
   Exit 4
End
call $ispex "CONTROL ERRORS RETURN"

display  = "DISPLAY PANEL(MFTEST1)"
do while ($ispex("DISPLAY PANEL(MFTEST1)") = 0 )
   call  $ispex "FTCLOSE"
   zRC = $ispex("FTOPEN TEMP")
   if zRC /= 0   then do
       zerrsm = "FTOPEN ERROR"
       zerrlm = left(_cmd,8)"- FTOPEN RC("zRC")"
       call   $ispex "SETMSG MSG(ISRZ001) "
       iterate
   end
   zRC = $ispex("FTINCL MFTEST1")
   if zRC /= 0   then do
       zerrsm = "FTINCL ERROR"
       zerrlm = left(_cmd,8)"- FTINCL RC("zRC")"
       call   $ispex "SETMSG MSG(ISRZ001) "
       iterate
   end
   zRC = $ispex("FTCLOSE")
   if zRC /= 0   then do
       zerrsm = "FTCLOSE ERROR"
       zerrlm = left(_cmd,8)"- FTCLOSE RC("zRC")"
       call   $ispex "SETMSG MSG(ISRZ001) "
       iterate
   end
   call $ispex "VGET ZTEMPF"
   call $ispex "VIEW DATASET('"ZTEMPF"') "
end


Exit

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
/*                                                                   */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
$tsoex:
   tso_0tr = trace("O")
   Address TSO arg(1)
   tso_0rc = rc
   trace value(tso_0tr)
   return tso_0rc

/*REXX - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
/*                                                                   */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
$ispex:
   isp_0tr = trace("O")
   Address ISPEXEC arg(1)
   isp_0rc = rc
   trace value(isp_0tr)
   return isp_0rc

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
/*                                                                   */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
$isred:
   isr_0tr = trace("O")
   Address ISREDIT arg(1)
   isr_0rc = rc
   trace value(isr_0tr)
   return isr_0rc



the PANEL
)ATTR DEFAULT(%+_)
      /*  % TYPE(TEXT) INTENS(HIGH)      defaults displayed for      */
      /*  + TYPE(TEXT) INTENS(LOW)       information only            */
      /*  _ TYPE(INPUT) INTENS(HIGH) CAPS(ON) JUST(LEFT)             */
  $ TYPE(INPUT) INTENS(LOW) PAD(_)    /* input field padded with '_' */
  ! TYPE(INPUT) INTENS(LOW) PAD(' ')  /* input field padded with ' ' */
)BODY
%--------------------  TITLE FOR ENTRY PANEL  --------------------------
%COMMAND ===>_ZCMD
%
+                  1         2         3         4         5
+      12345678901234567890123456789012345678901234567890123456
+   1 !var1                                                    +
+   2 !var2                                                    +
+   3 !var3                                                    +
+   3 !var4                                                    +
+
)INIT
&var1='something'
)PROC
)END


The SKEL
//XXXXXXXX JOB (TEST),'MFTEST1',NOTIFY=XXXXXXXX
//             CLASS=A,MSGCLASS=X,MSGLEVEL=(1,1)
//* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
//*
//* VAR1 = &VAR1
//* VAR2 = &VAR2
//* VAR3 = &VAR3
//* VAR4 = &VAR4
//*
//G       EXEC PGM=IEFBR14

Re: How to pass input from Rexx to JCL

PostPosted: Tue Mar 26, 2013 7:43 pm
by MrSpock
This would be my solution:

/* REXX */                                         
Say "Enter Name"                                   
Parse Pull name .                                 
Queue "TOP"                                       
Queue "C * 999999 /&name/"name"/"                 
Queue "TOP"                                       
Queue "END SAVE"                                   
"EDIT 'ABCD.JCLLIB(REFJCL)' OLD TEXT NONUM"             
"SUBMIT 'ABCD.JCLLIB(REFJCL)'"                         
Exit 0