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

Move a particular line from a PS file into a variable


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

New User


Joined: 05 Aug 2019
Posts: 1
Location: India

PostPosted: Mon Aug 05, 2019 2:48 am
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8697
Location: Dubuque, Iowa, USA

PostPosted: Mon Aug 05, 2019 3:27 am
Reply with quote

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
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Mon Aug 05, 2019 3:47 am
Reply with quote

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
View user's profile Send private message
Willy Jensen

Active Member


Joined: 01 Sep 2015
Posts: 712
Location: Denmark

PostPosted: Mon Aug 05, 2019 1:52 pm
Reply with quote

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
View user's profile Send private message
Willy Jensen

Active Member


Joined: 01 Sep 2015
Posts: 712
Location: Denmark

PostPosted: Mon Aug 05, 2019 1:54 pm
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Mon Aug 05, 2019 2:24 pm
Reply with quote

if the dataset is large sort should be the first choice, and after that process the output.
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Mon Aug 05, 2019 8:04 pm
Reply with quote

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
View user's profile Send private message
Willy Jensen

Active Member


Joined: 01 Sep 2015
Posts: 712
Location: Denmark

PostPosted: Mon Aug 05, 2019 8:22 pm
Reply with quote

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
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 Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top