Display dataset volume by using LISTDSI



IBM's Command List programming language & Restructured Extended Executor

Display dataset volume by using LISTDSI

Postby abhsha27 » Thu Nov 12, 2020 2:07 am

/*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
abhsha27
 
Posts: 10
Joined: Wed Oct 14, 2020 7:51 pm
Has thanked: 1 time
Been thanked: 0 time

Re: Display dataset volume by using LISTDSI

 

Re: Display dataset volume by using LISTDSI

Postby NicC » Thu Nov 12, 2020 2:27 am

You do not check the return code from LISTDI so how do you know if it worked OK?
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3018
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: Display dataset volume by using LISTDSI

Postby abhsha27 » Thu Nov 12, 2020 12:14 pm

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
abhsha27
 
Posts: 10
Joined: Wed Oct 14, 2020 7:51 pm
Has thanked: 1 time
Been thanked: 0 time

Re: Display dataset volume by using LISTDSI

Postby abhsha27 » Thu Nov 12, 2020 1:16 pm

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
abhsha27
 
Posts: 10
Joined: Wed Oct 14, 2020 7:51 pm
Has thanked: 1 time
Been thanked: 0 time

Re: Display dataset volume by using LISTDSI

Postby willy jensen » Thu Nov 12, 2020 2:40 pm

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.
willy jensen
 
Posts: 311
Joined: Thu Mar 10, 2016 5:03 pm
Has thanked: 0 time
Been thanked: 42 times


Return to CLIST & REXX

 


  • Related topics
    Replies
    Views
    Last post