Quantcast
Channel: Visual COBOL - Forum - Recent Threads
Viewing all articles
Browse latest Browse all 1559

Initialize and Call

$
0
0

I've set up a very simple Console Application project in Visual Studio running Visual COBOL 2.2. Program1 initializes a group level redefine and then passes it to Program2. In Program2, it appears that the field within the group that was not used in Program1 was not actually initialized. Why would this be?

I expect the second display in Program2 to show PROGRAM2, FIELD-2B is empty. However, it shows the field has the value "ST" unless the second display in Program1 is uncommented.

PROGRAM-ID. PROGRAM1.

DATADIVISION.

WORKING-STORAGESECTION.

01 GROUP-1.

02 FIELD-1PIC X(4).

01 GROUP-2REDEFINESGROUP-1.

02 FIELD-2APIC X(2).

02 FIELD-2BPIC X(2).

PROCEDUREDIVISION.

MOVE"TEST"TOGROUP-1.

INITIALIZEGROUP-2.

DISPLAY"PROGRAM1, FIELD-2A: "FIELD-2A.

* Uncomment the following display to see FIELD-2A passed to PROGRAM2 initialized

* DISPLAY "PROGRAM1, FIELD-2A: " FIELD-2B.

CALL"PROGRAM2"USINGGROUP-1.

GOBACK.

 

PROGRAM-ID. PROGRAM2.

DATADIVISION.

WORKING-STORAGESECTION.

LINKAGESECTION.

01 GROUP-1.

02 FIELD-1PIC X(4).

01 GROUP-2REDEFINESGROUP-1.

02 FIELD-2APIC X(2).

02 FIELD-2BPIC X(2).

PROCEDUREDIVISIONUSINGGROUP-2.

DISPLAY"PROGRAM2, FIELD-2A: "FIELD-2A.

DISPLAY"PROGRAM2, FIELD-2B: "FIELD-2B.

GOBACK.

  



Viewing all articles
Browse latest Browse all 1559

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>