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

Read and display current line of file


IBM Mainframe Forums -> TSO/ISPF
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
saagu

New User


Joined: 15 May 2008
Posts: 41
Location: Chennai

PostPosted: Tue Mar 02, 2010 3:15 pm
Reply with quote

I want the macro program to locate the specified string and display the found line of data from the file. I've written the following code to accomplish the task. But, I'm unable to display the current line. Please let me know on how to display the current line.

Sample call: TSO Lend 1234

File: AAAAA.XXXXX.LIST.OLD:

1234 Wipro
5678 TCS
1235 GOOGLE

ABCD.PDS.REXX(Lend):
ARG IP
ADDRESS ISPEXEC "VPUT (IP) SHARED"
ADDRESS ISPEXEC "VIEW DATASET('AAAAA.XXXXX.LIST.OLD') MACRO(RECSMAC)"

ABCD.PDS.REXX(Recsmac):


ADDRESS ISREDIT "MACRO PROCESS"
ADDRESS ISREDIT "RES"
ADDRESS ISPEXEC "VGET IP"
ADDRESS ISREDIT "FIND &IP"
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8796
Location: Welsh Wales

PostPosted: Tue Mar 02, 2010 3:32 pm
Reply with quote

Click HERE to read the manual that will show you how.
Back to top
View user's profile Send private message
saagu

New User


Joined: 15 May 2008
Posts: 41
Location: Chennai

PostPosted: Tue Mar 02, 2010 3:39 pm
Reply with quote

Can you give me a small hint on this...(just a keyword to be used will suffice....)
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8796
Location: Welsh Wales

PostPosted: Tue Mar 02, 2010 3:46 pm
Reply with quote

Well as I'm in a particularly good mood and you obviously can't be arsed to look for yourself.

One and only clue 3.3.16 but you will need another keyword / section to do what you want.
That I will leave for you to figure out.
Back to top
View user's profile Send private message
saagu

New User


Joined: 15 May 2008
Posts: 41
Location: Chennai

PostPosted: Tue Mar 02, 2010 5:02 pm
Reply with quote

I have modified the macro code as per your suggestion:

ADDRESS ISREDIT "MACRO PROCESS"
ADDRESS ISREDIT "RES"
ADDRESS ISPEXEC "VGET IP"
ADDRESS ISREDIT "FIND &IP"

ADDRESS ISREDIT KINE = CURSOR
ADDRESS ISPEXEC
SAY 'KINE:' KINE


But its giving return code 20(severe error)
Can we use CURSOR in macro? Is that the problem?
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8796
Location: Welsh Wales

PostPosted: Tue Mar 02, 2010 5:19 pm
Reply with quote

saagu wrote:
But its giving return code 20(severe error)

Perhaps if you would care to compare your syntax against that in the example shown in the manual you might see a subtle difference.

saagu wrote:
Can we use CURSOR in macro? Is that the problem ?

With the manual having the title "z/OS V1R9.0 ISPF Edit and Edit Macros" and the CURSOR section contained in the manual I would hazard a very very sure guess that YES you can use CURSOR in the macro.
Back to top
View user's profile Send private message
saagu

New User


Joined: 15 May 2008
Posts: 41
Location: Chennai

PostPosted: Tue Mar 02, 2010 6:03 pm
Reply with quote

Now changed it to


ADDRESS ISREDIT (LINE) = CURSOR
ADDRESS ISPEXEC
SAY 'LINE:' LINE


Still the problem persists.... icon_cry.gif

Also tried,
ADDRESS ISREDIT (KINE) = CURSOR
ADDRESS ISPEXEC
SAY 'KINE:' KINE
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8796
Location: Welsh Wales

PostPosted: Tue Mar 02, 2010 6:16 pm
Reply with quote

Post the complete code for the edit macro, and please use the vb code tags.
Back to top
View user's profile Send private message
saagu

New User


Joined: 15 May 2008
Posts: 41
Location: Chennai

PostPosted: Tue Mar 02, 2010 6:22 pm
Reply with quote

ABCD.PDS.REXX(Recsmac):

Code:
ADDRESS ISREDIT "MACRO PROCESS"
ADDRESS ISREDIT "RES"
ADDRESS ISPEXEC "VGET IP"
ADDRESS ISREDIT "FIND &IP"

ADDRESS ISREDIT (LINE) = CURSOR
ADDRESS ISPEXEC
SAY 'LINE:' LINE


Also tried using KINE in place of LINE but the problem is not solved
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Tue Mar 02, 2010 6:52 pm
Reply with quote

Try this to figure out what options you want:

Code:

/* REXX */                           
"ISREDIT MACRO"                       
"ISREDIT (line,column) = CURSOR"     
"ISREDIT (data) = LINE .zcsr"         
Say line column                       
Say data                             
Exit 0                               
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8796
Location: Welsh Wales

PostPosted: Tue Mar 02, 2010 7:06 pm
Reply with quote

And have you noticed a subtle difference between the ISREDIT statements before the last one.
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Tue Mar 02, 2010 7:14 pm
Reply with quote

saagu wrote:
ABCD.PDS.REXX(Recsmac):

Code:
ADDRESS ISREDIT "MACRO PROCESS"
ADDRESS ISREDIT "RES"
ADDRESS ISPEXEC "VGET IP"
ADDRESS ISREDIT "FIND &IP"

ADDRESS ISREDIT (LINE) = CURSOR
ADDRESS ISPEXEC
SAY 'LINE:' LINE


Also tried using KINE in place of LINE but the problem is not solved

In your opinion, how important are the quotes used in the 4 first lines ?
And I'm curious, what is the ADDRESS ISPEXEC doing there ?
Back to top
View user's profile Send private message
saagu

New User


Joined: 15 May 2008
Posts: 41
Location: Chennai

PostPosted: Wed Mar 03, 2010 10:47 am
Reply with quote

Its working now.....Thank you.....
Back to top
View user's profile Send private message
saagu

New User


Joined: 15 May 2008
Posts: 41
Location: Chennai

PostPosted: Wed Mar 03, 2010 11:17 am
Reply with quote

Now the working code is:

ABCD.PDS.REXX(Recsmac):
Code:
ADDRESS ISREDIT "MACRO PROCESS"       
ADDRESS ISREDIT "RES"                 
ADDRESS ISPEXEC "VGET IP"             
ADDRESS ISREDIT "FIND &IP"             
ADDRESS ISREDIT "(LINE) = CURSOR"   
ADDRESS ISREDIT "(DATA) = LINE .ZCSR"
SAY LINE                             
SAY DATA                             
ADDRESS ISREDIT "CANCEL"   


Now, after doing FIND in the above code, I want to know whether the search string is found or not. Based on the status(Found/Not found), I want to change my code to handle the situation. i.e., i want to know the key word variable where the execution status of FIND is stored.
Back to top
View user's profile Send private message
saagu

New User


Joined: 15 May 2008
Posts: 41
Location: Chennai

PostPosted: Wed Mar 03, 2010 12:13 pm
Reply with quote

I found the solution....used FIND_COUNTS to find the count after FIND
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Wed Mar 03, 2010 11:24 pm
Reply with quote

You could also check the rc of the find command....

0 = found
4 = not found

Code:

ADDRESS ISREDIT "FIND &IP" 
findrc = rc
say 'findrc -' findrc
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 -> TSO/ISPF

 


Similar Topics
Topic Forum Replies
No new posts Unable to interpret a hex value to De... COBOL Programming 4
No new posts how to eliminate null indicator value... DB2 7
No new posts Format Binary file to EBCDIC JCL & VSAM 4
No new posts Binary File format getting change whi... All Other Mainframe Topics 7
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
Search our Forums:

Back to Top