IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to search a character in a record with displacement


IBM Mainframe Forums -> PL/I & Assembler
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
munna_ibm

New User


Joined: 23 Apr 2005
Posts: 13
Location: chennai

PostPosted: Mon Nov 06, 2006 2:30 pm
Reply with quote

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
View user's profile Send private message
munna_ibm

New User


Joined: 23 Apr 2005
Posts: 13
Location: chennai

PostPosted: Mon Nov 06, 2006 2:33 pm
Reply with quote

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
View user's profile Send private message
UmeySan

Active Member


Joined: 22 Aug 2006
Posts: 771
Location: Germany

PostPosted: Mon Nov 06, 2006 3:25 pm
Reply with quote

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
View user's profile Send private message
munna_ibm

New User


Joined: 23 Apr 2005
Posts: 13
Location: chennai

PostPosted: Tue Nov 07, 2006 10:16 am
Reply with quote

Hi Umey,

Thanks a lot yar, its very helpful for me.


I thanq once again!!
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> PL/I & Assembler

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Search two or more word with FILEAID Compuware & Other Tools 15
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
Search our Forums:

Back to Top