View previous topic :: View next topic |
Author |
Message |
newuser Beginner
Joined: 12 Jun 2003 Posts: 16 Topics: 8
|
Posted: Tue Aug 03, 2004 4:13 pm Post subject: Retrieve Data from a relative location - rexx/utilities |
|
|
Hi,
I need to read a file and check if the string '000300002000' is present anywhere in the record. If the string is present, then I need to navigate forward 249 bytes from this(start of 000300002000) position and retrieve 35 bytes at that location.
Suppose, the string '000300002000' is found for one record at 130th offset, then I from 130th offset I need to navigate 249 bytes forward (that is 130+249=) 379th offset. I need to retreive 35 bytes starting from 379th offset and put it into an output file.
Can somebody please share a sample rexx for this
cheers |
|
Back to top |
|
 |
moyeenkhan Beginner
Joined: 04 Dec 2002 Posts: 64 Topics: 21
|
Posted: Tue Aug 03, 2004 5:32 pm Post subject: |
|
|
Code: |
EXECIO * DISKR ddname (STEM xData. FINIS'
Do I = 1 By 1 Until I=xData.0
nPos=Pos('000300002000',xData.I)
If nPos>0 Then Do
nNewPos=nPos+249
xNeededData=Substr(xData.I,nNewPos,35)
Say xNeededData
End
End
|
Hope this helps |
|
Back to top |
|
 |
|
|