The goal is to get the type of data sets in MVS from USS. Let's say Partitional Data Set and Sequential Data Set.

Please suggest any simple solutions in the command line.

Any simple tsocmd commands to get the dataset information are expected.

4

There are 4 best solutions below

2
On BEST ANSWER

You can also use tsocmd if you don't have ZOAU by passing the LISTDS TSO command. The below example is using the OMVS shell and I had to escape the parentheses and tick using a backslash or enclose it in quotes:

$ tsocmd listds \(\'sys1.parmlib\'\)
listds ('sys1.parmlib')             
SYS1.PARMLIB                        
--RECFM-LRECL-BLKSIZE-DSORG         
  FB    80    27920   PO            
                                    
--VOLUMES--                         
  VIMVSB                            

$ tsocmd "listds ('sys1.parmlib')"
listds ('sys1.parmlib')           
SYS1.PARMLIB                      
--RECFM-LRECL-BLKSIZE-DSORG       
  FB    80    27920   PO          
                                  
--VOLUMES--                       
  VIMVSB                          
$                                 

                
1
On

You can use IBM Z Open Automation Utilities (ZOAU) to accomplish this. The dls utility will show you the dataset type in the second field. If it is PS, then the data set is sequential. If it is PO, then the dataset is a PDS or PDSE.

For example:

> dtouch -t seq zoau.test
> dls -l zoau.test
ZOAU.TEST                                    PS  FB      80 X9TSO8
> dtouch -t pdse zoau.test.pdse
> dls -l zoau.test.pdse
ZOAU.TEST.PDSE                               PO  FB      80 X9TSO8
1
On

Alternatively to using ZOAU (in case you do not have it) is to use built-in tsocmd directly from Unix System Services to run the TSO LISTDS command, so for example: ==> tsocmd "listds 'data-set-name'"

The resulting output shows the DSORG value (PO or PS) and so for a partitioned data set the output would look like this:

--RECFM-LRECL-BLKSIZE-DSORG
  FB    80    27920   PO        

whereas for sequential it is like this:

--RECFM-LRECL-BLKSIZE-DSORG
  VB    255   25504   PS     
0
On

As an alternative to the other answers given, the information you want is returned by the fldata() runtime library function. Indeed, fldata() can tell you pretty many things about a given file, including it's type (VSAM, PDS, HFS, etc), record lengths, VSAM options (VSAM type, key length, etc). Much, much faster than something like "tsocmd" because there's no need to spawn a subprocess - but of course, you would have to write a few lines of code.