Testing exactly number of lines of a dataset



JES, JES2, JCL utilities, IDCAMS, Compile & Run JCLs, PROCs etc...

Testing exactly number of lines of a dataset

Postby samb01 » Wed Feb 06, 2019 6:51 pm

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.
samb01
 
Posts: 431
Joined: Mon Nov 16, 2009 7:24 pm
Has thanked: 1 time
Been thanked: 0 time

Re: Testing exactly number of lines of a dataset

Postby NicC » Wed Feb 06, 2019 7:27 pm

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.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: Testing exactly number of lines of a dataset

Postby Terry Heinze » Thu Feb 07, 2019 2:55 am

A small COBOL program can easily count records and it could set RETURN-CODE to whatever you like.
.... Terry
Terry Heinze
 
Posts: 239
Joined: Wed Dec 04, 2013 11:08 pm
Location: Richfield, MN, USA
Has thanked: 12 times
Been thanked: 11 times

Re: Testing exactly number of lines of a dataset

Postby Garry F Carroll » Thu Feb 07, 2019 1:53 pm

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
Garry F Carroll
 
Posts: 28
Joined: Wed Sep 19, 2018 8:20 pm
Has thanked: 0 time
Been thanked: 1 time

Re: Testing exactly number of lines of a dataset

Postby samb01 » Wed Feb 20, 2019 5:59 pm

Hello Gary, thank you for your help.
samb01
 
Posts: 431
Joined: Mon Nov 16, 2009 7:24 pm
Has thanked: 1 time
Been thanked: 0 time


Return to JCL

 


  • Related topics
    Replies
    Views
    Last post