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: 211
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: 211
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: 1783
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: 10374
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: 211
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 ISSUE IN copying Sequential file reco... thesumitk JCL & VSAM 1 Wed Dec 13, 2017 3:07 pm
No new posts File Tailoring -- Temporary dataset i... samzee71 CLIST & REXX 3 Fri Dec 01, 2017 3:12 am
No new posts Rexx - File tailoring samzee71 CLIST & REXX 10 Thu Nov 30, 2017 10:47 pm
No new posts Moving a PS file as body of a mail! Vignesh Sid JCL & VSAM 4 Tue Nov 21, 2017 9:23 pm
No new posts unable to set RC = 4 when empty file migusd SYNCSORT 1 Tue Nov 21, 2017 1:21 am

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