Page 1 of 3

Need to pull the list of datasets with particular HLQ

PostPosted: Tue May 17, 2022 1:03 pm
by Devrana
Hi All,

I have been trying to pull the datasets(PS) list using HLQ through IDCAMS utility but I tried with NONVSAM then I am getting the list of PS & PDS both. \

Could you please suggest how can I get the list of datasets(PS) for a particular HLQ.

Thanks in Advance!

Re: Need to pull the list of datasets with particular HLQ

PostPosted: Tue May 17, 2022 1:29 pm
by willy jensen
You can't do that with JCL (IDCAMS is not JCL either).
You can use ISPF 3.4, save and edit the list. Or use one of the programs at CBTTAPE.ORG, though the only one with dataset type filter I'm aware of is the VTOC command in file 112. Maybe the new file 1025 can do it too, I haven't checked.

Re: Need to pull the list of datasets with particular HLQ

PostPosted: Wed Jun 01, 2022 6:21 pm
by Devrana
Thanks Willy for your quick response!

Can we do it by using REXX ?

Re: Need to pull the list of datasets with particular HLQ

PostPosted: Wed Jun 01, 2022 9:41 pm
by willy jensen
Yes, you can use the ISPF LMxxxx services (see ISPF Services Guide).

1. LMDINIT
2. loop over LMDLIST .. STATS(YES) checking the ZDLDSORG variable for desired content, 'PS' in your case.
3. LMDFREE

Sample:
Address ispexec                                                    
 "control errors return"                                            
 if rc<>0 then call xmsg('You are not running under ISPF ('rc')')    
                                                                     
 arg p                                                              
 dsn=''                                                                    
 "LMDINIT LISTID(DSL) LEVEL("p")"                                    
 if rc>0 then exit xmsg('lmdinit' prm 'failed rc' rc)                
 do until rc<>0                                                      
   "LMDLIST LISTID("dsl") OPTION(LIST) DATASET(dsn) STATS(YES)"      
   if rc>8 then save 'lmdlist(list) failed rc' rc                    
   if rc=0 then say dsn ZDLDSORG ZDLDSNTP ZDLSIZE                    
 end                                                                
 "LMDLIST LISTID("dsl") OPTION(free)" /* DATASET(dsv)" */            
 "LMDFREE LISTID("dsl")"                                            
 Exit 0                                                              
                                                                     
xmsg:Address TSO "delstack";parse arg m;if m<>'' then say m;Exit 8  

Re: Need to pull the list of datasets with particular HLQ

PostPosted: Mon Jun 06, 2022 3:15 pm
by Devrana
Thanks a lot Willy!

It's working as expected.

Re: Need to pull the list of datasets with particular HLQ

PostPosted: Thu Jun 23, 2022 2:40 pm
by Devrana
Hello Willy,

I need your assistance. Actually after getting the details of the files(PS) with particular qualifier, I run jobs(which runs eazytrieve code) inside rexx to calculate the file size of each file(ps) but if I have four files(ps) then I have to press "Enter" four time to get the filesize then the screen will display. Is there anyway to calculate the file size with rexx or is any option so that I don't have to press enter again again.

Thanks in advance!

Re: Need to pull the list of datasets with particular HLQ

PostPosted: Thu Jun 23, 2022 2:58 pm
by willy jensen
No need for Easytrieve. The STATS(YES) option causes a number of variables to be generated, amongst these is ZDLSIZE, which contains the data set size in tracks. Please read the description of the LMDLIST service in the ISPF Services guide manual for details of the information returned.

Re: Need to pull the list of datasets with particular HLQ

PostPosted: Thu Jun 23, 2022 4:11 pm
by Devrana
Thanks Willy!

Can we covert tracks into bytes ? Actually I need to show the file size on the screen in kilobytes.

Re: Need to pull the list of datasets with particular HLQ

PostPosted: Thu Jun 23, 2022 6:47 pm
by willy jensen
That's where it gets complicated. A 3390 disk holds 56,664 bytes per track, but the actual amount depends on the blocksize of the dataset (they are not called files). Look at one capacity chart at http://www.legac-e.co.uk/JCLdocs/CAP3390.pdf
i.e at max blksize 27998 the track will hold 2 blocks = 55996 bytes, with blksize 80 the track will hold 78 blocks = 6240 bytes. Notes that these values are for fixed block datasets.
Or am sure that someone will correct me if I am wrong.

Re: Need to pull the list of datasets with particular HLQ

PostPosted: Sun Jun 26, 2022 3:50 pm
by willy jensen
I found an algorithm, which I have converted to a callable REXX:
/*                                                                  rexx
 Return number of blocks for a given blksz on a 3390 track              
 Parameter: blksize                                                      
 Org: Arthur T                                                          
*/                                                                      
 arg blksz .                                                            
 b90 = roundup((blksz+6)/232)                                            
 b90 = 9 + (blksz + (6*b90) +6)/34                                      
 b90 = roundup(b90)                                                      
 return trunc(1729 / (10 + b90))                                        
Roundup: return trunc(arg(1)+0.9999)                  

Just keep in mind the following:
It only works for fixed-blocked non-compressed datasets.
On average the last track will only be half full.