MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Rexx code help
Goto page 1, 2  Next
 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF
View previous topic :: View next topic  
Author Message
binoy
Beginner


Joined: 03 Oct 2003
Posts: 17
Topics: 7

PostPosted: Sat Oct 18, 2003 3:19 am    Post subject: Rexx code help Reply with quote

Hi ,

I would like some one to help me with
writing a rexx program which will run
the following commands on a couple of dataset.

X all;F all '0' 1;F all '1' 1;
F all ' ' 1 ;F all '-*' 1
Del all X ;save

and if possible please suggest any reference.
Thanks
Brij
Back to top
View user's profile Send private message
ofer71
Intermediate


Joined: 12 Feb 2003
Posts: 358
Topics: 4
Location: Israel

PostPosted: Sat Oct 18, 2003 8:47 am    Post subject: Reply with quote

Brij -

Here is an example:
Code:

/* REXX */
ADDRESS ISREDIT "MACRO PROCESS"
                "X ALL"
                "F ALL '0' 1"
                "F ALL '1' 1"
                "DEL X ALL"
                "SAVE"

EXIT


For complete reference, please sea ISPF Edit and Edit Macros.

O.
________
GRANNY MOVIES


Last edited by ofer71 on Thu Mar 17, 2011 10:35 am; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail
binoy
Beginner


Joined: 03 Oct 2003
Posts: 17
Topics: 7

PostPosted: Sat Oct 18, 2003 11:40 am    Post subject: Reply with quote

Thanks ofer,

I copied the code as given but when i ran in i am getting:

IKJ56529I SYMBOLIC PARMS IN VALUE LIST IGNORED - ALL+
IKJ56529I COMMAND PROCEDURE HAS NO PROC STMT
IKJ56500I COMMAND F NOT FOUND
***
and also how can i make the macro more dynamic by making
it to ask the member of the dataset i want to edit
when i run the macro.

Thanks ,
Binoy
Back to top
View user's profile Send private message
Mervyn
Moderator


Joined: 02 Dec 2002
Posts: 415
Topics: 6
Location: Hove, England

PostPosted: Sat Oct 18, 2003 11:57 am    Post subject: Reply with quote

Binoy, are you sure you included the "/* REXX */" comment at the top? It looks as though your procedure is being processed as a Clist rather than a Rexx procedure.
_________________
The day you stop learning the dinosaur becomes extinct
Back to top
View user's profile Send private message
ofer71
Intermediate


Joined: 12 Feb 2003
Posts: 358
Topics: 4
Location: Israel

PostPosted: Sat Oct 18, 2003 1:21 pm    Post subject: Reply with quote

Hi

Quotation from IBM's REXX User's Guide:
Quote:
To prevent incompatibilities with CLISTs, IBM recommends that all REXX execs start with a comment that includes the characters "REXX" within the first line (line 1) of the exec. Failure to do so can lead to unexpected or unintended results in your REXX exec.


O.
________
cloudy trichomes


Last edited by ofer71 on Sat Feb 05, 2011 11:07 am; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail
Mike
Beginner


Joined: 03 Dec 2002
Posts: 114
Topics: 0
Location: Sydney, Australia

PostPosted: Sun Oct 19, 2003 11:08 pm    Post subject: Reply with quote

To further clarify, if the Rexx program is read via the SYSEXEC ddname the comments are not required as the Rexx interpreter handles the code directly. If the Rexx program is read via the SYSPROC ddname then the comments are required as then the program is actually being by by the TSO/E processor, which caters for Rexx programs, it detecting these by the comment statement with the word Rexx embedded (1st line).

Personally I use the SYSEXEC ddname whenever possible just because I think that it's the correct way. It might be slightly faster as well, but am not at all sure. I'd be suprised if it were slower though.
_________________
Regards,
Mike.
Back to top
View user's profile Send private message
binoy
Beginner


Joined: 03 Oct 2003
Posts: 17
Topics: 7

PostPosted: Mon Oct 20, 2003 8:07 am    Post subject: Reply with quote

Hi,

I have the /* REXX */ as the first statement
but still i getting the same message.
Do i need to specify anything other than " MACRO PROCESS"
Since when i removed it it didn't give any message but
didn't do anything either.

Thanks,
Brij
Back to top
View user's profile Send private message
binoy
Beginner


Joined: 03 Oct 2003
Posts: 17
Topics: 7

PostPosted: Mon Oct 20, 2003 10:42 am    Post subject: Reply with quote

Hi,
I doubt if i am right.
what i did was copied the code in a dataset 'vtvt.bnr.rexx(memedit)'
and then opened the dataset to be edited and ran
tso exec 'vtvt.bnr.rexx(memedit)'
I have also tried the below code :

/* REXX */
ADDRESS ISPEXEC
'ISREDIT MACRO'
'ISREDIT EXCLUDE ALL '
EXIT

but it just flashes the screen without doin anything.
Please correct if iam wrong in the way i should run this code.

Thanks,
Brij
Back to top
View user's profile Send private message
Mervyn
Moderator


Joined: 02 Dec 2002
Posts: 415
Topics: 6
Location: Hove, England

PostPosted: Mon Oct 20, 2003 4:58 pm    Post subject: Reply with quote

Brij,

The code you are attempting to run is an Edit Macro. It is invoked by editing the file you want to change then entering the name of the macro in the primary command area.

This presupposes that the library containing the macro is part of the SYSPROC or SYSEXEC concatenation. There are several ways to achieve this concatenation, and there is usually a way that is preferred within your site. The way to find out is to ask your systems programmers.

The easiest way of all is to have the macro in a library that is permanently assigned to SYSPROC or SYSEXEC. Use the TSO ISRDDN command to show the possible libraries, then pick one that you have Update access to.
_________________
The day you stop learning the dinosaur becomes extinct
Back to top
View user's profile Send private message
Dibakar
Advanced


Joined: 02 Dec 2002
Posts: 700
Topics: 63
Location: USA

PostPosted: Mon Oct 20, 2003 11:55 pm    Post subject: Reply with quote

Brij,

I am sure by this time you might have got very frustrated, running first edit macro was of similar experience to me.

This should work, -

1 If "TSO ISRDDN" shows you write access to say "SYS1.REXX.EXEC" then put your code in that dataset. Assume you saved member name is "XFDELSAV". The go to eny edit/view screen and give the command "XFDELSAV", no "TSO EX" etc, and let us know what happened.

2 But if you want to use your own dataset go ahead. Say you want to use "BRIJ.REXX" instead of "SYS1.REXX.EXEC" then from command promt give the tso command - "TSO ALTLIB APP(EXEC) DA('BRIJ.REXX')"
Now if your "XFDELSAV" command will work in edit/view mode. Only problem with this method is if you run the command from a new panel (using start) then you have to do altlib again.

Diba.
Back to top
View user's profile Send private message Send e-mail
binoy
Beginner


Joined: 03 Oct 2003
Posts: 17
Topics: 7

PostPosted: Wed Oct 22, 2003 12:49 am    Post subject: Reply with quote

Thanks Diba & Merv,

"TSO ALTLIB APP(EXEC) DA('BRIJ.REXX')" is working fine ,
but i would like to know how to reset my tso library to default.

I have tried :
"TSO ALTLIB APP(EXEC) DA('BRIJ.REXX')" and then asks for Activate
deactivate , reset or display.

using Deactivate and reset gives

IKJ79307I ALTLIB terminated. Extraneous information specified.+
***
IKJ79307I Specify a data set list or DDNAME only when activating an application
-level alternative library.
***
Finally i tried : "TSO ALTLIB APP(EXEC) DA('TS.USER.REXX')"
and ACTIVATE.
and things are fine.
Is this ALTLIB only for that session or i need to reset it after my use so that it doesn't interfere in the normal session flow.

Thanks & Regards,
Binoy
Back to top
View user's profile Send private message
binoy
Beginner


Joined: 03 Oct 2003
Posts: 17
Topics: 7

PostPosted: Wed Oct 22, 2003 12:57 am    Post subject: Reply with quote

Hi ,

I am sorry Ofer ,I forgot to Thank you

Regards,
Brij
Back to top
View user's profile Send private message
ofer71
Intermediate


Joined: 12 Feb 2003
Posts: 358
Topics: 4
Location: Israel

PostPosted: Wed Oct 22, 2003 3:17 am    Post subject: Reply with quote

Smile
Feel free to contact me directly if you need more help/samples.

O.
________
Subaru Tribeca history


Last edited by ofer71 on Sat Feb 05, 2011 11:07 am; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail
Dibakar
Advanced


Joined: 02 Dec 2002
Posts: 700
Topics: 63
Location: USA

PostPosted: Wed Oct 22, 2003 3:20 am    Post subject: Reply with quote

Brij,

If you carefully name the members in 'TS.USER.REXX' then you don't have to reset your ALTLIB, this only provides an additional library along with the default one. But if member names are something like 'SAVE', 'PROF' etc then you will have some problem (in executing original command).

I myself have tried only the ACTIVATE option.

Diba.
Back to top
View user's profile Send private message Send e-mail
Mike
Beginner


Joined: 03 Dec 2002
Posts: 114
Topics: 0
Location: Sydney, Australia

PostPosted: Wed Oct 22, 2003 5:54 pm    Post subject: Reply with quote

Regarding the allocation of Libraries (not only for Rexx/Clist but also for other ISPF Libraries) I use the following program (named REALLOC) that I have written. It's a little long winded but has worked for me at quite a few sites.

To work properly it needs to be run before ISPF is started. There are two ways this can be done.

a) If you are fortunate enough to have a library/member that is run as part of your startup procedure (I am). Our startup process invokes the member named STARTUP in the library userid.TSOUTIL. In this member I include the statement "EXEC 'DMI021.TSOUTIL.CLIST(REALLOC)'"

b) The alternative, and in my opion the least preferable method, is, again if you are allowed, to basically include the statement above in the command field of you logon panel.

If you use neither of these methods then you could always try chatting with you freindly sysprogs.

Basically the program interrogates you current allocations, de-alocates them and then re-applies the allocations. Part of the re-allocation is allocating your own datasets (should they exist) as the highest in the concatenation. I've made it relatively easy to customise (in my opinion anyway).

When customising the first thing to consider are the ddnames that you want to re-allocate. By default the program these are SYSEXEC (Rexx), SYSPROC (CLIST and Rexx), ISPPLIB (ISPF Panels), ISPMLIB (ISPF Messages), ISPSLIB (ISPF Skeletons for File Tailoring), ISPTLIB (ISPF Tables), ISPLLIB (program Lib, you may wish to research on this if you're unsure).

The Stemmed variables DD.n, holds the list of DDNAMES DD.0 being set to the number of stemmed variables to be used. The program expects DD.1- the number held in DD.0 to exist. DD.0 is used throoughout the program

The next customisable item is the list of respective HLQ's for the new datasets, these being held in ste stemmed variable DQ1.n (e.g. the value of DQ1.1 is the HLQ of the dataset that will be (assuminng that the dataset exists) allocated to the DDNAME as specified in DD.1 etc. The program defaults setting this to the userid of the invoker, it also sets all the other HLQ's in DQ1.2-DQ1.7 to the same value.

The stemmed variable DQ2. is used in the same way as DQ1. but reflects the 2nd qualifier of the new datasets. The program defaults these to USER.

The stemmed variable DQ3. is yet again used in a similar fashion to DQ1. & DQ2., however the defaults reflect what would be the recommended third level qualifier (thus making it easier to use the MODEL command). Theres is one error in that it would be better to change MESSAGES to MSGS as it this that is expected by the MODEL command.

Using the defaults you would create some or possibly all of the datasets (all bar userid.USER.LOAD would probably be PDS's or PDSE's with RECFM=FB, LRECL=80 and a suitable blocksize, not going to get into trying to say what blocksize is best):-

userid.USER.EXEC
userid.USER.CLIST
userid.USER.PANELS
userid.USER.MESSAGES (better to change DQ3.4 to MSGS and use userid.USER.MSGS)
userid.USER.SKELS
userid.USER.TABLES
userid.USER.LOAD (note this one should be created as a load library)

Should any of the expected new datasets not exist then a message is issued saying that the dataset is being skipped. In fact if any datasets don't exist then they are skipped, but it is unlikely as any others would not exist, as they are all retrieved from the current allocation.

When I have mentioned 'new dataset' I mean a dataset new to the allocation.

Ok so here's the code, I hope this is found to be useful :-

Code:

/* Rexx - REALLOC                                                     */
/*--------------------------------------------------------------------*/
/* Re-allocate the files used for a session to include user libraries */
/*--------------------------------------------------------------------*/
REALLOC:                                                               
/*--------------------------------------------------------------------*/
/* Variable initialisation                                            */
/* =======================                                            */
/*--------------------------------------------------------------------*/
/*--------------------------------------------------------------------*/
/* Define DDNAME variables                                            */
/*                                                                    */
/*--------------------------------------------------------------------*/
/*--------------------------------------------------------------------*/
/* dd.0 specifies the number of ddnames to be reallocated if they can */
/*--------------------------------------------------------------------*/
 dd.0 = 7                                                               
                                                                       
/*--------------------------------------------------------------------*/
/* dd.n (where n is 1-dd.0 inclusive) defines the ddname that should  */
/* be reallocated if possible.                                        */
/*--------------------------------------------------------------------*/
 dd.1 = "SYSEXEC"                                                       
 dd.2 = "SYSPROC"                                                       
 dd.3 = "ISPPLIB"                                                       
 dd.4 = "ISPMLIB"                                                       
 dd.5 = "ISPSLIB"                                                       
 dd.6 = "ISPTLIB"                                                       
 dd.7 = "ISPLLIB"                                                       
                                                                       
/*--------------------------------------------------------------------*/
/* dq1.n (where n is 1-dd.0 inclusive) defines the 1st qualifier of   */
/* the new datasets that is to be concatentaed, as the first dataset, */
/* succeded by the datasets currently allocated, to the ddname as     */
/* defined by the related dd.n variable. Commonly this will be the    */
/* userid  or perhaps the RACF group.                                 */
/*--------------------------------------------------------------------*/
 dq1.1 = Userid()                                                       
 dq1.2 = dq1.1                                                         
 dq1.3 = dq1.1                                                         
 dq1.4 = dq1.1                                                         
 dq1.5 = dq1.1                                                         
 dq1.6 = dq1.1                                                         
 dq1.7 = dq1.1                                                         
                                                                       
/*--------------------------------------------------------------------*/
/* dq2.n (where n is 1-dd.0 inclusive) defines the 2nd qualifier of   */
/* the new datasets that is to be concatentaed, as the first dataset, */
/* succeded by the datasets currently allocated, to the ddname as     */
/* defined by the related dd.n variable.                              */
/*--------------------------------------------------------------------*/
 dq2.1 = "USER"                                                         
 dq2.2 = "USER"                                                         
 dq2.3 = "USER"                                                         
 dq2.4 = "USER"                                                         
 dq2.5 = "USER"                                                         
 dq2.6 = "USER"                                                         
 dq2.7 = "USER"                                                         
                                                                       
/*--------------------------------------------------------------------*/
/* dq3.n (where n is 1-dd.0 inclusive) defines the 3rd qualifier of   */
/* the new datasets that is to be concatentaed, as the first dataset, */
/* succeded by the datasets currently allocated, to the ddname as     */
/* defined by the related dd.n variable.                              */
/*--------------------------------------------------------------------*/
 dq3.1 = "EXEC"                                                         
 dq3.2 = "CLIST"                                                       
 dq3.3 = "PANELS"                                                       
 dq3.4 = "MESSAGES"                                                     
 dq3.5 = "SKELS"                                                       
 dq3.6 = "TABLES"                                                       
 dq3.7 = "LOAD"                                                         
                                                                       
/*--------------------------------------------------------------------*/
/* df.n (where n is 1-dd.0 inclusive) is a flag that should initially */
/* be 0. The flag is used to denote the status of the related ddname  */
/* where 0=initial, 1=reallocated, 2=unable to be reallocated         */
/*--------------------------------------------------------------------*/
 df.1 = 0                                                               
 df.2 = 0                                                               
 df.3 = 0                                                               
 df.4 = 0                                                               
 df.5 = 0                                                               
 df.6 = 0                                                               
 df.7 = 0                                                               
                                                                       
/*--------------------------------------------------------------------*/
/* variables to hold the previous and currant ddname, the current     */
/* dataset and the current dataset list that is being processed.      */
/*--------------------------------------------------------------------*/
 prev_dname  = ""                                                       
 curr_ddname = ""                                                       
 curr_dset   = ""                                                       
 curr_dset_list = ""                                                   
                                                                       
/*--------------------------------------------------------------------*/
/* Start of main processing                                           */
/* ========================                                           */
/*--------------------------------------------------------------------*/
                                                                       
/*--------------------------------------------------------------------*/
/* Determine the current allocations by trapping the output obtained  */
/* from LISTA                                                         */
/*--------------------------------------------------------------------*/
 x = OUTTRAP("trap.","*","NOCONCAT")                                   
 "LISTA ST"                                                             
 x = OUTTRAP("OFF")                                                     
 trap_count = trap.0                                                   
 trap_count = trap_count + 1                                           
 trap.trap_count = "NOT.A.REAL.DATASET"                                 
 trap_count = trap_count + 1                                           
 trap.trap_count = "  !!!!!!!!"                                         
 trap.0 = trap_count                                                   
                                                                       
/*--------------------------------------------------------------------*/
/* Loop through the output                                            */
/*--------------------------------------------------------------------*/
 Do i = 1 to trap.0                                                     
                                                                       
   /*-----------------------------------------------------------------*/
   /* Ignore lines with -- as first two characters                    */
   /*-----------------------------------------------------------------*/
   If Substr(trap.i,1,2) = "--" Then Iterate                           
                                                                       
   /*-----------------------------------------------------------------*/
   /* If first 10 characters are spaces then dataset is a             */
   /* concatenated to current dd statement. So add dataset name to    */
   /* that ddnames dataset list, preceeding it with a comma as a      */
   /* seperator.                                                      */
   /*-----------------------------------------------------------------*/
   If Substr(trap.i,1,10) = "          " Then Do                       
                                                                       
      If curr_ddname <> "" Then Do                                     
         curr_ddname_list = curr_ddname_list||","||curr_dset           
      End                                                               
                                                                       
   End                                                                 
                                                                       
   /*-----------------------------------------------------------------*/
   /* If first 10 characters are then skip to next line of output     */
   /* (note after doing above)                                        */
   /*-----------------------------------------------------------------*/
   If Substr(trap.i,1,10) = "          " Then Iterate                   
                                                                       
   /*-----------------------------------------------------------------*/
   /* If first 2 but not the first 10 characters then a new ddname    */
   /* has been encountered.                                           */
   /*-----------------------------------------------------------------*/
   If Substr(trap.i,1,2) = "  " Then Do                                 
                                                                       
    /*----------------------------------------------------------------*/
    /* Loop through ddnames that can be re-alloaceted                 */
    /*----------------------------------------------------------------*/
    Do j = 1 to dd.0                                                   
                                                                       
     /*---------------------------------------------------------------*/
     /* If previous ddname is in list of ddnames to re-allocate then  */
     /* prepare for re-allocation by preceeding the existing list of  */
     /* datasets allocated to this ddname with the dataset name of    */
     /* the new dataset to be added. This dataset consists of 3       */
     /* qualifiers. The first being the userid of whoever is running  */
     /* this program, the second is USER and the third is determined  */
     /* by the dq variable associated with the ddname.                */
     /*---------------------------------------------------------------*/
     If dd.j = curr_ddname Then Do                                     
      new_dsn = "'"Userid()||".USER."||dq3.j||"'"                       
      curr_ddname_list = new_dsn||","||curr_ddname_list                 
                                                                       
      /*--------------------------------------------------------------*/
      /* Check that the new dataset exists and if so free the ddname  */
      /* and then allocate it with the modified list of datasets      */
      /*--------------------------------------------------------------*/
      If sysdsn(new_dsn) = "OK" Then Do                                 
       "FREE F("dd.j")"                                                 
       "ALLOC F("dd.j") DA("||curr_ddname_list||") SHR REU"             
       df.j = 1                                                         
      End                                                               
      Else Do                                                           
        Say "Skipping ddname "dd.j" as "new_dsn" was not found"         
        df.j = 2                                                       
      End                                                               
                                                                       
     End                                                               
                                                                       
    End                                                                 
                                                                       
    /*----------------------------------------------------------------*/
    /* Extract and store the new ddname and set dataset list          */
    /*----------------------------------------------------------------*/
    curr_ddname = Strip(Substr(trap.i,3,8))                             
    curr_ddname_list = curr_dset                                       
   End                                                                 
                                                                       
    /*----------------------------------------------------------------*/
    /* If processing gets here and the first two characters are not   */
    /* blanks then must be a dataset name, so add extract it and      */
    /* store it in the current dataset variable.                      */
    /*----------------------------------------------------------------*/
   If Substr(trap.i,1,2) <> "  " Then Do                               
      curr_dset = "'"||Strip(Substr(trap.i,1,44))||"'"                 
   End                                                                 
                                                                       
 End                                                                   
 /*-------------------------------------------------------------------*/
 /* Check for any of the specified ddnames that were not allocated    */
 /*-------------------------------------------------------------------*/
 Do i = 1 to dd.0                                                       
                                                                       
  If df.i = 0 Then Do                                                   
                                                                       
   new_dsn = "'"Userid()||".USER."||dq3.i||"'"                         
   If sysdsn(new_dsn) = "OK" Then Do                                   
    "ALLOC F("dd.i") DA("||new_dsn||") SHR REU"                         
   End                                                                 
                                                                       
  End                                                                   
                                                                       
 End                                                                   

_________________
Regards,
Mike.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF All times are GMT - 5 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group