Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How to search a character in a record with displacement

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler
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    Post subject: How to search a character in a record with displacement
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    Post subject: How to search a character in a record with displacement
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: 755
Location: Germany

PostPosted: Mon Nov 06, 2006 3:25 pm    Post subject:
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    Post subject: Re: How to search a character in a record with displacement
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    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Record Not found in AlX but record re... mukun264 COBOL Programming 5 Fri Mar 24, 2017 9:28 am
No new posts Count the length of the record & ... sreekusr DFSORT/ICETOOL 4 Thu Mar 23, 2017 7:52 pm
No new posts IMS DB-How to update a record (a sing... Nic Clouston IMS DB/DC 9 Thu Mar 09, 2017 4:38 pm
No new posts To Merge mutliple records into a sing... anandgbe DFSORT/ICETOOL 6 Wed Feb 22, 2017 8:49 am
No new posts the use of 'B3'x character in a panel Pedro TSO/ISPF 1 Thu Feb 16, 2017 3:09 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us