testing empty dataset



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

testing empty dataset

Postby samb01 » Fri Jun 05, 2020 7:02 pm

Hellon,

i'd like to test if a dataset is empty or not before executing a FTP.
But the dataset was not open by the rexx i ran.

so, in ISPF, i can see :


- Enter "/" to select action                        Tracks %Used   XT  
-----------------------------------------------------------------------
 DATSE.SET                                                
 DATA.SET.G0001V00                         1    ?     1  
 
 


and IDCAMS, ICETOOL doesn't work...
samb01
 
Posts: 405
Joined: Mon Nov 16, 2009 7:24 pm
Has thanked: 1 time
Been thanked: 0 time

Re: testing empty dataset

 

Re: testing empty dataset

Postby enrico-sorichetti » Fri Jun 05, 2020 7:28 pm

discussed and answered gazillions of times
search this forum or the sibling at http://ibmmainframes.com/
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2927
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 154 times

Re: testing empty dataset

Postby samb01 » Sat Jun 06, 2020 1:07 am

Hello. I read the post. But my case is different.
The dataset has never been opened.
So i can't use usual program like idcams or icetool.
It dosen't work in my case.
samb01
 
Posts: 405
Joined: Mon Nov 16, 2009 7:24 pm
Has thanked: 1 time
Been thanked: 0 time

Re: testing empty dataset

Postby sergeyken » Sat Jun 06, 2020 2:02 am

samb01 wrote:The dataset has never been opened.
So i can't use usual program like idcams or icetool.


What did you mean?

Please, clarify. How this is possible, to have a DS never opened???
sergeyken
 
Posts: 103
Joined: Wed Jul 24, 2019 10:12 pm
Has thanked: 2 times
Been thanked: 10 times

Re: testing empty dataset

Postby samb01 » Sat Jun 06, 2020 2:31 am

I run a rexx and with an output data set in DISP=(NEW,CATLG,),
the condition in the rexx isn't satisfied. Si nothing is written in the output dataset and si it la never opened
My rexx :

     EXEC PGM=IKJEFT01,DYNAMNBR=30,REGION=5000K          
//SYSEXEC  DD DSN=REXX.LIB,DISP=SHR                              
//SYSTSPRT DD SYSOUT=*                                          
//IN       DD DSN=DATA.IN(0),DISP=SHR          
//* FICHIERS GDG ALRTVTS                                        
//OUT      DD DSN=DATA.OUT(+1),DISP=(,CATLG),  
//         SPACE=(TRK,(1,1)),RECFM=FB,LRECL=133,BLKSIZE=27930
//SYSTSIN  DD *                                                
 %REXX01                                                      
//*              
 


and my rexx :

SELECT ALL

/*REXX*/                                                    
TRACE I                                                    
"EXECIO * DISKR IN (FINIS STEM DT."                        
  DO J = 1 TO DT.0                                          
       PTL.J  = SUBSTR(DT.J,22,9)                      
       TEXT.J  = SUBSTR(DT.J,1,80)                          
       TX.J  = SUBSTR(DT.J,34,2)                          
       IF PTL.J = "PTL A" & TX.J > 10 THEN        
       DO                                                  
       QUEUE TEXT.J                                        
       END                                                  
  END                                                      
  QUEUE ""                                                  
"EXECIO * DISKW OUT (FINIS"                                
  EXIT;                                                    
 


the output dataset which is empty have a ? in %Used column.
samb01
 
Posts: 394
Joined: Mon Nov 16, 2009 7:24 pm
Has thanked: 1 time
Been thanked: 0 time

 
samb01
 
Posts: 405
Joined: Mon Nov 16, 2009 7:24 pm
Has thanked: 1 time
Been thanked: 0 time

Re: testing empty dataset

Postby samb01 » Sat Jun 06, 2020 2:33 am

My jcl

SELECT ALL

//VTS2     EXEC PGM=IKJEFT01,DYNAMNBR=30,REGION=5000K          
//SYSEXEC  DD DSN=REXX.LIB,DISP=SHR                              
//SYSTSPRT DD SYSOUT=*                                          
//IN       DD DSN=DATA.IN(0),DISP=SHR          
//* FICHIERS GDG ALRTVTS                                        
//OUT      DD DSN=DATA.OUT(+1),DISP=(,CATLG),  
//         SPACE=(TRK,(1,1)),RECFM=FB,LRECL=133,BLKSIZE=27930
//SYSTSIN  DD *                                                
 %REXX01                                                      
//*              
 
samb01
 
Posts: 405
Joined: Mon Nov 16, 2009 7:24 pm
Has thanked: 1 time
Been thanked: 0 time

Re: testing empty dataset

Postby enrico-sorichetti » Sat Jun 06, 2020 3:08 am

But my case is different.

NAHHH
also the case of dataset never opened for output has been discussed gazillions of times
and the general consensus is that it is a flaw of the design


'd like to test if a dataset is empty or not before executing a FTP.
But the dataset was not open by the rexx i ran.


run a rexx and with an output data set in DISP=(NEW,CATLG,),
the condition in the rexx isn't satisfied. Si nothing is written in the output dataset and si it la never opened


FIX THE BROKEN CODE

is it that difficult to write
if queued() = 0 then do
    "EXECIO 0 DISKW OUT (finis "
end
 
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2927
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 154 times

Re: testing empty dataset

Postby samb01 » Sat Jun 06, 2020 11:55 am

Hello. If i well anderstand i have To change all of my rexx by writting the code tou shown me?
When i want To write info à dataset i end the rexx with execio 0 ?
samb01
 
Posts: 405
Joined: Mon Nov 16, 2009 7:24 pm
Has thanked: 1 time
Been thanked: 0 time

Re: testing empty dataset

Postby enrico-sorichetti » Sat Jun 06, 2020 12:51 pm

When i want To write info à dataset i end the rexx with execio 0 ?

NO ...
You have to use a <dummy> EXECIO only when the main process does not write anything to the output dataset

it comes at no cost with a proper logic ...


"EXECIO * DISKR <input_ddname> ( FINIS STEM <input_stemvar>. "
if  RC \= 0 then do
    /*  tell the world about the error return code */
     ... ... ...
    /*  leave things in a clean state */
    "EXECIO 0 DISKR <output_ddname_1> ( FINIS "
    ... ... ...
    "EXECIO 0 DISKR <output_ddname_n> ( FINIS "
 
    return
end

/*  process ALL the rows of the stem */
do  i = 1 to <input_stemvar>.0
    ... ... ...
    <output_stemvar>.i = ... ... ...
end
<output_stemvar>.0 = <input_stemvar>.0
/* if the input dataset is empty
    <output_stemvar>.0 will be 0 and just the EOF will be written */  
"EXECIO" <output_stemvar>.0 "DISKW <output_ddname> ( FINIS STEM <output_stemvar>."

return


/*  process only selected rows of the stem */
<output_stemvar>.0 = 0
do  i = 1 to <input_stemvar>.0

    if  <some condition> then do
        <output_stemvar>.0 = <output_stemvar>.0 + 1
        j = <output_stemvar>.0
        <output_stemvar>.j = ... ... ...
    end
   
end
/* if the condition is never satisfied
    <output_stemvar>.0 will be 0 and just the EOF will be written */  
"EXECIO" <output_stemvar>.0 "DISKW <output_ddname> ( FINIS STEM <output_stemvar>."

return
 
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2927
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 154 times

Re: testing empty dataset

Postby samb01 » Sat Jun 06, 2020 1:32 pm

Hello enrico and thank's for the example.
I anderstand noxw but sorry to tell you that but your code is a litle bit heavy..

if the file have billions lines, it is not intersting to read all th file as you shown when you procees all the rows...

If i use my code (i found mine more simple)

i just have to add the code you shown me and it will be fine :


if queued() = 0 then do
    "EXECIO 0 DISKW OUT (finis "
end
 


Don't you think so ?
samb01
 
Posts: 405
Joined: Mon Nov 16, 2009 7:24 pm
Has thanked: 1 time
Been thanked: 0 time

Next

Return to JCL

 


  • Related topics
    Replies
    Views
    Last post