View previous topic :: View next topic
|
Author |
Message |
karthikeyan r
New User
Joined: 12 Jul 2008 Posts: 7 Location: Chennai
|
|
|
|
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 |
|
|
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
|
|
|
|
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 |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
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 |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
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 |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2546 Location: Silicon Valley
|
|
|
|
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 |
|
|
karthikeyan r
New User
Joined: 12 Jul 2008 Posts: 7 Location: Chennai
|
|
|
|
Dear All,
Thank you for all of your suggestions. With that, I have done the code. Its working fine. |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
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 |
|
|
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
|
|
|
|
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 |
|
|
|