write into two different dataset



IBM's Command List programming language & Restructured Extended Executor

write into two different dataset

Postby samb01 » Fri Nov 15, 2024 9:13 pm

Hi,
i am trying to write différent lines in two different dataset : FICH2 and FICH3

but i have nothing in FICH3 et in FICH2 i have the content of FICH1.

I would like to write DS. in FICH2 and ES in FICH3


/*REXX*/                                              
   TRACE I                                            
"EXECIO * DISKR FICH1(FINIS STEM DS."                  
NBRCJOB = 0                                            
NBRSCAN = 0                                            
  DO I = 1 TO DS.0                                    
    INDJOB = INDEX(DS.I,' JOB ')                      
  IF INDJOB <> 0                                      
  THEN DO                                              
         MOTJOB = WORD(DS.I,2)                        
         INDJOB1 = INDEX(MOTJOB,'JOB')                
         IF INDJOB1 <> 0                              
         THEN DO                                      
                   INDJOB2 = INDEX(DS.I,'//*')        
                   INDJOB3 = INDEX(DS.I,'//')          
                   IF (INDJOB2 <> 1 & INDJOB3 = 1)    
                   THEN DO                            
                           QUEUE DS.I                  
                           NBRCJOB = NBRCJOB + 1            
                        END                                
              END                                          
       END                                                  
     INDSCAN = INDEX(DS.I,'TYPRUN=SCAN')                    
     IF INDSCAN <> 0 THEN                                  
     DO                                                    
       ES.I = DS.I                                          
       QUEUE ES.I                                          
       NBRSCAN = NBRSCAN + 1                                
     END                                                    
   END                                                      
   SAY'NOMBRE DE CARTE JOB = 'NBRCJOB                      
   SAY'NOMBRE DE TYPRUN = 'NBRSCAN                          
QUEUE ""                                                    
"EXECIO * DISKW FICH2(STEM DS. FINIS"                      
"EXECIO * DISKW FICH3(STEM ES. FINIS"                      
EXIT;                                                      
 


Thank's for your help
samb01
 
Posts: 431
Joined: Mon Nov 16, 2009 7:24 pm
Has thanked: 1 time
Been thanked: 0 time

Re: write into two different dataset

Postby sergeyken » Fri Nov 15, 2024 11:26 pm

Why not to add debug print to verify: what goes wrong?
Javas and Pythons come and go, but JCL and SORT stay forever.
User avatar
sergeyken
 
Posts: 437
Joined: Wed Jul 24, 2019 10:12 pm
Has thanked: 7 times
Been thanked: 40 times

Re: write into two different dataset

Postby enrico-sorichetti » Fri Nov 15, 2024 11:56 pm

the FICH3 datset is empty because the ES. stem has uninitialized variables

search this and the other mainframes forums for a loong post of mine
which explains why using the construct EXECIO * DISKW ..... SOMESTEM.
most often provides wrong/unexpected results

the error in this case is triggerede by the fact that you are
using the ES.I = DS.I

you shoiuld use for each stem its own index
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: 3006
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 165 times

Re: write into two different dataset

Postby sergeyken » Sat Nov 16, 2024 11:05 pm

Such questions make me think that the new-coming "experts" have never heard about the word "debugging". Isn't it?
Javas and Pythons come and go, but JCL and SORT stay forever.
User avatar
sergeyken
 
Posts: 437
Joined: Wed Jul 24, 2019 10:12 pm
Has thanked: 7 times
Been thanked: 40 times


Return to CLIST & REXX

 


  • Related topics
    Replies
    Views
    Last post