View previous topic :: View next topic
|
Author |
Message |
Jitesh Kumar
New User
Joined: 05 Aug 2019 Posts: 1 Location: India
|
|
|
|
My requirement is to process a particular line from a PS file using REXX Macro. For example, Consider a PS file 'ABC.PS'. Now I want to find the first occurrence of a particular account say "10001" and get the entire line (where searched account is found) into a variable for further processing.
I tried this, but it is not working for me.
Code: |
/* REXX */
ADDRESS ISREDIT
"BROWSE DATASET('ABC.PS')"
"FIND '10001' FIRST"
"(CURL,CURC)=CURSOR"
"(LINEDATA)=LINE" CURL
SAY LINEDATA |
Can someone help me ?
Please use the code tags to present code and data (including spool output) |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
Saying something "is not working" is a useless statement to make. HOW is it not working:
- is it not executing at all?
- is it executing but generating an ABEND?
- is it executing without doing anything?
- is it executing but not giving you the desired result? (If this is the case, tell us what result you are getting for the input data and what result you are expecting.)
etc
etc
etc
You have to give us SOMETHING for us to help you -- and telling us that something "is not working" gives us NOTHING. You should be posting whatever output you are getting. |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
Macros are executed against datasets opened in edit or view mode. Why are you trying to browse a dataset within your macro? |
|
Back to top |
|
|
Willy Jensen
Active Member
Joined: 01 Sep 2015 Posts: 712 Location: Denmark
|
|
|
|
As Nic indicates, the find must be done in a seperate macro. Something like the following. Note that I am using VIEW as I offhand cannot remember if an edit macro can be used with browse.
1. REXX script to drive the macro
Code: |
/* REXX */
Address IspExec "VIEW DATASET('ABC.PS') macro(myfind)" |
2. ISPF exit macro named MYFIND
Code: |
/* REXX */
ADDRESS ISREDIT
"FIND '10001' FIRST"
"(CURL,CURC)=CURSOR"
"(LINEDATA)=LINE" CURL
SAY LINEDATA
"END" |
|
|
Back to top |
|
|
Willy Jensen
Active Member
Joined: 01 Sep 2015 Posts: 712 Location: Denmark
|
|
|
|
Another question, is the dataset very big? Personally I would just read the data using EXECIO and scan the text using REXX features. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
if the dataset is large sort should be the first choice, and after that process the output. |
|
Back to top |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
enrico-sorichetti wrote: |
if the dataset is large sort should be the first choice, and after that process the output. |
SORT can easily be executed from within a REXX program.
It is indeed the best option for extracting a few records from a large dataset. |
|
Back to top |
|
|
Willy Jensen
Active Member
Joined: 01 Sep 2015 Posts: 712 Location: Denmark
|
|
|
|
Yup, I agree that SORT is preferred for large datasets. It would be also worthwhile to check if the PIPE program is available. Such a shame that it isn't standard. |
|
Back to top |
|
|
|