Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Move a particular line from a PS file into a variable

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
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    Post subject: Move a particular line from a PS file into a variable
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: 8499
Location: Dubuque, Iowa, USA

PostPosted: Mon Aug 05, 2019 3:27 am    Post subject: Reply to: Move a particular line from a PS file into a variable
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: 2247
Location: Hampshire, UK

PostPosted: Mon Aug 05, 2019 3:47 am    Post subject: Reply to: Move a particular line from a PS file into a variable
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 User


Joined: 01 Sep 2015
Posts: 323
Location: Denmark

PostPosted: Mon Aug 05, 2019 1:52 pm    Post subject:
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 User


Joined: 01 Sep 2015
Posts: 323
Location: Denmark

PostPosted: Mon Aug 05, 2019 1:54 pm    Post subject:
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

Senior Member


Joined: 14 Mar 2007
Posts: 10632
Location: italy

PostPosted: Mon Aug 05, 2019 2:24 pm    Post subject: Reply to: Move a particular line from a PS file into a variable
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: 1330
Location: Israel

PostPosted: Mon Aug 05, 2019 8:04 pm    Post subject: Re: Reply to: Move a particular line from a PS file into a variable
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 User


Joined: 01 Sep 2015
Posts: 323
Location: Denmark

PostPosted: Mon Aug 05, 2019 8:22 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts File transfer issue with end of line ... VINAY PALLELA TSO/ISPF 4 Thu Nov 14, 2019 12:01 am
No new posts File compare, where file has header a... VINAY PALLELA SYNCSORT 8 Thu Nov 07, 2019 5:05 pm
No new posts OMIT first and last column of a pipe-... karthikb_itpro DFSORT/ICETOOL 1 Fri Nov 01, 2019 8:24 pm
No new posts How to place name of the file where t... danielgp89 SYNCSORT 18 Thu Oct 17, 2019 12:55 am
No new posts Need help in parsing record in VBA file guptae DFSORT/ICETOOL 4 Fri Oct 11, 2019 2:31 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us