Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
To get a matching field based on the input parameter

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
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    Post subject: To get a matching field based on the input parameter
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: 1288
Location: Chennai, India

PostPosted: Wed Jul 30, 2008 3:01 pm    Post subject: Reply to: To get a matching field based on the input paramet
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: 8593
Location: Back in jolly old England

PostPosted: Wed Jul 30, 2008 3:31 pm    Post subject:
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: 1243
Location: Israel

PostPosted: Wed Jul 30, 2008 5:34 pm    Post subject:
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

Senior Member


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

PostPosted: Wed Jul 30, 2008 9:40 pm    Post subject: Reply to: To get a matching field based on the input paramet
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    Post subject: Reply to: To get a matching field based on the input paramet
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

Senior Member


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

PostPosted: Fri Aug 01, 2008 11:38 am    Post subject: Re: Reply to: To get a matching field based on the input par
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: 1288
Location: Chennai, India

PostPosted: Fri Aug 01, 2008 2:44 pm    Post subject: Reply to: To get a matching field based on the input paramet
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    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 sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts Execute JCL step based on the content... sprikitik JCL & VSAM 2 Tue Oct 03, 2017 10:03 am
No new posts How to insert a value on specific pos... Poha Eater DFSORT/ICETOOL 9 Sun Oct 01, 2017 3:04 am
No new posts Partial color change of a field in CI... waseem0424 CICS 5 Fri Sep 29, 2017 7:56 pm
No new posts BUILD OUTFIL based on condition other... balaji81_k DFSORT/ICETOOL 13 Fri Sep 08, 2017 11:06 pm

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