Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups 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: 161
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: 161
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: 1770
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10274
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: 161
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
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Write out NODUPS but just from one file Jay Villaverde DFSORT/ICETOOL 8 Fri Jul 14, 2017 12:44 am
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts How to generate a new unique Input fi... for1ranjith CLIST & REXX 11 Sat Jul 01, 2017 12:09 pm
No new posts Writing a file using online program grvtomar PL/I & Assembler 3 Fri Jun 30, 2017 1:06 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us