Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 757
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 TBSARG - Deleting the search criteria... ISPFHerc TSO/ISPF 5 Thu Dec 14, 2017 8:18 am
No new posts query to fetch record which has only ... maxsubrat DB2 12 Mon Dec 11, 2017 5:03 pm
No new posts Extract record for change in combinat... Trinadh DFSORT/ICETOOL 6 Thu Nov 23, 2017 3:32 pm
No new posts Extract Record using range of Data scorp_rahul23 DFSORT/ICETOOL 3 Wed Nov 15, 2017 11:54 pm
No new posts Squeeze record left so that zeroes ar... Vignesh Sid SYNCSORT 5 Fri Nov 10, 2017 1:40 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us