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

To get a matching field based on the input parameter


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

New User


Joined: 12 Jul 2008
Posts: 7
Location: Chennai

PostPosted: Wed Jul 30, 2008 1:11 pm
Reply with quote

Sir,

I want to read a dataset after 82 records(ignore first 82 records and then process till end). Based on the input got from the user, i want to get a field value from the input file.
Following is the sample of records in the input dataset.
=COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+--
000083 AUTOMATED TOOLS AT 000 R&TYU
000084 CRYSTAL ORIENTED CO 001 R&TYU
000085 REXX/FORTRAN JCL RF 001 R&TYU
000086 BALANCE IMMITTAT BL 005 R&YUI
000087 GUEST APPROACED GA 010 X R&I78

Here, by getting the input value AT from the user, i want to give matching output as 000.
Can you help me on this?
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1287
Location: Chennai, India

PostPosted: Wed Jul 30, 2008 3:01 pm
Reply with quote

Karthikeyan,

Quote:
want to read a dataset after 82 records(ignore first 82 records and then process till end). Based on the input got from the user, i want to get a field value from the input file.


Have Assumed that the position/length of each field is fixed. Try the foll approach

- get the input from the user (PULL command)
- read the dataset into a stem (EXECIO * diskr command)
- loop and do nothing till the value is 83 (NOP command)
- find whether the inputed value is present in the line (use POS command)
if found
get the 3 bytes after shifting 3 bytes to the right (LEFT, RIGHT )
else
check the next line

- write the extracted data to an output file/ user
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Wed Jul 30, 2008 3:31 pm
Reply with quote

Just a couple of deviations from what Aaru has suggested.

Quote:
- get the input from the user (PULL command)

Or use a value entered into a displayed panel

Quote:
- loop and do nothing till the value is 83 (NOP command)

Or just start at the 83rd record

DO X = 83 TO stem.0
program logic in here
END
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Wed Jul 30, 2008 5:34 pm
Reply with quote

Another way for starting at record 83:
Code:
"EXECIO * DISKR myfile 83 (FINIS STEM data."


Quote:
=COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+--
000083 AUTOMATED TOOLS AT 000 R&TYU
000084 CRYSTAL ORIENTED CO 001 R&TYU

If you had used the "code" tag, we could have known if the data is aligned:
Code:
=COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+--
000083 AUTOMATED TOOLS         AT 000 R&TYU
000084 CRYSTAL ORIENTED        CO 001 R&TYU
Back to top
View user's profile Send private message
Pedro

Global Moderator


Joined: 01 Sep 2006
Posts: 2546
Location: Silicon Valley

PostPosted: Wed Jul 30, 2008 9:40 pm
Reply with quote

Quote:
- find whether the inputed value is present in the line (use POS command)
if found


Be careful of finding the search text, for example 'AT', in another part of the record. That is, you cannot just check if the value is present in the line, but whether it is in the correct position on the line.[/code]
Back to top
View user's profile Send private message
karthikeyan r

New User


Joined: 12 Jul 2008
Posts: 7
Location: Chennai

PostPosted: Thu Jul 31, 2008 5:37 pm
Reply with quote

Dear All,

Thank you for all of your suggestions. With that, I have done the code. Its working fine.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Fri Aug 01, 2008 11:38 am
Reply with quote

Hi,
karthikeyan r wrote:
... With that, I have done the code. Its working fine.
For the benefits of others, like me, please post the code - pseudo code.
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1287
Location: Chennai, India

PostPosted: Fri Aug 01, 2008 2:44 pm
Reply with quote

Karthi,

Quote:
Thank you for all of your suggestions. With that, I have done the code. Its working fine.


Good to hear. You are welcome.
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 Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts force tablespace using LISTDEF input DB2 1
No new posts Two input files & writing counter... DFSORT/ICETOOL 12
No new posts Using the Jobname parameter in a Qual... ABENDS & Debugging 1
Search our Forums:

Back to Top