Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Problem in writing to a file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
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    Post subject: Problem in writing to a file
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    Post subject: Reply to: Problem in writing to a file
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    Post subject:
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

Senior Member


Joined: 14 Mar 2007
Posts: 10494
Location: italy

PostPosted: Tue Oct 22, 2013 7:39 pm    Post subject: Reply to: Problem in writing to a file
Reply with quote

read here why using
Code:
EXECIO * DISKW ...
is a bad practice
http://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    Post subject: Reply to: Problem in writing to a file
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    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Join 2 File using a Join Key scorp_rahul23 DFSORT/ICETOOL 6 Tue Aug 14, 2018 7:36 am
No new posts JCL to send email along with formated... wik123 JCL & VSAM 5 Thu Aug 09, 2018 9:48 am
No new posts How can we create a flat file in JAVA... jasorn Java & MQSeries 2 Wed Aug 08, 2018 3:08 pm
No new posts Formating of Amount field in CLIST be... Anil Kumar Prajapati CLIST & REXX 9 Fri Aug 03, 2018 6:34 pm
No new posts Need Help on sending email by includi... wik123 JCL & VSAM 9 Mon Jul 30, 2018 2:59 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us