I understand what and how to use this definition, but can't find it in the manual.
The move will move the 1st 15 bytes of WS-ITEM to WS-SEARCH-KEY and space fill. See, I understand, but I don't know what it is called. Not index or subscript.
It drives me nuts that I can't find the documentation on this definition. I have been using this a lot lately. It beats the heck out of defining tables with OCCURS clauses.
Any body know?
Michael :-)
Last edit: Simon Sobisch 2023-10-14
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks Ralph and Arnold for the right answer to the "main question".
For the "rest"... Note that it does not necessarilyMOVE the first 15 bytes of the field.
It moves the first 15 characters starting at the beginning from the source field to the character position 16 of the target field, then truncate/space-fill it as necessary.
Only if both fields refer to an alphanumeric items (all groups that don't have an explicit USAGE are alphanumeric, too) or numeric-edited items or numeric items of USAGE DISPLAY, then those character positions match to bytes.
Also keep in mind that, depending on the compiler used and the generated/enabled runtime checks, the reference-modification may also be out of bounds and include bytes from the fields "afterwards" (if that is outside of a level 01/77, then you are highly in trouble for migrations).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Some time ago, I found a program that had this type of code;
I understand what and how to use this definition, but can't find it in the manual.
The move will move the 1st 15 bytes of
WS-ITEMtoWS-SEARCH-KEYand space fill. See, I understand, but I don't know what it is called. Not index or subscript.It drives me nuts that I can't find the documentation on this definition. I have been using this a lot lately. It beats the heck out of defining tables with
OCCURSclauses.Any body know?
Michael :-)
Last edit: Simon Sobisch 2023-10-14
Reference modification
See Section 2.2.3 "Reference Modifiers" in the GnuCOBOL 3.2 Programmer's Reference Manual.
Thanks Ralph
Thanks Ralph and Arnold for the right answer to the "main question".
For the "rest"... Note that it does not necessarily
MOVEthe first 15 bytes of the field.It moves the first 15 characters starting at the beginning from the source field to the character position 16 of the target field, then truncate/space-fill it as necessary.
Only if both fields refer to an alphanumeric items (all groups that don't have an explicit
USAGEare alphanumeric, too) or numeric-edited items or numeric items ofUSAGE DISPLAY, then those character positions match to bytes.Also keep in mind that, depending on the compiler used and the generated/enabled runtime checks, the reference-modification may also be out of bounds and include bytes from the fields "afterwards" (if that is outside of a level 01/77, then you are highly in trouble for migrations).
Thanks Simon for the clarification on BYTES vs CHARACTERS.
Anyone reading my posts, documentation notes need to understand what I meant VS what I typed.
Sometimes my brain is someplace else. It (my brain) generally operated in 8-bit mode with a small memory size.
Michael :-)