Tag Archives: SRST

Search String – SRST

Anubha Agarwal wrote and asked for a video covering Search String (SRST). I don’t have a video quite yet, but here are my notes on this instruction. It’s an interesting one that can be used to search for the first occurrence of a single character in a given area of storage. It was probably added to the instruction set to help compiler writers who needed to search for C strings which are terminated with X’00’.

The interesting feature of the instruction is that it can be interrupted by the CPU for efficiency reasons when searching large areas of storage. The programmer can then decide whether to continue searching or not.

I stumbled over the examples given in the Principles of Operation, until I realized the code is flawed. A BC 1,LOOP instruction should be BC 3,LOOP, so pay close attention to those two examples.

Now that I’ve written down my thoughts, I’ll put together a video soon and provide some program examples you can experiment with. This instruction is definitely worth a look.

2 Comments

Filed under Fans of IBM z, IBM Mainframe Assembler