Executing LISTVTOC using REXX



IBM's Command List programming language & Restructured Extended Executor

Executing LISTVTOC using REXX

Postby weingartner » Tue Oct 11, 2016 7:13 am

Hi guys,
I need to execute “LISTVTOC” in a REXX script. However, so far, I have not been able to do it. I tried quite a few different ways, but none seem to work.
Could someone help me here?
Here is the code that I have created so far:

NEWSTACK
command = " LISTVTOC FORMAT,VOL=3390=MTM004,DSNAME="dsn""
ADDRESS TSO "ALLOC FI(SYSPRINT) NEW REU",                                  
       "RECFM(F B A) TRACKS SPACE(10 5)"                                  
ADDRESS TSO "ALLOC FI(SYSIN) REUSE UNIT(SYSDA) DSORG(PS) SPACE(1 1) TRACKS"
   QUEUE command                                                          
   "EXECIO 1 DISKW SYSIN (FINIS"                                          
   "CALL 'SYS1.LINKLIB(IEHLIST)'"                                          
DELSTACK                                                                  
                                                                           
ADDRESS TSO "FREE F(SYSIN)"                                                
NEWSTACK                        
"EXECIO * DISKR SYSPRINT (FINIS"
 


I have tried to use a tip from a fellow at [1]; but, that does not seem to do the trick. I know that the "LISTVTOC" does not have a great output, but the script is just for an exercise. Does anyone see any way to make that work?

[1] http://ibmmainframes.com/about12597.html
weingartner
 
Posts: 3
Joined: Tue Oct 11, 2016 7:00 am
Has thanked: 2 times
Been thanked: 0 time

Re: Executing LISTVTOC using REXX

 

Re: Executing LISTVTOC using REXX

Postby steve-myers » Tue Oct 11, 2016 9:02 am

You have to figure out some way to allocate the volume to your TSO session before you run IEHLIST. Years ago I wrote a personal TSO command processor to do this, but it's over 500 lines and too large to copy here.

As you say, the output isn't terribly useful. What do you really want?

Years ago - like back in the 1980s - I wrote a TSO command processor to provide more detailed output than LISTDS -
dsstat cntl dirstat label extents
 XXXXXX.CNTL
 --UNIT---DEVICE---VOLUME--RECFM--LRECL--BLKSIZE--DSORG--ALLOCATED---USED
   0A6E   3390     VVVVVV  FB        80   27920    PO         10       10
 --ALLOCATED--LAST USED---EXPIRES--ALTERED-STORCLAS-DATACLAS-MGMTCLAS
    08/02/13  10/04/16     ------    YES   USER
 ---NO--RELTRK--START CCHH--END CCHH--TRACKS
     1   00000   006E000A   006E000E       5
     2   00005   000D0006   000D0006       1
     3   00006   0011000A   0011000B       2
     4   00008   001B0000   001B0001       2
 --FORMAT 1 DSCB--
   F1 E4E4E4E4E4E4 0001 7100D6 000000 04 00 00 C9C2D4D6E2E5E2F24040404040 740116
   A0 000000 0200 90 00 6D10 0050 00 0000 82 80000002 00090B B10A 0000
   0100006E000A006E000E 0101000D0006000D0006 01020011000A0011000B 0001000230
 --FORMAT 3 DSCB--
   03030303 0103001B0000001B0001 00000000000000000000 00000000000000000000
   00000000000000000000 F3 00000000000000000000 00000000000000000000
   00000000000000000000 00000000000000000000 00000000000000000000
   00000000000000000000 00000000000000000000 00000000000000000000
   00000000000000000000 0000000000
 DIRECTORY BLOCKS:    20 ALLOCATED,    18 USED
There are more goodies that I didn't show. It's more than 1500 lines, and much too large to include here, and requires significant work to support extended attribute volumes, which I can't do since I do not have access to a system that supports extended attribute volumes.

There is something sort of similar on CBT. I used it as an example of what not to do!
steve-myers
Global moderator
 
Posts: 1789
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 170 times

Re: Executing LISTVTOC using REXX

Postby willy jensen » Tue Oct 11, 2016 2:40 pm

You are not allocating the disk. This is required for IEHLIST and other utilities.
This following works. I prefer BPXWDYN to ALLOC, but ALLOC would work just as well. Note that you do not have to specify the loadlib for the program if it can be found by program loader.

 dsn='Z.IFASMF.DEFAULT.A0000934.DATA'                      
 vol='SYSXL1'                                              
                                                           
 cc=bpxwdyn('alloc dd(sysin) new delete reuse',            
  'lrecl(80) recfm(f,b) tracks space(1,1) unit(sysda)')    
 if cc<>0 then exit xmsg('alloc sysin failed rc' cc)        
 cc=bpxwdyn('alloc dd(sysprint) new delete reuse',          
  'lrecl(121) recfm(f,b) tracks space(1,1) unit(sysda)')    
 if cc<>0 then exit xmsg('alloc sysprint failed rc' cc)    
 cc=bpxwdyn('alloc dd(disk) shr reuse',                    
  'unit(sysda) vol('vol')')                                
 if cc<>0 then exit xmsg('alloc disk failed rc' cc)        
                                                           
 rec.1= ' LISTVTOC FORMAT,VOL=3390='vol',DSNAME='dsn        
 "execio 1 diskw sysin (stem rec. finis)"                  
                                                           
 "CALL *(IEHLIST)"                                          
                                                           
 "execio * diskr sysprint (stem lst. finis)"                
 do n=1 to lst.0                                            
   say lst.n                                                
 end                                                        
                                                           
 cc=bpxwdyn('free dd(sysin)')                              
 cc=bpxwdyn('free dd(sysprint)')                            
 cc=bpxwdyn('free dd(disk)')                                
 exit 0                                                    
                                                           
XMsg: if arg(1)<>'' then say arg(1);return word(arg(2) 0,1)
 

These users thanked the author willy jensen for the post:
weingartner (Tue Oct 11, 2016 6:47 pm)
willy jensen
 
Posts: 61
Joined: Thu Mar 10, 2016 5:03 pm
Has thanked: 0 time
Been thanked: 11 times

Re: Executing LISTVTOC using REXX

Postby steve-myers » Tue Oct 11, 2016 3:53 pm

willy jensen wrote:You are not allocating the disk. ...

That is not correct. Sort of. The documentation for IEHLIST talks about an anyname DD statement of the form

//anyname DD DISP=OLD,UNIT=...,VOL=SER=...

Personally, I prefer DISP=SHR rather than DISP=OLD, as it would seem does Mr. Jensen, but the purpose of the DD statement is to make the volume available to the program. This is what Mr. Jensen's

 cc=bpxwdyn('alloc dd(disk) shr reuse',                    
  'unit(sysda) vol('vol')')

statement is doing. What IEHLIST does is locate the anyname DD statement, effectively insert the data set name from the utility control statement into it, and then open the modified DD statement to access the data set. Actually, for LISTVTOC DSNAME=dataset the DD statement could be bypassed, though IEHLIST may still open the VTOC as a data set even though there are two other ways (both of them safer) to obtain data set information without opening the VTOC as a data set.

These users thanked the author steve-myers for the post:
weingartner (Tue Oct 11, 2016 6:47 pm)
steve-myers
Global moderator
 
Posts: 1789
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 170 times

Re: Executing LISTVTOC using REXX

Postby willy jensen » Tue Oct 11, 2016 6:27 pm

I did not say 'You are not allocating the 'disk' dd statement.', I said that the disk was not being allocated. Perhaps I should have chosen another ddname for the disk allocation to make that clearer. As steve-myers said any valid name will do, probably even your temporary SYSIN or SYSPRINT, if you can force the allocation to the disk in question. I haven't tried.
willy jensen
 
Posts: 61
Joined: Thu Mar 10, 2016 5:03 pm
Has thanked: 0 time
Been thanked: 11 times

Re: Executing LISTVTOC using REXX

Postby weingartner » Tue Oct 11, 2016 6:47 pm

Thank you all guys. You are awesome.
Sorry for my rookie mistakes. My Rexx script is executing now. The only odd thing is that if I execute the same “LISTVTOC” command from a JCL, I am getting different responses. The JCL I am using is the following:

//LISTVTOC EXEC PGM=IEHLIST                                      
//SYSPRINT DD SYSOUT=*                                          
//INVTOC   DD DISP=OLD,UNIT=3390,VOL=SER=<vol>
//SYSIN    DD *                                                  
  LISTVTOC FORMAT,VOL=3390=<vol>,DSNAME=<datasetName>
 


When I execute the JCL, I get information about the <datasetName>. If I use the same dataset in my Rexx, I get the following message:
1 SYSTEMS SUPPORT UTILITIES---IEHLIST PAGE 1
-DATE: 2016.285 TIME: 08.15.30
CONTENTS OF VTOC ON VOL <vol> <THIS IS AN SMS MANAGED VOLUME>
IEH102I THIS VOLUME DOES NOT CONTAIN DATA SET ---<datasetName>


Do you have an idea why this behavior may happen?
weingartner
 
Posts: 3
Joined: Tue Oct 11, 2016 7:00 am
Has thanked: 2 times
Been thanked: 0 time

Re: Executing LISTVTOC using REXX

Postby weingartner » Tue Oct 11, 2016 6:55 pm

Never mind. Found my mistake, there was a typo at te volume identifier.

thank you all guys again.
weingartner
 
Posts: 3
Joined: Tue Oct 11, 2016 7:00 am
Has thanked: 2 times
Been thanked: 0 time


Return to CLIST & REXX

 


  • Related topics
    Replies
    Views
    Last post