Page 1 of 1

Testing exactly number of lines of a dataset

PostPosted: Wed Feb 06, 2019 6:51 pm
by samb01
Hello,

i'd like to know if a dataset have 8 lines ofr exemple, not less and not more.

I am using this jcl but it's not correct if the Dataset Have more than 8 lines


//VERIFSMS  EXEC PGM=IDCAMS                          
//SYSPRINT DD SYSOUT=*                              
//SYSOUT   DD SYSOUT=*                              
//SYSIN    DD *            
  PRINT IDS('MY.DATASET') COUNT(8)    
/*                                                  
//                                                  
 

if my dataset have more or less than 8 lines, the return code must be différent than 0.

Thanks for your help.

Re: Testing exactly number of lines of a dataset

PostPosted: Wed Feb 06, 2019 7:27 pm
by NicC
I know of no utility that does what you want. You will have to write your own. It might be possibe using DFSort seqnum but that is just an idea that floated into my head.

Re: Testing exactly number of lines of a dataset

PostPosted: Thu Feb 07, 2019 2:55 am
by Terry Heinze
A small COBOL program can easily count records and it could set RETURN-CODE to whatever you like.

Re: Testing exactly number of lines of a dataset

PostPosted: Thu Feb 07, 2019 1:53 pm
by Garry F Carroll
DFSORT's ICETOOL COUNT FROM (indd) EQUAL(8) RC(8) might help. This will set return code 8 if there are exactly 8 records in the dataset.

Garry

Re: Testing exactly number of lines of a dataset

PostPosted: Wed Feb 20, 2019 5:59 pm
by samb01
Hello Gary, thank you for your help.