Display dataset volume by using LISTDSI

IBM's Command List programming language & Restructured Extended Executor
abhsha27
Posts: 12
Joined: Wed Oct 14, 2020 7:51 pm
Skillset: REXX, JCL ,z/OS
Referer: Google

Display dataset volume by using LISTDSI

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

Code: Select all

/*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 :

Code: Select all

   Enter name of the  dataset      
zadsash.rexx.cntl.gcu2            
    Dataset found                      
                             
 



I want to display the volume

NicC
Global moderator
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Skillset: JCL, PL/1, Rexx, Utilities and to a lesser extent (i.e. I have programmed using them) COBOL,DB2,IMS
Referer: Google
Location: Pushing up the daisies (almost)

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

abhsha27
Posts: 12
Joined: Wed Oct 14, 2020 7:51 pm
Skillset: REXX, JCL ,z/OS
Referer: Google

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?


Code: Select all

    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: 12
Joined: Wed Oct 14, 2020 7:51 pm
Skillset: REXX, JCL ,z/OS
Referer: Google

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

willy jensen
Posts: 474
Joined: Thu Mar 10, 2016 5:03 pm
Skillset: assembler rexx zOS ispf racf smf
Referer: saw it in the experts foprum thought I could help here

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.


  • Similar Topics
    Replies
    Views
    Last post