Page 1 of 2

Run ISPF edit macro that not exist in sysproc.

PostPosted: Tue Mar 26, 2013 6:27 pm
by Mehdi shri
Dear friends.
How I can run ISPF edit macro that not exist in the sysproc liberary.Because I have not sufficient access autorithy to put my macro into SYSPROC or SYSEXEC liberary. Is there any way to run this macro.

Re: Run ISPF edit macro that not exist in sysproc.

PostPosted: Tue Mar 26, 2013 6:42 pm
by NicC
Allocate your own librayry to the sysexec concatenation.
tso alloc ds(your.library) fi(sysexec) shr


Assign that to a PK key and execute it every time you log on.

Re: Run ISPF edit macro that not exist in sysproc.

PostPosted: Tue Mar 26, 2013 6:56 pm
by Ed Goodman
Will that change the allocation to be ONLY that library? Or will it just add it to the existing concatenation?

Re: Run ISPF edit macro that not exist in sysproc.

PostPosted: Tue Mar 26, 2013 6:57 pm
by NicC
Good point - here they do not use sysexec so I have it all to myself.

Re: Run ISPF edit macro that not exist in sysproc.

PostPosted: Tue Mar 26, 2013 6:58 pm
by Mehdi shri
Thanks Mr.NicC
I have a same quetion like last post.

Re: Run ISPF edit macro that not exist in sysproc.

PostPosted: Tue Mar 26, 2013 7:03 pm
by Mehdi shri
Mr.NicC
I can't understand your mean clearly. What's happen exeactly about your answer to Mr.Ed Goodman?

Re: Run ISPF edit macro that not exist in sysproc.

PostPosted: Tue Mar 26, 2013 7:13 pm
by NicC
Because SYSEXEC is not used in the logon proc that I have my ALLOC works fine but it is possible that it would remove other allocations had they been there. Having done a bit of searching on the forum I think you should be reading up about ALTLIB command. Try this:
TSO HELP ALTLIB

Re: Run ISPF edit macro that not exist in sysproc.

PostPosted: Tue Mar 26, 2013 9:06 pm
by NicC
These are my notes/quick reference:
To allocate ones own libraries:

1) Rexx and CLIST libraries are done by allocating to SYSUEXEC and
   SYSUPROC respectively
   "ALLOC FI(SYSUEXEC) DA('dsn') SHR REU"
   "ALLOC FI(SYSUPROC) DA('dsn') SHR REU"
   Once allocated they have to be activated using the TSO ALTLIB service:
   'ALTLIB ACT USER(EXEC)'
   'ALTLIB ACT USER(PROC)'

2) ISPF libraries are done by using the LIBDEF ISPF service:
   "LIBDEF ISP?LIB DATASET ID('dsn')"
   where ? = P, S, T, M etc

To find out what is allocated:
LISTALC otherwise known as LISTA
  ST option gives DD names that datasets are alloacated to
  Options SYSNAMES and HISTORY give more detail
but...
ISRDDN gives an ISPF panel of the same info from which you can edit your
own datasets

I would need to do a little more research to see a) which DDNAMEs the system uses and, if I have to concat enate to the same DDNAMEs, what parameters I would need on ALLOC.

I noticed that one post on the forum used the command CONCAT but that must be a "home-grown" thing as I get "COMMAND NOT FOUND" here. It is probably a simple little exec but...

Re: Run ISPF edit macro that not exist in sysproc.

PostPosted: Tue Mar 26, 2013 10:07 pm
by steve-myers
NicC wrote:... I noticed that one post on the forum used the command CONCAT but that must be a "home-grown" thing as I get "COMMAND NOT FOUND" here. It is probably a simple little exec but...

The easiest is the standard ALLOCATE command:

ALLOCATE FILE(SYSLIB) SHR REUS DATASET('SYS1.MACLIB' 'SYS1.MODGEN')

This has been in the ALLOCATE command for a very long time, possible going back to the original TSO/E.

Many shops have a CONCAT command of some sort, and it is possible to write a CLIST or Rexx EXEC, as NicC suggests. A CONCAT command is a good assignment for a beginner Assembler programmer. The simplest is frequently something like

CONCAT (DD-name DD-name ... DD-name)

The dd names in the list must be allocated, and they are concatenated so the first name is the name of the concatenation.

For example -

ALLOCATE FILE(SYSLIB) SHR REUS DATASET('SYS1.MACLIB')
ALLOCATE FILE(S2) SHR REUS DA('SYS1.MODGEN')
CONCAT (SYSLIB S2)

A CONCAT command is usually paired with a DECONCAT command to break the concatenation. There are fancier commands, like

CONCAT FILE(DD-name) DATASET(data set list)

That will insert the data set to the beginning of the concatenation if the file is already allocated, or just do the allocation, usually SHR.

Re: Run ISPF edit macro that not exist in sysproc.

PostPosted: Wed Mar 27, 2013 7:38 pm
by Ed Goodman
I'm glad I spoke up. Do a simple allocation will erase all of the concatenations you already have. This will cause you headaches.

The usual next step is for the enterprising developer to find the current list of datasets, and reallocate them at start up including their own dataset. This will also cause headaches because they can change without warning or notice.

I'm at the stage of using a rexx/clist at login to list the current allocations and build a new allocate command that includes my datasets. It looks kind of like this:

000001 /* REXX RE-ALLOCATOR */                               
000002                                                       
000003 /* REXX1 */                                           
000004 X = OUTTRAP("LAC.",,"NOCONCAT")                       
000005 "LISTALC STATUS"                                     
000006 Y = OUTTRAP('OFF')                                   
000007 /*  SAY 'TOTAL LINES TRAPPED' LAC.0 */               
000008 DSCOUNT = 1                                           
000009 DO I = 1 TO LAC.0                                     
000010  CURLINE = LAC.I                                     
000011  IF STRIP(CURLINE,'B') = 'KEEP' THEN                 
000012      ITERATE                                         
000013  IF STRIP(CURLINE,'B') = 'DELETE' THEN               
000014      ITERATE                                         
000015  IF SUBSTR(STRIP(CURLINE,'B'),1,8) = 'TERMFILE' THEN 
000016      ITERATE                                         
000017  IF SUBSTR(CURLINE,1,1) = ' ' THEN                   
000018    DO                                                 
000019      CURLINE = STRIP(CURLINE,'B')                       
000020      IF SUBSTR(CURLINE,1,7) = 'SYSPROC' THEN             
000021        DO                                               
000022           PREVLINE = I - 1                               
000023           DSNAME.1 = STRIP(LAC.PREVLINE,'B')             
000024           GRABEM = 1                                     
000025           ITERATE                                       
000026        END                                               
000027      ELSE                                               
000028        DO                                               
000029           GRABEM = 0                                     
000030        END                                               
000031    END                                                   
000032  CURLINE = STRIP(CURLINE,'B')                           
000033  IF GRABEM = 1 THEN                                     
000034    DSCOUNT = DSCOUNT + 1                                 
000035    DSNAME.DSCOUNT = CURLINE                             
000036 END                                                     
000037 DSNAME.DSCOUNT = ''                                     
000038 DSCOUNT = DSCOUNT - 1                                   
000039 /*  TACK ON YOUR OWN DSNS HERE */                   
000040 DSCOUNT = DSCOUNT + 1                               
000041 DSNAME.DSCOUNT = 'WTSO.GOODMAN.JCL'                     
000042 ALCMD = "ALLOC DDN(SYSPROC) DSN("                   
000043 DO I = 1 TO DSCOUNT                                 
000044 /* SAY I DSNAME.I */                                 
000045    ALCMD = ALCMD" '"DSNAME.I"'"                     
000046 END                                                 
000047 ALCMD = ALCMD " ) SHR REUSE"                         
000048 SAY "REALLOCATING SYSPROC..."                       
000049 /* SAY ALCMD */                                     
000050    ADDRESS TSO ALCMD                                 
000051 /*                                                 */
000052 /*                                                 */
000053 /*                                                 */


This snippet is for the SYSPROC DD. Line 5 lists all allocated datasets, 9-36 walks the list and saves off all of the files currently allocated to SYSPROC. 40-41 is where I add my library, and could add multiples if needed. 42-47 builds a new allocate command. 50 does the actual allocate.

I could still get in trouble here, if they change the output format of the LISTALC command, but I've been OK for more than a decade now.