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
 

 

Inserting a line into a pgm thru REXX

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
mainfrae
Currently Banned

New User


Joined: 07 Feb 2006
Posts: 4

PostPosted: Thu Feb 09, 2006 3:04 pm    Post subject: Inserting a line into a pgm thru REXX
Reply with quote

Hi
My requirement is to insert a line into a cobol pgm with some requirements
For example,
i will give a input variable thru my REXX code which is declared as a variable in workkingstorage division.

1) That variable should be inserted only in the procedure division only
2) Then if that variable comes inside the procedure division for 10 times in different places, i want to insert 10 lines whereever the variable is found

eg) working-storage section.
ws-eof pic x(10)
procedure division.
ws-eof
------ < = i want to insert here DISPLAY "WS-EOF"
ws-eof
Back to top
View user's profile Send private message

Paddy

New User


Joined: 12 Sep 2005
Posts: 46
Location: Paris France

PostPosted: Fri Feb 10, 2006 12:00 pm    Post subject:
Reply with quote

Hi mainfrae

You can to try this code it should work fine.





Code:
/* rexx                                                               */
/*                                                                    */
/*                                                               Paddy*/
trace o
pull var1 /* keyboard entry  */
DSNIN = 'your source cobol'
DSNOU = 'your output dsn'
INSER = 'text what you want to insert'
/* allocation and stem source */
'ALLOC FI($FIL1) DA('DSNIN') SHR REUSE'
 address MVS 'EXECIO * DISKR $FIL1 (STEM PRO. FINIS'
'FREE FI($FIL1)'
/* read stem and search var1 */
   do i = 1 to pro.0
      search = find(pro.i,var1)
          If search = 0
                    then
                        queue pro.i /* no var1 queue source line only */
                    else
                        do
                          queue pro.I /* var1 OK queue source line    */
                          queue inser /* and queue yr comment         */
                        end
   end
 /* write a new source with your comments */
'ALLOC FI($FIL2) DA('DSNOU') SHR REUSE'
ADDRESS MVS 'EXECIO * DISKW $FIL2 ( FINIS'
'FREE FI($FIL2)'
delstack
exit



Best regards

Paddy icon_smile.gif
Back to top
View user's profile Send private message
mainfrae
Currently Banned

New User


Joined: 07 Feb 2006
Posts: 4

PostPosted: Fri Feb 10, 2006 7:03 pm    Post subject: Re: Inserting a line into a pgm thru REXX
Reply with quote

Thanks paddy
But when i tested this program,it is inserting when it is finding the variable first time.but I had that variable 10 times, i want to insert in 10 separate line also.

is there any way of using line_after and seek command
Back to top
View user's profile Send private message
Paddy

New User


Joined: 12 Sep 2005
Posts: 46
Location: Paris France

PostPosted: Fri Feb 10, 2006 8:09 pm    Post subject:
Reply with quote

hi Mainfrae,

This procedure inserts one line each time when it reach the variable. If one line contain several occurences of the designated variable then the procedure will not work well. Normally it must read each line of source file an reach the variable into. With my test file the procedure has inserted one line every time it reached variable. Perhaps what i not well understood your problem.

Before icon_smile.gif

Code:

******,***************************** Top of Data ******************************
000001,AAAAAAAAAAAAAAAAAAAAAAA
000002,BBBBBBBBBBBBBBBBBBBBB
000003,WEOF
000004,EEEEEEEEEEEEEEEEE
000005,AAAAAAAAAAAAAAAAAAAAAAA
000006,BBBBBBBBBBBBBBBBBBBBB
000007,WEOF
000008,EEEEEEEEEEEEEEEEE
000009,AAAAAAAAAAAAAAAAAAAAAAA
000010,WEOF
000011,END OF PROG
******,**************************** Bottom of Data ****************************


After icon_surprised.gif

Code:

******,***************************** Top of Data ******************************
000001,AAAAAAAAAAAAAAAAAAAAAAA
000002,BBBBBBBBBBBBBBBBBBBBB
000003,WEOF
000004,DISPLAY WEOF
000005,EEEEEEEEEEEEEEEEE
000006,AAAAAAAAAAAAAAAAAAAAAAA
000007,BBBBBBBBBBBBBBBBBBBBB
000008,WEOF
000009,DISPLAY WEOF
000010,EEEEEEEEEEEEEEEEE
000011,AAAAAAAAAAAAAAAAAAAAAAA
000012,WEOF
000013,DISPLAY WEOF
000014,END OF PROG
******,**************************** Bottom of Data ****************************




Regards.

Paddy icon_smile.gif
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. Calling REXX code from ISPF panel sanchita dey TSO/ISPF 4 Mon Jan 02, 2017 5:13 pm
No new posts REXX DB2: Dynamic allocation of DB2.D... BHAS CLIST & REXX 3 Mon Dec 19, 2016 8:26 pm
No new posts find particular member name in PDS us... ravi243 CLIST & REXX 10 Mon Dec 19, 2016 6:44 pm
No new posts What is the command to check MODE of ... rohanthengal CLIST & REXX 7 Fri Nov 18, 2016 1:48 pm
This topic is locked: you cannot edit posts or make replies. Rexx to create GDG by scanning JJ result krish.deepu CLIST & REXX 5 Tue Oct 25, 2016 5:32 pm


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