MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

ISREDIT macros in REXX

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF
View previous topic :: View next topic  
Author Message
psridhar
Beginner


Joined: 16 May 2004
Posts: 68
Topics: 26

PostPosted: Wed Jul 27, 2005 4:20 am    Post subject: ISREDIT macros in REXX Reply with quote

Hi

I need a help in an ISREDIT macro. I have a requirement where I have to open a member ( consisting of COBOL program) of a PDS and check for any uncommented DISPLAY statments in the program. For that I use the following code.

I assume that the return code of the command ( "f all nx " inp ) will be non zero if these is no DISPLAY in the non-excluded lines. But the above command returns zero even if the DISPLAY is not present in non-excluded lines and present in excluded lines. Can anybody help in identifying the word DISPLAY in the non-excluded lines.....

Thanks in advance

Code:
inp = 'DISPLAY'

push inp                                 
                                         
address ispexec                           
"view dataset('"srcds"') macro(chkcobol)"

pull res
                                         
if res = 0 then say inp' exists in 'srcds


chkcobol
--------

/*              REXX             */
address isredit
"macro"
"res"
"x all '*' 7"
pull inp
"f all nx " inp
push rc
"end"
Back to top
View user's profile Send private message
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Wed Jul 27, 2005 4:57 am    Post subject: Reply with quote

psridhar,

When you use FIND ALL, the COUNT (number of occurrences) of the variable is stored in a special variable called FIND_COUNTS. Check for the value stored in this. If this is zero, then no DISPLAY statement is found in the non-excluded portion of the program.

Hope this helps,

cheers,
Phantom
Back to top
View user's profile Send private message
psridhar
Beginner


Joined: 16 May 2004
Posts: 68
Topics: 26

PostPosted: Wed Jul 27, 2005 5:56 am    Post subject: Reply with quote

Hi Phantom,

Thanks for the help. I changed my macro code as follows but no use. No number is being assigned to find_counts. The variable is displayed as it is.

some more input.....??????????

Code:
/*              REXX             */
address isredit
"macro"
"res"
"x all '*' 7"
pull inp
"f all nx " inp
say ' rc for nx ' rc
say ' find_counts ' find_counts
push rc
"end"
Back to top
View user's profile Send private message
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Wed Jul 27, 2005 6:22 am    Post subject: Reply with quote

Psridhar,

FIND_COUNTS cannot be accessed directly. You need to use the ISREDIT command to get the value stored in it.

Code:

ISREDIT (FINDS) = FIND_COUNTS
SAY ' find counts = ' FINDS


Hope this helps,
Thanks,
Phantom
Back to top
View user's profile Send private message
psridhar
Beginner


Joined: 16 May 2004
Posts: 68
Topics: 26

PostPosted: Wed Jul 27, 2005 7:16 am    Post subject: Reply with quote

Hi Phantom,

Thank you very much for the help. Now I could able to trap the number of occurances but still my purpose is not solved. The count includes the DISPLAY statments in the excluded lines also.

Is there any way other than below...

Code:
"x all '*' 7"
pull inp
"f all nx " inp
"(finds) = find_counts"
say finds
Back to top
View user's profile Send private message
taltyman
JCL Forum Moderator
JCL Forum Moderator


Joined: 02 Dec 2002
Posts: 310
Topics: 8
Location: Texas

PostPosted: Wed Jul 27, 2005 7:27 am    Post subject: Reply with quote

This works for me, you'll need to adapt it to your pull/push
Code:
/* REXX */                                                   
"ISREDIT MACRO (A, B, C, D, E, F, G, H, I )"                 
"ISREDIT EXCLUDE ALL"                                       
UPPER A B C D E F G H I                                     
IF  A = 'ALL' THEN A = ''                                   
IF  B = 'ALL' THEN B = ''                                   
IF  C = 'ALL' THEN C = ''                                   
IF  D = 'ALL' THEN D = ''                                   
IF  E = 'ALL' THEN E = ''                                   
IF  F = 'ALL' THEN F = ''                                   
IF  G = 'ALL' THEN G = ''                                   
IF  H = 'ALL' THEN H = ''                                   
IF  I = 'ALL' THEN I = ''                                   
"ISREDIT FIND ALL &A &B &C &D &E &F &G &H &I"               
"ISREDIT (FINDS) = FIND_COUNTS"                             
SAY ' find counts = ' FINDS                                 
Back to top
View user's profile Send private message
psridhar
Beginner


Joined: 16 May 2004
Posts: 68
Topics: 26

PostPosted: Wed Jul 27, 2005 11:07 pm    Post subject: Reply with quote

anybody......... please help me.....

I could not able to limit my search only for non-excluded lines......

neither the return code (rc) nor finds help me.....

it is including the excluded lines also in its search.......

rc = 0 and finds = 7 for a cobol program in which i have 7 DISPLAYs in commented code ....

Code:
"x all '*' 7"
"f all nx DISPLAY"
"(finds) = find_counts"
say finds
say rc
Back to top
View user's profile Send private message
semigeezer
Supermod


Joined: 03 Jan 2003
Posts: 1014
Topics: 13
Location: Atlantis

PostPosted: Wed Jul 27, 2005 11:49 pm    Post subject: Reply with quote

If your file has valid sequence numbers in column 1 through 6, that is you are in NUM COBol mode, then physical column 7 is column 1 to the macro. In other words, the columns used in edit macros are relative to the data portion of the record, or put another way, the column numbers used by edit macros don't include sequence numbers.

Something like this will work
Code:
'(NUM,COB) = NUMBER'
Parse Var cob . cob .
If num='ON' & cob='COBOL' Then
  col = 1
Else
  col=7
"X ALL '*' " col
"F ALL NX 'DISPLAY' WORD"
"(FINDS) = FIND_COUNTS"
Say finds


This still isn't quite right still because 'F ... WORD' will not get rid of something like DISPLAY-VAR. The find should probably be for ' DISPLAY ' (notice spaces at front and end)
Back to top
View user's profile Send private message Visit poster's website
psridhar
Beginner


Joined: 16 May 2004
Posts: 68
Topics: 26

PostPosted: Thu Jul 28, 2005 1:53 am    Post subject: Reply with quote

Hi friend,

that is excallent..... the macro is serving my purpose now.... thank you very much for the help......

Thanks
Sridhar P
Back to top
View user's profile Send private message
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Thu Jul 28, 2005 3:04 am    Post subject: Reply with quote

Quote:

that is you are in NUM COBol mode, then physical column 7 is column 1 to the macro


Hmmm....I never knew this...I learned something new today...Thanks for the info Semigeezer.

Regards,
Phantom
Back to top
View user's profile Send private message
tattva
Beginner


Joined: 02 Feb 2005
Posts: 97
Topics: 36

PostPosted: Tue Aug 02, 2005 11:25 am    Post subject: Reply with quote

Just want to know more about ISREDIT

an any one post any useful for the same?

Thanks,
tattva
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Tue Aug 02, 2005 11:56 am    Post subject: Reply with quote

tattva,

ISREDIT is the environment in which ISPF/PDF EDIT commands execute. The ISPEXEC and ISREDIT host command environments are available only to REXX execs that run in ISPF. Use the environments to invoke ISPF commands and services, and ISPF edit macros.

When you invoke a REXX exec from ISPF, the default initial host command environment is TSO. You can use the ADDRESS instruction to use an ISPF service. The ISREDIT environment lets you issue ISPF edit macros. To use ISREDIT, you must be in an edit session.


Hope this helps...

Cheers

kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group