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 Search for a string in many PDS KARTHIGADEVI CLIST & REXX 5 Fri Sep 08, 2017 2:32 pm
No new posts Updating the Trailer count in variabl... satheshbabur DFSORT/ICETOOL 6 Wed Aug 30, 2017 9:49 pm
No new posts Repeat part of record multiple times Learncoholic DFSORT/ICETOOL 4 Tue Aug 29, 2017 11:33 am
No new posts Read two inputs and write into output... murali.andaluri DFSORT/ICETOOL 6 Wed Jul 26, 2017 7:35 pm
No new posts Extra character appears in file when ... Balu5491 All Other Mainframe Topics 1 Wed Jul 26, 2017 2:39 pm

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