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

unable to insert a string in sequential file using REXX


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

New User


Joined: 08 Nov 2006
Posts: 21
Location: india

PostPosted: Wed Nov 08, 2006 12:34 pm
Reply with quote

hi all.....

my requirement is
1. there is a seqential file .. TEBTOTS.REXX.DSN1

it is having a 1 string ...
FRANK
2. now i want to insert 3 strings 'BLUE' ,'RED' , 'ORANGE' after the string 'FRANK'

i have written a following REXX code for this requirement

Code:

/* REXX */                                                         
STRING = 'FRANK'                                                   
ADDRESS ISPEXEC 'VPUT STRING'                                     
ADDRESS ISPEXEC "EDIT DATASET('TEBTOTS.REXX.DSN1') MACRO(MYMACRO)"
EXIT                                                               


MYMACRO:
Code:

/* REXX*/
ADDRESS ISREDIT "MACRO (STRING)"                                   
ADDRESS ISREDIT "SCAN OFF"                                         
ADDRESS  ISREDIT "SEEK " STRING " FIRST"                           
LINE3 = 'BLUE'                                                     
LINE2 = 'RED'                                                     
LINE1 = 'ORANGE'                                                   
"F" STRING                                                         
IF RC > 0 THEN EXIT                                               
ADDRESS  ISREDIT "(FRED) = "CURSOR                                 
ADDRESS  ISREDIT "LINE_AFTER "FRED " = " (LINE1)                   
ADDRESS  ISREDIT "LINE_AFTER "FRED+1"= " (LINE2)                   
ADDRESS  ISREDIT "LINE_AFTER "FRED+2"= " (LINE3)                   
ADDRESS ISREDIT "SAVE"                             
RETURN                                             


* but when i execute this code i m able to get in to the dataset TEBTOTS.REXX.DSN1 in the edit mode ..... but i m getting a following error msg.......

IKJ56500I COMMAND MYMACRO NOT FOUND
***

...... it is not able to find the macro MYMACRO .....
icon_arrow.gif i m new to REXX ... can anyone help in executing this code properly.....
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2358
Location: Israel

PostPosted: Wed Nov 08, 2006 3:20 pm
Reply with quote

Put MYMACRO in the same library as your first REXX.

O.
Back to top
View user's profile Send private message
amolj

New User


Joined: 08 Nov 2006
Posts: 21
Location: india

PostPosted: Wed Nov 08, 2006 4:56 pm
Reply with quote

hi ofer71...

actually i m using internal macro ... so MYMACRO is present in the code itself...
also i tried by the following way ...

ADDRESS ISPEXEC "EDIT DATASET('TEBTOTS.REXX.DSN1') MACRO()"
CALL MYMACRO

.... by calling it seperately...
but i m not sure whether my above approach is correct ???

please help me...
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2358
Location: Israel

PostPosted: Wed Nov 08, 2006 5:21 pm
Reply with quote

Quote:
actually i m using internal macro ... so MYMACRO is present in the code itself...


This is the first time I encounter the term "internal macro". Can you please explain what do you mean by that?

O.
Back to top
View user's profile Send private message
amolj

New User


Joined: 08 Nov 2006
Posts: 21
Location: india

PostPosted: Wed Nov 08, 2006 5:39 pm
Reply with quote

... internal macro .. means ...the macro is just after the code in same file .... following is my code



/* REXX */
STRING = 'FRANK'
ADDRESS ISPEXEC 'VPUT STRING'
ADDRESS ISPEXEC "EDIT DATASET('TEBTOTS.REXX.DSN1') MACRO()"
CALL MYMACRO
EXIT
MYMACRO:
ADDRESS ISREDIT "MACRO (STRING)"
ADDRESS ISREDIT "SCAN OFF"
ADDRESS ISREDIT "SEEK " STRING " FIRST"
LINE3 = 'BLUE'
LINE2 = 'RED'
LINE1 = 'ORANGE'
ADDRESS ISREDIT "FIND" STRING
ADDRESS ISREDIT "(FRANK) = "CURSOR
ADDRESS ISREDIT "LINE_AFTER " LINE1
ADDRESS ISREDIT "SAVE"
RETURN

..... THE MACRO IS PRESENT in the code itself....
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2358
Location: Israel

PostPosted: Wed Nov 08, 2006 5:44 pm
Reply with quote

This is an internal routine.

Edit macros must be saved as seperate members. First statement of the edit-macro member must be "address isredit macro...".

O.
Back to top
View user's profile Send private message
amolj

New User


Joined: 08 Nov 2006
Posts: 21
Location: india

PostPosted: Wed Nov 08, 2006 5:58 pm
Reply with quote

hi ...

i tried by keeping MYMACRO as a seperate member in the same PDS where rexx code is present .....

it is giving the same error command MYMACRO not found....

please help me...
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2358
Location: Israel

PostPosted: Wed Nov 08, 2006 7:05 pm
Reply with quote

Here is the explanation from the fine manual:
Quote:
Explanation: A CLIST or REXX exec to be implicitly executed could not be found. The error message displays the command that was not found. Check that the command you specified is valid or spelled correctly.


Please re-check the name of the member and the name supplied in the EDIT service.

O.
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 Compile Several JCL JOB Through one r... CLIST & REXX 4
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
Search our Forums:

Back to Top