IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Problem in writing to a file


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
magesh23586

Active User


Joined: 06 Jul 2009
Posts: 213
Location: Chennai

PostPosted: Tue Oct 22, 2013 6:50 pm
Reply with quote

Hi,

Please advice whats wrong in my code, it is not writing in file.. But displaying

Code:

/* REXX */                                                       
"ALLOC F(DDIN) DS('XXXX.SRCHFOR.LIST3') SHR REUSE"             
"EXECIO * DISKR DDIN (FINIS STEM IN."                             
"FREE F(DDIN)"                                                   
I = 0                                                             
J = 1                                                             
DO I = 1 TO IN.0                                                 
   IF POS("--------- STRING(S)",IN.I) > 0 THEN                   
   DO                                                             
      J = J + 1                                                   
      E = WORD(IN.I,1)                                           
   END                                                           
   IF WORD(IN.I,2) = 'MADHU' THEN                                 
   DO                                                             
      E = E ' ' WORD(IN.I,3)                                     
      OU.J = E                                                   
      SAY OU.J                                                   
   END                                                           
END   
"ALLOC F(DDOU) DS('XXXX.SRCHFOR.LIST5') SHR REUSE"   
"EXECIO * DISKW DDOU (FINIS STEM OU."                   
"FREE F(DDOU)"                                                                                                     


The above code has SAY statement which is displaying the output while execution but when i check the output file, i can find those statements.
Back to top
View user's profile Send private message
magesh23586

Active User


Joined: 06 Jul 2009
Posts: 213
Location: Chennai

PostPosted: Tue Oct 22, 2013 6:53 pm
Reply with quote

input and output data for your reference
Code:

 XXXXXXXX                    --------- STRING(S) FOUND ---------------
                                                                     
      3                  MADHU 20 10) -                               
     18                  MADHU 20 10) -                               
                                                                     
 ZZZZZZZZ                    --------- STRING(S) FOUND ---------------
                                                                     
     13          MADHU 20 50) CISZ(12288) -                           
                                                                     
 DDDDDDDD                    --------- STRING(S) FOUND ---------------
                                                                     
     13          MADHU 100 1000) CISZ(12288) -                       
                                                                     
 PPPPPPPP                    --------- STRING(S) FOUND ---------------


SAY statement displayed

Code:

XXXXXXXX   20         
XXXXXXXX   20   20   
ZZZZZZZZ   20         
***                   

DDDDDDDD   100
***           
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Tue Oct 22, 2013 7:11 pm
Reply with quote

Your data is such that J is incremented to 2 before the first assignment, leaving OU.1 uninitialized. As the fine manual says:
Quote:
When EXECIO writes an arbitrary number of lines from a list of compound variables, it stops when it reaches a null value or an uninitialized variable (one that displays its own name).

So, your exec writes nothing.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Tue Oct 22, 2013 7:39 pm
Reply with quote

read here why using
Code:
EXECIO * DISKW ...
is a bad practice
www.ibmmainframes.com/viewtopic.php?t=60269&highlight=execio
Back to top
View user's profile Send private message
magesh23586

Active User


Joined: 06 Jul 2009
Posts: 213
Location: Chennai

PostPosted: Thu Oct 24, 2013 2:42 pm
Reply with quote

Thanks Akatsukami, You solution is working good,also thanks to Enrico for the kind advice.

Regards,
Magesh
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
No new posts Need help for File Aid JCL to extract... Compuware & Other Tools 23
Search our Forums:

Back to Top