David Blaikie wrote: > > What sort of string-like behavior would one want on a bit-string? Seems > like array would be the better fit to me... >
It's a language that originates in the late 60s - so there are some, "different" ideas than more contemporary languages. You can ask for sub-strings of strings (character or bit), you can assign a string (shorter or of equal length) to a target string, you can also concatenate strings, and you can assign to portions within a target bit string (or character string for that matter.) e.g. test: proc; dcl b10 bit(10); dcl b20 bit(20) varying; dcl dest bit(30) varying4; /* maximum possible result size */ b10 = '1010'b; /* assigns '1010000000' to b10 (passing on the right */ /* with 0 bits because the length is fixed. */ b20 = '10'b; /* assigns '10' to b20, moving a byte containing */ /* '10......' and setting the 2-byte length field */ /* to 2, indicating the left-most 2 bits are used. */ dest = b10 || b20; /* assigns '101000000010....' to dest, setting it's */ /* 4-byte length field to 12. */ b10 = substr(dest,1,2); /* extracts the first 2 bits from the bitfield */ /* dest ('10') (2 bytes starting a position #1) and assigns */ /* it to b10, which is extended to 10 bits on-the-right */ /* because b10 is a fixed-length, resulting in '1000000000' */ /* being assigned to b10 */ substr(b10,6,1) = '1'b; /* assigns a 1-bit value to b10, starting */ /* at bit #6 and going for 1 bit, resulting */ /* in '1010010000' being in b10 */ end proc; So - it's a rather abstract idea of "strings of bits" similar to "strings of characters". - Dave Rivers - -- riv...@dignus.com -- Dwarf-discuss mailing list Dwarf-discuss@lists.dwarfstd.org https://lists.dwarfstd.org/mailman/listinfo/dwarf-discuss