View previous topic :: View next topic |
Author |
Message |
Manick Beginner
Joined: 24 May 2010 Posts: 6 Topics: 3
|
Posted: Thu May 27, 2010 1:52 am Post subject: To Read upto a particular Column |
|
|
Hi,
I have a dataset of length 133 and i need to read the contents only upto column 72 from it. Is there anyway to do it using Edit macros or REXX? |
|
Back to top |
|
 |
expat Intermediate

Joined: 01 Mar 2007 Posts: 475 Topics: 9 Location: Welsh Wales
|
Posted: Thu May 27, 2010 4:13 am Post subject: |
|
|
Yes. _________________ If it's true that we are here to help others,
then what exactly are the others here for ? |
|
Back to top |
|
 |
Manick Beginner
Joined: 24 May 2010 Posts: 6 Topics: 3
|
Posted: Thu May 27, 2010 5:17 am Post subject: |
|
|
Can you please let me know the macro or the REXX Command to get this done? |
|
Back to top |
|
 |
Nic Clouston Advanced
Joined: 01 Feb 2007 Posts: 1075 Topics: 7 Location: At Home
|
Posted: Thu May 27, 2010 6:47 am Post subject: |
|
|
read the record into a variable
use substr bif to replace the variable with the first 72 bytes
e.g
Code: |
EXECIO 1 ddame(stem var) /* puts record into var1 */
var1 = substr(var1,1,72)
|
_________________ Utility and Program control cards are NOT, repeat NOT, JCL. |
|
Back to top |
|
 |
expat Intermediate

Joined: 01 Mar 2007 Posts: 475 Topics: 9 Location: Welsh Wales
|
Posted: Thu May 27, 2010 6:48 am Post subject: |
|
|
Please explain in a little more detail exactly what it is that you wish to accomplish, because with the information given in your original post it just begged for a YES/NO answer, which I happily gave.
Do you wish to retain the original dataset in its untouched state (recommended) or do you want to butcher that dataset - hopefully backed up beforehand.
What have you tried so far
My preferred method would be to read the original dataset into a stem, and then substring the records into a new output dataset, thus retaining the data integrity of the original input. _________________ If it's true that we are here to help others,
then what exactly are the others here for ? |
|
Back to top |
|
 |
Manick Beginner
Joined: 24 May 2010 Posts: 6 Topics: 3
|
Posted: Fri May 28, 2010 12:35 am Post subject: |
|
|
Hi Nic and expat,
Thanks for your replies. I used the SUBSTR command and it worked fine. I just need to read the records in to a STEM and then do some process on it. One of them is to remove the data after the 72nd column.
I did as Nic explained, by moving it to a variable and then use the SUBSTR command and it worked fine. |
|
Back to top |
|
 |
|
|