Insert line, statement using ISPF Edit Macro



TSO Programming, ISPF, SDF, SDSF and PDF, FTP, TCP/IP Concepts, SNA & SNA/IP etc...

Insert line, statement using ISPF Edit Macro

Postby manesg » Fri Nov 06, 2009 8:44 pm

With an example of an ISPF macro (in the forum) I could change a string in the member.
Now i'm trying to insert a line and include this "PLIST (MYLIST) - " in the inserted line.

JCL - MYREX (Submitting this jcl using REXX - REX3)
//MYEX EXEC PGM=IKJEFT01,PARM='REX3'
//SYSEXEC DD DISP=SHR,DSN=MORIGIN.LOP.JCL
//SYSTSPRT DD SYSOUT=*
//SYSTSIN DD DUMMY
//FILELIST DD *
MORIGIN.MAIL.TEXT(MYMEM)
//*

REXX - REX3 (Called by jcl MYREX)
/* REXX */
ADDRESS ISREDIT "MACRO (STRING)"
ADDRESS ISREDIT "SCAN OFF"
ADDRESS  ISREDIT "SEEK " STRING "FIRST"
LINE1= "PKLIST (MYLIST) - "
IF RC > 0 THEN EXIT
ADDRESS  ISREDIT "(RETAIN) = "CURSOR
ADDRESS  ISREDIT "LINE_AFTER .ZCSR = " (LINE1)
SAVE
EXIT

Member (MYMEM) contents (Need to add line and the string in this member)
//CHECKING FURTHER
ACTION (REPLACE) RETAIN -
MYNAME (PKLIST) -
//*

After insert it should look like
//CHECKING FURTHER
ACTION (REPLACE) RETAIN -
PLIST (MYLIST) -
MYNAME (PKLIST) -
//*

My MYREX job does return RC=0, but no changes in the member.

How do i insert a line after "ACTION" string and add this "PLIST (MYLIST) - " in the line?
If there are multiple lines to be inserted how do i do?
Or any other method? (I have no idea about usage of macro)
manesg
 
Posts: 22
Joined: Thu Jul 17, 2008 11:16 am
Has thanked: 0 time
Been thanked: 0 time

Re: Insert line, statement using ISPF Edit Macro

 

Re: Insert line, statement using ISPF Edit Macro

Postby MrSpock » Sat Nov 07, 2009 3:56 am

I'm not sure what you want to see for a response here. Certainly you can accomplish this task in any number of ways without using an EDIT macro, such as with a SORT step:
//STEP0001 EXEC PGM=SORT                                     
//SORTIN   DD   DATA,DLM=@@                                 
//CHECKING FURTHER                                           
ACTION (REPLACE) RETAIN -                                   
MYNAME (PKLIST) -                                           
//*                                                         
@@                                                           
//SORTOUT  DD   SYSOUT=*                                     
//SYSOUT   DD   SYSOUT=*                                     
//SYSIN    DD   *                                           
  OPTION COPY                                               
  OUTFIL IFTHEN=(WHEN=(1,80,SS,EQ,C'ACTION '),               
    BUILD=(1,80,/,C'PLIST (MYLIST) -'))                     
/*                                                           


or just plain REXX by reading the member, finding the search value (ACTION), and then writing the new (inserted) record before continuing the write the rest of the data.

However, if it's an ISPF Edit Macro that you want, you have a whole bunch of issues that need to be addressed:

1. An ISPF Edit Macro (identified by the ISREDIT command) must be run from an EDIT or VIEW session in ISPF.
2. If you want to run ISPF services in batch you must include ALL of the necessary ISPF library allocations (see your TSO long task for what those are) and you must start ISPF.
3. You have to properly code the parameter to pass between your REXX exec and your ISPF Edit macro.

So, here are some of the changes you need to make:

Your job needs to look more like this:
//MYEX EXEC PGM=IKJEFT01
//SYSEXEC DD DISP=SHR,DSN=MORIGIN.LOP.JCL
//ISPPLIB DD DSN=...
//ISPSLIB DD DSN=...
//ISPMLIB DD DSN=...
//ISPPROF DD DSN=...
//ISPTABL DD DSN=...
//ISPTLIB DD DSN=...
//SYSTSPRT DD SYSOUT=*
//SYSTSIN DD *
 ISPSTART CMD(%MYREXX) NEWAPPL(ISR)     
/*
//FILELIST DD *
MORIGIN.MAIL.TEXT(MYMEM)
/*
//*


The REXX exec MYREXX needs to contain an ISPF EDIT Service Call:
/* REXX */                             
...
"ISPEXEC EDIT DATASET('"the_dataset"') MACRO(REX3) PARM(string)"   
...                                                       
User avatar
MrSpock
Global moderator
 
Posts: 810
Joined: Wed Jun 06, 2007 9:37 pm
Location: Raleigh NC USA
Has thanked: 0 time
Been thanked: 2 times

Re: Insert line, statement using ISPF Edit Macro

Postby manesg » Wed Dec 02, 2009 12:06 pm

Thanks MSpock.
I will trying using REXX because i see that would be easier than the other options you mentioned.
Oh!! BTW sorry for late reply.
manesg
 
Posts: 22
Joined: Thu Jul 17, 2008 11:16 am
Has thanked: 0 time
Been thanked: 0 time


Return to TSO & ISPF

 


  • Related topics
    Replies
    Views
    Last post