Page 1 of 1

Display dataset volume by using LISTDSI

PostPosted: Thu Nov 12, 2020 2:07 am
by abhsha27
/*Step01:Move command line parameters into variables */    
arg dsname                                                
                                                           
/*Step02:Test for Parameters*/                            
if dsname = "" then                                        
  do                                                      
   say "Enter name of the dataset"                    
   pull dsname                                            
  end                                                      
/*Test for PDS existence*/                                
 if sysdsn(dsname) <> "OK" then                            
    say "Dataset found"                                    
 else do                                                  
     say "Error: Specified PDS not found:" dsname          
     say "Error: " dsname " > " sysdsn(dsname)            
     say "Press Enter to continue"                              
     pull dsname                                                
      exit 8                                                    
   end                                                          
                                                                 
/*step03:Call the LISTDSI program to get volume of the  Dataset*/
 call LISTDSI  dsname                                              
                                                                 
 say sysvolume                                                  
 



This code is displaying nothing in output for SAY SYSVOLUME
OUTPUT is :
   Enter name of the  dataset      
zadsash.rexx.cntl.gcu2            
    Dataset found                      
                             
 



I want to display the volume

Re: Display dataset volume by using LISTDSI

PostPosted: Thu Nov 12, 2020 2:27 am
by NicC
You do not check the return code from LISTDI so how do you know if it worked OK?

Re: Display dataset volume by using LISTDSI

PostPosted: Thu Nov 12, 2020 12:14 pm
by abhsha27
NicC wrote:You do not check the return code from LISTDI so how do you know if it worked OK?


    8 *-*  say "The dataset :"||ent||" got rc: "||x||"from LISTDSI"            
       >>>    "The dataset :ZADSASH.REXX.CNTL.GCU2 got rc: 0from LISTDSI"      
The dataset :ZADSASH.REXX.CNTL.GCU2 got rc: 0from LISTDSI                      
    11 *-* say "             " sysmsglvl2                                      
       >>>   "              "                                                  
                                                                               
    12 *-* exit                                                                  
              SYSVOLUME                                                          
 


I got a rc 0 but still no display

Re: Display dataset volume by using LISTDSI

PostPosted: Thu Nov 12, 2020 1:16 pm
by abhsha27
I read the manual more thoroughly and got my answer, Syntax should always be

variable = 'my.data'
x = LISTDSI(variable)

If we try to Pull dataset name and display information about it gives a RC = 16

Re: Display dataset volume by using LISTDSI

PostPosted: Thu Nov 12, 2020 2:40 pm
by willy jensen
I think that your sample:
variable = 'my.data'
x = LISTDSI(variable)
will only work for a dataset with your userid as prefix, or if you have profile NOPREFIX set.
I believe that a better sample would be something like this:
dsnv='SYS1.PARMLIB'
cc=Listdsi("'"dsnv"'")
say 'Listdsi' dsnv 'rc' cc 'vol' sysvolume
Note the quotes.