Page 2 of 3

Re: testing empty dataset

PostPosted: Sat Jun 06, 2020 2:04 pm
by enrico-sorichetti
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:

Re: testing empty dataset

PostPosted: Sat Jun 06, 2020 2:29 pm
by samb01
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 ?

Re: testing empty dataset

PostPosted: Sat Jun 06, 2020 3:08 pm
by NicC
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.

Re: testing empty dataset

PostPosted: Sat Jun 06, 2020 3:25 pm
by willy jensen
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.

Re: testing empty dataset

PostPosted: Sat Jun 06, 2020 5:21 pm
by samb01
Hello. If the file is over than 1000 rows...

Re: testing empty dataset

PostPosted: Sat Jun 06, 2020 5:24 pm
by enrico-sorichetti
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

Re: testing empty dataset

PostPosted: Sat Jun 06, 2020 5:30 pm
by samb01
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;                                

 

Re: testing empty dataset

PostPosted: Sat Jun 06, 2020 5:36 pm
by willy jensen
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.

Re: testing empty dataset

PostPosted: Sat Jun 06, 2020 5:38 pm
by willy jensen
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"

Re: testing empty dataset

PostPosted: Sat Jun 06, 2020 5:41 pm
by willy jensen
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