View previous topic :: View next topic
|
Author |
Message |
srikanthkailasam
New User
Joined: 13 Nov 2006 Posts: 24 Location: Bengalooru
|
|
|
|
I have a flat file of LRECL 8000. I have to search for the string 'ABC='. If present, then I have to extract into a new variable starting from 'ABC=' till the first occurence of '/'. I am not worried about the rest of the data.
Please note that the position of 'ABC=' is not fixed and will vary from one record to another. I can use INSPECT to check for the existence of 'ABC=' but how can I put it into a new variable.
Please suggest a solution for this. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Once you find the 'ABC=' move the characters one at a time to the "output" area (using reference modification on both the input and the output) until you hit the '/'. |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
Hi,
What code you have been using for this, please show us that - we might start from there . . . |
|
Back to top |
|
|
srikanthkailasam
New User
Joined: 13 Nov 2006 Posts: 24 Location: Bengalooru
|
|
|
|
Thanks Dick and Anuj for your replies.
Anuj,
I was thinking in the same line as Dick... I will start reading my input file as a group of 4 bytes and when I hit 'ABC=', then start procedding byte by bte until I hit '/'.. |
|
Back to top |
|
|
srikanthkailasam
New User
Joined: 13 Nov 2006 Posts: 24 Location: Bengalooru
|
|
|
|
Code: |
MOVE WS-TEXT (A:4) TO HOLD-VAR
IF HOLD-VAR = 'ABC='
PERFORM UNTIL WS-TEXT(A:1) = '/'
MOVE WS-TEXT (A:1) TO FINAL-VAR(B:1)
ADD +1 TO B A
END-PERFORM
SET RECORD-DONE TO TRUE
ELSE
ADD +1 TO A
END-IF. |
The above code is working. Thanks Dick and Anuj for your time. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
You're welcome - thank you for letting us know it is working
d |
|
Back to top |
|
|
|