Correction: 
MVC uses a length CODE. Thus, if you load 5 into your EX register, the actual 
move is SIX bytes.

Second, the sequence used will execute the TRT once for 1 byte, then repeat the 
TRT for 6 bytes. The target of an EX instruction must NOT be inline.

The search for the character can also be achieved using the SRST (search 
string) instruction, if you have a Z990 or later:
Assuming you are searching for C'ABC', and the R4 points to the record:
LA R5,L'RECORD(,R4)
LHI R0,C'A'
SRST R5,R4

After the SRST, the condition code will be set indicating
a) Found - R5 points to the found byte
b) Not found - R4 and R5 unchanged
c) Not found yet - R4 points to the next byte to be examined, so you can just 
loop back to the SRST.

The POPS states that SRST will stop after a 'CPU-determined' number of bytes 
have been examined, which will be at least 256 bytes. This is where the 'not 
found yet' condition comes in.

Pieter Wiid

From: [email protected]
Sent: 2013/11/21 04:24:24 AM
To: [email protected]
Cc:
Subject: RE: Re: Moves and others  What doesn't like the MVC 0(1,R5),0(R9)? 
What do you mean by this?

Maybe you could include the code snippet that you can't get working and 
possibly an example of one of the records with what you want it to do. It's not 
clear what results you are looking for.

Rather than moving the data to the 8 byte work field, you could calculate the 
length you want to move and then move it.
 LA R3,5 Counter for EX
MOVE MVC WORKAREA(0),0(R9) Move instruction for execute
 EX R3,MOVE Move 5 bytes

To speed up the search, you can use the TRT instruction to search for the first 
character and then do your compare

 LA R3,20 Length to search
TRT TRT 0(0,R9),TRT_TAB
 EX R3,TRT Search for the character
 JZ Notfound
 CLC =C'ABC',0(R1) Did we find it?
 JNE MATCH

TRT_TAB DC 256AL1(0)
 ORG TRT_TAB+C'A' We want to find an "A"
 DC C'A'
 ORG ,


Obviously this is not complete (you need to check lengths and various other 
things but it will get you started.

Jon Perryman.


>________________________________
> From: Rich Long 
>
>Issue I am facing - reading fixed length records, then searching for a fixed 
>length character string. Once I
>find that string, there is a need to check the next 8 bytes to see how much 
>data follows. It could
>be 1-8 characters in length. Finding the fixed piece is easy enough. When 
>checking the variable
>part, I check for a blank. If non-blank, I need to save that byte into an 8 
>character field for
>use later. Having an issue saving off the one character at a time. Trying to 
>use an index
>register to keep track of the 8 byte field, so I know where to put the next 
>byte, if necessary.
>It doesnt't like the move - MVC 0(1,R5),0(R9). R5 is supposed to be tracking 
>the 8 byte field
>location, and R9 is the input record. LA R5,WORKAREA was used to point at the 
>8 byte field.
>I will then need to do another move of this variable length field to an output 
>record.
>It's sort of along the same line, moving the variable length field (1-8 
>characters) in the
>middle of some other fields. So will need to keep track of the locations. Any 
>pointers would
>be most appreciated.
>

Reply via email to