View previous topic :: View next topic
|
Author |
Message |
munna_ibm
New User
Joined: 23 Apr 2005 Posts: 13 Location: chennai
|
|
|
|
Hi All,
How to find a specific characters in a record with displacements from the starting of the record, this has to be read all the records in a file. Can anyone send me logic of the code. Is there any macro to do it.
Thanks in Advance |
|
Back to top |
|
|
munna_ibm
New User
Joined: 23 Apr 2005 Posts: 13 Location: chennai
|
|
|
|
Hi All,
How to find a specific characters in a record with displacements from the starting of the record, this has to be read all the records in a file. Can anyone send me logic of the code. Is there any macro to do it.
This has to be coded in Assembler
Thanks in Advance |
|
Back to top |
|
|
UmeySan
Active Member
Joined: 22 Aug 2006 Posts: 771 Location: Germany
|
|
|
|
Morning Sir !
If i understood correctly...
You can loop trough all bytes of the records to find your char and increase a counter by doing that until you find that char.
Also you can use TRT to do that. First you have to declare the char in a table. Then you run TRT over the record. When TRT stops, in Register-1
you have the adress of your char (byte) within record, and in Register-2 is that char. So now subtract from R1 the adress of the Record-Start and you have the counter, that means, wich position has that char within the record.
1.)
LA R4,Record-Start
LA R9,Record_End
LA R5,Char
LA R6,= F'01'
Loop_Through DS 0H
CLI 0(R4),0(R5)
BE Get_It
A R6,=F'01'
LA R4, 1(R4)
CR R4,R9
BNH Loop_Through
Not-Found DS 0H
Get_It DS 0H
R4 = position of CHAR in Record
R6 = counter
2.)
SR R7,R7 ...Clean Register
IC R7,Rec_Length ...Insert Length of Record
LA R4,Record_Start ...Load Adress of Record
LA R5,TabTrt ...Load Adress of Table
Loop_Over DS 0H
EX R7,EXTRT ...Do Record-Scan
BZ Not_Found ...Nothing Found
Char_Found DS 0H
R1 = Adress of Char in Record
SR R1,R4 R1=Counter for ex. byte 57 is position of Char in record
EXTRT TRT 0(*-*,R4),0(R5)
In the Table, define all legal Chars with hex'00' and that special char you are looking for with X'FF'.
Regards, UmeySan |
|
Back to top |
|
|
munna_ibm
New User
Joined: 23 Apr 2005 Posts: 13 Location: chennai
|
|
|
|
Hi Umey,
Thanks a lot yar, its very helpful for me.
I thanq once again!! |
|
Back to top |
|
|
|