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

Execute simple Rexx Program


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

New User


Joined: 10 Feb 2006
Posts: 10
Location: Bangalore

PostPosted: Wed Jul 20, 2011 7:41 pm
Reply with quote

I am learning Rexx. This is the first program.

I was trying out to execute the rexx program as below,

***************************** Top of Data ******************************
000100 the_number = random(1,10)
000200 say 'i am thinking of number between 1 to 10.what is it?'
000300 pull the_guess
000400 if the_number = the_guess then
000500 say 'u guessed it!'
000600 else
000700 say 'sorry. My number was:' the_number
000800 say 'BYE!'
**************************** Bottom of Data ****************************

The jcl used to execute is

//JS10 EXEC PGM=IRXJCL,REGION=0K,PARM='REXXPGM'
//SYSEXEC DD DSN=XXX.XXX.Dataset,DISP=SHR
//SYSTSPRT DD SYSOUT=*
//SYSTSIN DD DUMMY,BLKSIZE=80

I have the rexx program mentioned above in the PDS XXX.XXX.Dataset


When i ran the job the job completed with Maxcc= 0 and in the sysout it displayed
***************************** TOP OF DATA *******************************
1 *-* 000100 the_number = random(1,10)
+++ RC(-3) +++
2 *-* 000200 say 'i am thinking of number between 1 to 10.what is it?'
+++ RC(-3) +++
3 *-* 000300 pull the_guess
+++ RC(-3) +++
4 *-* 000400 if the_number = the_guess then
+++ RC(-3) +++
5 *-* 000500 say 'u guessed it!'
+++ RC(-3) +++
6 *-* 000600 else
+++ RC(-3) +++
7 *-* 000700 say 'sorry. My number was:' the_number
+++ RC(-3) +++
8 *-* 000800 say 'BYE!'
+++ RC(-3) +++
**************************** BOTTOM OF DATA *****************************

But this was not actually what i was expecting. I expected that it would ask me to enter the number and compare then display the statement depending on if condition. Could anyone please help me what changes i need to do so that i could get the desired output.
Back to top
View user's profile Send private message
Garry Carroll

Senior Member


Joined: 08 May 2006
Posts: 1193
Location: Dublin, Ireland

PostPosted: Wed Jul 20, 2011 7:47 pm
Reply with quote

Quote:
I am learning Rexx.


Yes, but the first thing you should have learnt is that every REXX program must begin with a comment that includes the word REXX - e.g.
Code:
 /* REXX */


Also, you should have a RETURN statement a the eed of your code.

Garry.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed Jul 20, 2011 7:59 pm
Reply with quote

when running in batch You should be aware that You must <stack> the input after the systsin dd

here is the REXX


Code:
 EDIT       ENRICO.ISPF.EXEC(ZTEST) - 01.02                 Columns 00001 00072
 Command ===>                                                  Scroll ===> CSR 
 ****** ***************************** Top of Data ******************************
 000001 /*REXX - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 000002 /*                                                                   */
 000003 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 000004 Trace "O"                                                               
 000005                                                                         
 000006 Parse Source _sys _how _cmd .                                           
 000007                                                                         
 000008 say "enter something"                                                   
 000009 parse pull somethng                                                     
 000010 say "You entered   :"somethng                                           
 000011 Exit 0                                                                 
 000012                                                                         
 ****** **************************** Bottom of Data ****************************


the irxjcl
Code:
 ****** ***************************** Top of Data ******************************
 000001 //ENRICO1  JOB NOTIFY=&SYSUID,                                         
 000002 //             REGION=0M,                                               
 000003 //             MSGLEVEL=(1,1),CLASS=A,MSGCLASS=X                       
 000004 //*                                                                     
 000005 //IRX     EXEC PGM=IRXJCL,PARM=ZTEST                                   
 000006 //SYSEXEC   DD DISP=SHR,DSN=ENRICO.ISPF.EXEC                           
 000007 //SYSPRINT  DD SYSOUT=*                                                 
 000008 //SYSTSPRT  DD SYSOUT=*                                                 
 000009 //SYSTSIN   DD *                                                       
 000010 AAAAAAAAAAA                                                             
 ****** **************************** Bottom of Data ****************************

the output
Code:
********************************* TOP OF DATA **********************************
                         J E S 2  J O B  L O G  --  S Y S T E M  S Y S 1  --  N
                                                                               
16.22.29 JOB02696 ---- WEDNESDAY, 20 JUL 2011 ----                             
16.22.29 JOB02696  IRR010I  USERID ENRICO   IS ASSIGNED TO THIS JOB.           
16.22.29 JOB02696  ICH70001I ENRICO   LAST ACCESS AT 16:21:23 ON WEDNESDAY, JULY
16.22.29 JOB02696  $HASP373 ENRICO1  STARTED - INIT 1    - CLASS A - SYS SYS1   
16.22.29 JOB02696  IEF403I ENRICO1 - STARTED - TIME=16.22.29                   
16.22.29 JOB02696  IEF404I ENRICO1 - ENDED - TIME=16.22.29                     
16.22.29 JOB02696  $HASP395 ENRICO1  ENDED                                     
------ JES2 JOB STATISTICS ------                                               
  20 JUL 2011 JOB EXECUTION DATE                                               
           10 CARDS READ                                                       
           44 SYSOUT PRINT RECORDS                                             
            0 SYSOUT PUNCH RECORDS                                             
            2 SYSOUT SPOOL KBYTES                                               
         0.00 MINUTES EXECUTION TIME                                           
        1 //ENRICO1  JOB NOTIFY=&SYSUID,                                       
          //             REGION=0M,                                             
          //             MSGLEVEL=(1,1),CLASS=A,MSGCLASS=X
          //*                                                                   
          IEFC653I SUBSTITUTION JCL - NOTIFY=ENRICO,REGION=0M,MSGLEVEL=(1,1),CLA
        2 //IRX     EXEC PGM=IRXJCL,PARM=ZTEST                                 
        3 //SYSEXEC   DD DISP=SHR,DSN=ENRICO.ISPF.EXEC                         
        4 //SYSPRINT  DD SYSOUT=*                                               
        5 //SYSTSPRT  DD SYSOUT=*                                               
        6 //SYSTSIN   DD *                                                     
ICH70001I ENRICO   LAST ACCESS AT 16:21:23 ON WEDNESDAY, JULY 20, 2011         
IEF236I ALLOC. FOR ENRICO1 IRX                                                 
IEF237I 0AB4 ALLOCATED TO SYSEXEC                                               
IEF237I JES2 ALLOCATED TO SYSPRINT                                             
IEF237I JES2 ALLOCATED TO SYSTSPRT                                             
IEF237I JES2 ALLOCATED TO SYSTSIN                                               
IEF142I ENRICO1 IRX - STEP WAS EXECUTED - COND CODE 0000                       
IEF285I   ENRICO.ISPF.EXEC                             KEPT                     
IEF285I   VOL SER NOS= STOR04.                                                 
IEF285I   ENRICO.ENRICO1.JOB02696.D0000102.?           SYSOUT                   
IEF285I   ENRICO.ENRICO1.JOB02696.D0000103.?           SYSOUT                   
IEF285I   ENRICO.ENRICO1.JOB02696.D0000101.?           SYSIN                   
IEF373I STEP/IRX     /START 2011201.1622                                       
IEF374I STEP/IRX     /STOP  2011201.1622 CPU    0MIN 00.07SEC SRB    0MIN 00.00S
IEF375I  JOB/ENRICO1 /START 2011201.1622                                       
IEF376I  JOB/ENRICO1 /STOP  2011201.1622 CPU    0MIN 00.07SEC SRB    0MIN 00.00S
enter something                                                                 
You entered   :AAAAAAAAAAA                                                     
******************************** BOTTOM OF DATA ********************************


the ikjeft jcl
Code:
 ****** ***************************** Top of Data ******************************
 000001 //ENRICO1  JOB NOTIFY=&SYSUID,                                         
 000002 //             REGION=0M,                                               
 000003 //             MSGLEVEL=(1,1),CLASS=A,MSGCLASS=X                       
 000004 //*                                                                     
 000005 //IKJ     EXEC PGM=IKJEFT1A,PARM=ZTEST                                 
 000006 //SYSPROC   DD DISP=SHR,DSN=ENRICO.ISPF.EXEC                           
 000007 //SYSPRINT  DD SYSOUT=*                                                 
 000008 //SYSTSPRT  DD SYSOUT=*                                                 
 000009 //SYSTSIN   DD *                                                       
 000010 AAAAAAAAAAA                                                             
 ****** **************************** Bottom of Data ****************************

the output
Code:
********************************* TOP OF DATA **********************************
                         J E S 2  J O B  L O G  --  S Y S T E M  S Y S 1  --  N
                                                                               
16.21.23 JOB02695 ---- WEDNESDAY, 20 JUL 2011 ----                             
16.21.23 JOB02695  IRR010I  USERID ENRICO   IS ASSIGNED TO THIS JOB.           
16.21.23 JOB02695  ICH70001I ENRICO   LAST ACCESS AT 15:15:53 ON WEDNESDAY, JULY
16.21.23 JOB02695  $HASP373 ENRICO1  STARTED - INIT 1    - CLASS A - SYS SYS1   
16.21.23 JOB02695  IEF403I ENRICO1 - STARTED - TIME=16.21.23                   
16.21.23 JOB02695  IEF404I ENRICO1 - ENDED - TIME=16.21.23                     
16.21.23 JOB02695  $HASP395 ENRICO1  ENDED                                     
------ JES2 JOB STATISTICS ------                                               
  20 JUL 2011 JOB EXECUTION DATE                                               
           10 CARDS READ                                                       
           46 SYSOUT PRINT RECORDS                                             
            0 SYSOUT PUNCH RECORDS                                             
            2 SYSOUT SPOOL KBYTES                                               
         0.00 MINUTES EXECUTION TIME                                           
        1 //ENRICO1  JOB NOTIFY=&SYSUID,                                       
          //             REGION=0M,                                             
          //             MSGLEVEL=(1,1),CLASS=A,MSGCLASS=X                     
          //*                                                                   
          IEFC653I SUBSTITUTION JCL - NOTIFY=ENRICO,REGION=0M,MSGLEVEL=(1,1),CLA
        2 //IKJ     EXEC PGM=IKJEFT1A,PARM=ZTEST                               
        3 //SYSPROC   DD DISP=SHR,DSN=ENRICO.ISPF.EXEC                         
        4 //SYSPRINT  DD SYSOUT=*                                               
        5 //SYSTSPRT  DD SYSOUT=*                                               
        6 //SYSTSIN   DD *                                                     
ICH70001I ENRICO   LAST ACCESS AT 15:15:53 ON WEDNESDAY, JULY 20, 2011         
IEF236I ALLOC. FOR ENRICO1 IKJ                                                 
IEF237I 0AB4 ALLOCATED TO SYSPROC                                               
IEF237I JES2 ALLOCATED TO SYSPRINT                                             
IEF237I JES2 ALLOCATED TO SYSTSPRT                                             
IEF237I JES2 ALLOCATED TO SYSTSIN                                               
IEF142I ENRICO1 IKJ - STEP WAS EXECUTED - COND CODE 0000                       
IEF285I   ENRICO.ISPF.EXEC                             KEPT                     
IEF285I   VOL SER NOS= STOR04.                                                 
IEF285I   ENRICO.ENRICO1.JOB02695.D0000102.?           SYSOUT                   
IEF285I   ENRICO.ENRICO1.JOB02695.D0000103.?           SYSOUT                   
IEF285I   ENRICO.ENRICO1.JOB02695.D0000101.?           SYSIN                   
IEF373I STEP/IKJ     /START 2011201.1621                                       
IEF374I STEP/IKJ     /STOP  2011201.1621 CPU    0MIN 00.13SEC SRB    0MIN 00.00S
IEF375I  JOB/ENRICO1 /START 2011201.1621                                       
IEF376I  JOB/ENRICO1 /STOP  2011201.1621 CPU    0MIN 00.13SEC SRB    0MIN 00.00S
enter something                                                                 
You entered   :AAAAAAAAAAA                                                     
READY                                                                           
END                                                                             
******************************** BOTTOM OF DATA ********************************


Back to top
View user's profile Send private message
pratiksha
Warnings : 1

New User


Joined: 10 Feb 2006
Posts: 10
Location: Bangalore

PostPosted: Wed Jul 20, 2011 8:04 pm
Reply with quote

I added the /*REXX*/

Now i get as below in sysout.

********************************* TOP OF DATA *****************
i am thinking of number between 1 to 10.what is it?
sorry. My number was: 4
BYE!
******************************** BOTTOM OF DATA ***************

I wanted it to allow me to enter a number the_guess and then compare the_guess with the_number and then display as per the If condition. Could any one suggest changes.

Thanks & Regards,
Pratiksha
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed Jul 20, 2011 8:07 pm
Reply with quote

for what reason should we waste our time in replying and posting tested advice and snippets
when You/people do not effing care to read and try to understand the replies given icon_evil.gif

when running in batch You should be aware that You must <stack> the input after the systsin dd

I posted a snippet which does a parse pull, displays the <input> received
the two jobstreams used to run the silly snippet
the two full outputs from the execution

if You cannot read and understand the suggestions received
it would be wiser to meditate a career shift to a less demanding job icon_cool.gif
Back to top
View user's profile Send private message
Garry Carroll

Senior Member


Joined: 08 May 2006
Posts: 1193
Location: Dublin, Ireland

PostPosted: Wed Jul 20, 2011 8:11 pm
Reply with quote

pratiksha wrote:
I added the /*REXX*/

Now i get as below in sysout.

********************************* TOP OF DATA *****************
i am thinking of number between 1 to 10.what is it?
sorry. My number was: 4
BYE!
******************************** BOTTOM OF DATA ***************

I wanted it to allow me to enter a number the_guess and then compare the_guess with the_number and then display as per the If condition. Could any one suggest changes.

Thanks & Regards,
Pratiksha


But you're trying to run this as a batch job via JCL (which I didn't pick up on your first post). You don't get the opportunity to interface via display when running batch. Try executing the REXX from TSO command line to be interactive or else provide the_guess from SYSTSIN (stakced, as enrico suggested).

Garry.
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Wed Jul 20, 2011 8:56 pm
Reply with quote

Garry Carroll wrote:
Quote:
I am learning Rexx.


Yes, but the first thing you should have learnt is that every REXX program must begin with a comment that includes the word REXX - e.g.
Code:
 /* REXX */


Also, you should have a RETURN statement a the eed of your code.

Garry.


As far as i know, rexx execs in SYSEXEC dont need a REXX comment line,
for SYSPROC there is a difference because TSO/E needs to know if its processing a REXX or a CLIST.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed Jul 20, 2011 9:05 pm
Reply with quote

I opt to differ ...

the first post reported errors are due to the presence of numbers...

REXX executed the IRXJCL does not need the /* REXX */ comment

too lazy to look at the manual, faster to test icon_biggrin.gif

the jcl
Code:
 ****** ***************************** Top of Data ******************************
 000001 //ENRICO1  JOB NOTIFY=&SYSUID,                                         
 000002 //             REGION=0M,                                               
 000003 //             MSGLEVEL=(1,1),CLASS=A,MSGCLASS=X                       
 000004 //*                                                                     
 000005 //IEB     EXEC PGM=IEBGENER                                             
 000006 //SYSUT1    DD DISP=SHR,DSN=ENRICO.ISPF.EXEC(ZTEST)                     
 000007 //SYSUT2    DD SYSOUT=*                                                 
 000008 //SYSPRINT  DD SYSOUT=*                                                 
 000009 //SYSIN     DD DUMMY                                                   
 000010 //*                                                       
 000011 //IRX     EXEC PGM=IRXJCL,PARM=ZTEST                                   
 000012 //SYSEXEC   DD DISP=SHR,DSN=ENRICO.ISPF.EXEC                           
 000013 //SYSPRINT  DD SYSOUT=*                                                 
 000014 //SYSTSPRT  DD SYSOUT=*                                                 
 000015 //SYSTSIN   DD *                                                       
 000016 AAAAAAAAAAA                                                             
 ****** **************************** Bottom of Data ****************************



the result
Code:
********************************* TOP OF DATA **********************************
                         J E S 2  J O B  L O G  --  S Y S T E M  S Y S 1  --  N
                                                                               
17.28.07 JOB02703 ---- WEDNESDAY, 20 JUL 2011 ----                             
17.28.07 JOB02703  IRR010I  USERID ENRICO   IS ASSIGNED TO THIS JOB.           
17.28.07 JOB02703  ICH70001I ENRICO   LAST ACCESS AT 17:26:50 ON WEDNESDAY, JULY
17.28.07 JOB02703  $HASP373 ENRICO1  STARTED - INIT 1    - CLASS A - SYS SYS1   
17.28.07 JOB02703  IEF403I ENRICO1 - STARTED - TIME=17.28.07                   
17.28.07 JOB02703  IEF404I ENRICO1 - ENDED - TIME=17.28.07                     
17.28.07 JOB02703  $HASP395 ENRICO1  ENDED                                     
------ JES2 JOB STATISTICS ------                                               
  20 JUL 2011 JOB EXECUTION DATE                                               
           16 CARDS READ                                                       
           77 SYSOUT PRINT RECORDS                                             
            0 SYSOUT PUNCH RECORDS                                             
            4 SYSOUT SPOOL KBYTES                                               
         0.01 MINUTES EXECUTION TIME                                           
        1 //ENRICO1  JOB NOTIFY=&SYSUID,                                       
          //             REGION=0M,                                             
          //             MSGLEVEL=(1,1),CLASS=A,MSGCLASS=X                     
          //*                                                                   
          IEFC653I SUBSTITUTION JCL - NOTIFY=ENRICO,REGION=0M,MSGLEVEL=(1,1),CLA
        2 //IEB     EXEC PGM=IEBGENER                                           
        3 //SYSUT1    DD DISP=SHR,DSN=ENRICO.ISPF.EXEC(ZTEST)                   
        4 //SYSUT2    DD SYSOUT=*                                               
        5 //SYSPRINT  DD SYSOUT=*                                               
        6 //SYSIN     DD DUMMY                                                 
        7 //SYSIN     DD *               GENERATED STATEMENT                   
        8 //IRX     EXEC PGM=IRXJCL,PARM=ZTEST                                 
        9 //SYSEXEC   DD DISP=SHR,DSN=ENRICO.ISPF.EXEC                         
       10 //SYSPRINT  DD SYSOUT=*                                               
       11 //SYSTSPRT  DD SYSOUT=*                                               
       12 //SYSTSIN   DD *                                                     
ICH70001I ENRICO   LAST ACCESS AT 17:26:50 ON WEDNESDAY, JULY 20, 2011         
IEF236I ALLOC. FOR ENRICO1 IEB                                                 
IEF237I 0AB4 ALLOCATED TO SYSUT1                                               
IEF237I JES2 ALLOCATED TO SYSUT2                                               
IEF237I JES2 ALLOCATED TO SYSPRINT                                             
IEF237I DMY  ALLOCATED TO SYSIN                                                 
IEF237I JES2 ALLOCATED TO SYSIN                                                 
IEF142I ENRICO1 IEB - STEP WAS EXECUTED - COND CODE 0000                       
IEF285I   ENRICO.ISPF.EXEC                             KEPT                     
IEF285I   VOL SER NOS= STOR04.                                                 
IEF285I   ENRICO.ENRICO1.JOB02703.D0000103.?           SYSOUT                   
IEF285I   ENRICO.ENRICO1.JOB02703.D0000104.?           SYSOUT                   
IEF285I   ENRICO.ENRICO1.JOB02703.D0000101.?           SYSIN                   
IEF373I STEP/IEB     /START 2011201.1728                                       
IEF374I STEP/IEB     /STOP  2011201.1728 CPU    0MIN 00.05SEC SRB    0MIN 00.01S
IEF236I ALLOC. FOR ENRICO1 IRX                                                 
IEF237I 0AB4 ALLOCATED TO SYSEXEC                                               
IEF237I JES2 ALLOCATED TO SYSPRINT                                             
IEF237I JES2 ALLOCATED TO SYSTSPRT                                             
IEF237I JES2 ALLOCATED TO SYSTSIN                                               
IEF142I ENRICO1 IRX - STEP WAS EXECUTED - COND CODE 0000                       
IEF285I   ENRICO.ISPF.EXEC                             KEPT                     
IEF285I   VOL SER NOS= STOR04.                                                 
IEF285I   ENRICO.ENRICO1.JOB02703.D0000105.?           SYSOUT                   
IEF285I   ENRICO.ENRICO1.JOB02703.D0000106.?           SYSOUT                   
IEF285I   ENRICO.ENRICO1.JOB02703.D0000102.?           SYSIN                   
IEF373I STEP/IRX     /START 2011201.1728                                       
IEF374I STEP/IRX     /STOP  2011201.1728 CPU    0MIN 00.07SEC SRB    0MIN 00.00S
IEF375I  JOB/ENRICO1 /START 2011201.1728                                       
IEF376I  JOB/ENRICO1 /STOP  2011201.1728 CPU    0MIN 00.12SEC SRB    0MIN 00.01S
Trace "O"                                                                       
                                                                               
Parse Source _sys _how _cmd .                                                   
                                                                               
say "enter something"                                                           
parse pull somethng                                                             
say "You entered   :"somethng                                                   
Exit 0                                                                         
                                                                               
DATA SET UTILITY - GENERATE                                                     
IEB352I WARNING: ONE OR MORE OF THE OUTPUT DCB PARMS COPIED FROM INPUT         
                                                                               
PROCESSING ENDED AT EOD   

enter something                                                                 
You entered   :AAAAAAAAAAA                                                     
******************************** BOTTOM OF DATA ********************************


something has changed... seems that the TS took away the numbers
Back to top
View user's profile Send private message
pratiksha
Warnings : 1

New User


Joined: 10 Feb 2006
Posts: 10
Location: Bangalore

PostPosted: Thu Jul 21, 2011 7:31 pm
Reply with quote

I executed without /*Rexx*/. It worked. Also added the input the Jcl.

Thank you all .

enrico-sorichetti- I had wriiten my second comment . Missed to see ur first answer. Tried out when read.

********************************* TOP OF DATA ******
i am thinking of number between 1 to 10.what is it?
your guess number is 9
sorry. My number was: 2
BYE!
******************************** BOTTOM OF DATA ****


Thank you all
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