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: 159
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: 159
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: 1754
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: 10254
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: 159
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 Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 11 Tue May 16, 2017 2:20 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
No new posts Issue with NDM process to transmit ES... chetanambi All Other Mainframe Topics 6 Wed May 03, 2017 10:52 am
No new posts File processing vishwakotin Mainframe Interview Questions 9 Fri Apr 28, 2017 11:38 am
No new posts Occurrence of various strings within ... TS70363 JCL & VSAM 1 Thu Apr 27, 2017 8:18 pm


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