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

Reading from File 1 and Writing to File 2


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

New User


Joined: 12 Sep 2013
Posts: 22
Location: India

PostPosted: Thu May 14, 2015 5:49 pm
Reply with quote

I guess this might have got discussed earlier in this Forum but I could not get much info so posting for some assistance here.

I am having a PS File having records like
Code:

Alpha
Beta
Gamma


I need to read this file and write into anothr existing PS File in format
Code:

I AM WRITING Alpha
I AM WRITING Beta
I AM WRITING Gamma


I have a Rexx code written which is not giving any error, but not writing data into output file. Kindly correct me where am doing wrong, or point me to any link where I can refer to

Code:

/* REXX */                                                             
 ADDRESS "TSO"                                                         
        "ALLOC DA('W#E00G.LIST.MEM') F(INDD) SHR REUSE"                 
        "ALLOC DA('W#E00G.LIST.MEM.LMS') F(OUTDD) OLD REUSE"           
         SAY 'COPYING ...'                                             
          "EXECIO * DISKR INDD (FINIS STEM READ1"                       
          DO I = 1 BY 1 UNTIL I = 5                                     
            WRITED.I  = "I AM WRITING" || READ1.I                       
          END                                                           
          "EXECIO * DISKW OUTDD(FINIS STEM WRITED"                     
          SAY 'COPY COMPLETE'                                           
               "FREE F(INDD OUTDD)"                                     
         EXIT                                                           
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


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

PostPosted: Thu May 14, 2015 6:21 pm
Reply with quote

Note that in EXECIO, both for input and output, there is a difference between varname and varname.; the former is not a stem. Change your STEM specifications.
Back to top
View user's profile Send private message
shiitiizz

New User


Joined: 12 Sep 2013
Posts: 22
Location: India

PostPosted: Thu May 14, 2015 6:37 pm
Reply with quote

Thanks icon_smile.gif Worked well...

Code corrected as below:
Code:

/* REXX */                                                             
 ADDRESS "TSO"                                                         
        "ALLOC DA('W#E00G.LIST.MEM') F(INDD) SHR REUSE"                 
        "ALLOC DA('W#E00G.LIST.MEM.LMS') F(OUTDD) OLD REUSE"           
         SAY 'COPYING ...'                                             
          "EXECIO * DISKR INDD (FINIS STEM READ1."                     
          DO I = 1 BY 1 UNTIL I = 5                                     
            WRITED.I  = "I AM WRITING" || READ1.I                       
          END                                                           
          "EXECIO * DISKW OUTDD(FINIS STEM WRITED."                     
          SAY 'COPY COMPLETE'                                           
               "FREE F(INDD OUTDD)"                                     
         EXIT                                                           
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 Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top