testing empty dataset



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

Re: testing empty dataset

Postby enrico-sorichetti » Sat Jun 06, 2020 2:04 pm

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


plan bullshit ...
if You need to process all the rows You need to read all of them
( why is not wise to process large files with rexx has been debated to death )

and that' exactly what You are doing when You
"EXECIO * DISKR IN (FINIS STEM DT."    


sorry to tell you that but your code is a litle bit heavy..

it looks like pretty basic to me

execio
test the return code
1st alternative to process the whole stem
2nd alternative to process only selected rows

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

your code You choices ...

but frankly - performance wise - Your code sucks
here again the technical reasons why ...
no reason to use stems PTL. TEXT. TX.
the PTL and TX comparisons can be done without using a intermediate variable
rexx will duplicate in the queue the content of the TEXT stem


but ... if You are happy everybody is happy :ugeek:
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: 2994
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 164 times

Re: testing empty dataset

Postby samb01 » Sat Jun 06, 2020 2:29 pm

i am not happy.
I just want to have your opinion.
So thank yu for your advices.
I would say whne the file is huge, the stem will be huge too, and it is able to have 'out of memory'.
But i agree with you, it is the same issue with my code... : EXECIO *

when you say :
[quote]
no reason to use stems PTL. TEXT. TX.
the PTL and TX comparisons can be done without using a intermediate variable
rexx will duplicate in the queue the content of the TEXT stem
[/quote

what would you write instead of it ?
samb01
 
Posts: 427
Joined: Mon Nov 16, 2009 7:24 pm
Has thanked: 1 time
Been thanked: 0 time

Re: testing empty dataset

Postby NicC » Sat Jun 06, 2020 3:08 pm

If you do not need to execute the FTP if the dataset is empty then you should also set a non-zero return code from the exec.
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 empty dataset

Postby willy jensen » Sat Jun 06, 2020 3:25 pm

In general I advise against EXECIO * DISKR, unless you know 100% that is will always fit. For REXX in production I normally do something like this:
do forever                                
   "Execio 1000 diskr -infile- (stem in.)"
   if in.0=0 then leave                    
   do ini=1 to in.0                        
     -                                    
   end                                    
 end                                      
 "Execio 0 diskr -infile- (finis)"  

And this too have been discussed before.
willy jensen
 
Posts: 455
Joined: Thu Mar 10, 2016 5:03 pm
Has thanked: 0 time
Been thanked: 69 times

Re: testing empty dataset

Postby samb01 » Sat Jun 06, 2020 5:21 pm

Hello. If the file is over than 1000 rows...
samb01
 
Posts: 427
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 5:24 pm

what would you write instead of it ?


just drop the dot and make them just plain variables

unless there is something You did not tell it does not look like those variable are used anywhere else

also it seems that a dfsort solution might handle the logic nicely
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: 2994
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 164 times

Re: testing empty dataset

Postby samb01 » Sat Jun 06, 2020 5:30 pm

Sorry but i'm using all the variable in my rexx :

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;                                

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

Re: testing empty dataset

Postby willy jensen » Sat Jun 06, 2020 5:36 pm

Hello. If the file is over than 1000 rows...

That is what the outer loop is for. Note that the execio finish is after the outer loop.
willy jensen
 
Posts: 455
Joined: Thu Mar 10, 2016 5:03 pm
Has thanked: 0 time
Been thanked: 69 times

Re: testing empty dataset

Postby willy jensen » Sat Jun 06, 2020 5:38 pm

Something else that has been mentioned numerous times, do not use the '*' in EXECIO DISKW. ALWAYS use a number i.e. "EXECIO" queued() "DISKW OUT (FINIS"
willy jensen
 
Posts: 455
Joined: Thu Mar 10, 2016 5:03 pm
Has thanked: 0 time
Been thanked: 69 times

Re: testing empty dataset

Postby willy jensen » Sat Jun 06, 2020 5:41 pm

why all those stems, why not just
DO J = 1 TO DT.0                                          
   IF SUBSTR(DT.J,22,9) = "PTL A" & SUBSTR(DT.J,34,2) > 10 THEN,
       QUEUE SUBSTR(DT.J,1,80)                                        
 END
willy jensen
 
Posts: 455
Joined: Thu Mar 10, 2016 5:03 pm
Has thanked: 0 time
Been thanked: 69 times

PreviousNext

Return to JCL

 


  • Related topics
    Replies
    Views
    Last post