We really need to know the compiler you are using.
Your SET statement is in the wrong place. argv only has an address when ENTRY is ENTRY . Before the record is called, it will be binary zero or some unpredictable garbage.
If you move SET after logging in, you must use the LINK-AREA value. argv will still only be an address, but LINK-AREA (give it a better name, please) will point to that address, so define it as argv, and then LINK-AREA can be used to get the actual contents of argv.
When using BY REFERENCE compiler generates code to pass a pointer with the address of the data element.
In PROCEDURE DIVISION USING or ENTRY USING element must also be BY REFERENCE, and the compiler generates code to map the LINKAGE SECTION definition to the passed address.
This is similar if you use BY CONTENT , but the compiler takes a copy of the data in your program and passes a pointer that references it. ABOUT USING A PROCEDURE OR ENTRANCE DEPARTMENT, which is still designated as REFERENCE.
With BY VALUE compiler "conveys" the actual value, although there are limitations specified in the standard or additions to the standard with your actual compiler. USING A PROCEDURE DEPARTMENT or RECORD should also indicate VALUE.
In all USES, HELP / CONTENT / VALUE are distributed, you do not need to specify BY at all, if all are the same, and you want BY REFERENCE, this is the default value.
If you โpass inโ POINTER ( USAGE POINTER ), you can access the data specified using SET ADDRESS OF . The SET ADDRESS OF attribute must be in the LINKAGE SECTION .
You can also use an implicit pointer with SET ADDRESS OF. SET ADDRESS OF TO ADDRESS of b will change the address displayed in the LINKAGE SECTION section to address b, an element that is defined somewhere in your DATA DIVISION program (any SECTION other than FILE SECTION ).
If you want to see the data pointed to by POINTER, define an element that has the correct size and type, and use SET ADDRESS OF item to pointer name.
POINTER can, of course, point to a simple data item or group data item (structure).
All elements in the LINKAGE SECTION must have an address before links are specified. Those who use USING get addressing by the compiler (and the compiler assumes that the correct number of addresses / elements is passed). All other LINKAGE SECTION elements must have the addressing set by SET ADDRESS OF or by passing ADDRESS OF in USE of a CALL and having the CALLed program, set the address.