[Default] On 22 Jul 2017 18:31:37 -0700, in bit.listserv.ibm-main
[email protected] (Steve Thompson) wrote:

>And what happens when the program gets called with a "zero" parm?

Unless an INITIALIZE statement were issued for that field, nothing
would happen.  The VALUE clause on a data item in the FELE SECTION and
LINKAGE SECTION is used in conjunction with the INITIALIZE statement
and not to se an initial value.

Clark Morris
>
>One would hope that it gets a S0C4-4 for attempting to initialize 
>PSA, because if it manages to pickup a random value to base that 
>01, who knows what gets overlaid.
>
>But then, I don't have access to COBOL6.2 yet so I can test this.
>
>Regards,
>Steve Thompson
>
>On 07/20/2017 06:08 PM, Frank Swarbrick wrote:
>> I'm still not sure exactly what you are saying, but I will say this.  Prior 
>> to Enterprise COBOL V6 an item within the linkage section that had a VALUE 
>> clause would generate a warning.  I believe this is what you stated.  But 
>> now it's not even a warning.  It's certainly not an error, which is the part 
>> that is throwing me.
>> 
>> The reason why it was a warning prior to V6 is because it "had no meaning" 
>> when present.  It didn't actually set those fields to those values, because 
>> linkage section items have no storage behind them until they are given 
>> addressability either to an item passed to it via a CALL, or explicitly set 
>> via a SET ADDRESS statement.
>> 
>> With COBOL V6 however, while all the above is still true, there is in fact 
>> now the possibility of using the INITIALIZE statement to set a linkage 
>> section item to the value specified in the value clause.  For this reason 
>> they have eliminated the warning.
>> 
>> Take the following example:
>> 
>>   identification division.
>>   program-id. initval.
>>   data division.
>>   linkage section.
>>   01  my-group.
>>       05  with-value       pic 9 value 1.
>>       05  without-value    pic 9.
>>       05  filler           pic 9 value 2.
>>       05  filler           pic 9.
>> 
>>   procedure division using my-group.
>>       initialize my-group
>>                  with filler
>>                  all to value
>>                  then to default
>>       display my-group
>>       goback.
>>   end program initval.
>> 
>> 
>> The new "ALL TO VALUE" clause of the INITIALIZE statement instructs COBOL to 
>> initialize the group to the value in the VALUE clause, if one is specified.  
>> The output of the above program, when called from another program passing a 
>> 4 byte field, is "1020".  with-value and the first filler item are both set 
>> to their corresponding "values".  The other two are set to the default value 
>> for their data type; 0 in both cases because they are numeric fields.
>> 
>> This doesn't appear to answer your concern, but I bring it up both because 
>> it is true and because it is useful!  :-)
>> 
>> Frank
>> ________________________________
>> From: IBM Mainframe Discussion List <[email protected]> on behalf of 
>> Frank Swarbrick <[email protected]>
>> Sent: Thursday, July 20, 2017 3:25 PM
>> To: [email protected]
>> Subject: Re: Enterprise COBOL V6.2
>> 
>> I'm not clear on what you are saying here.  Can you give an example of both 
>> the code and the error message?
>> 
>> ________________________________
>> From: IBM Mainframe Discussion List <[email protected]> on behalf of 
>> Cameron Conacher <[email protected]>
>> Sent: Thursday, July 20, 2017 2:43 PM
>> To: [email protected]
>> Subject: Re: Enterprise COBOL V6.2
>> 
>> Hello everyone.
>> COBOL 6.1 introduced a "feature" where VALUE clauses that are used for
>> initialization are flagged as errors.
>> Ever since I began using COBL in the seventies, this would be treated as a
>> warning.
>> Personally, I consider it bad form, but the compiler happily marched on.
>> We have a number of COPYBOOKs that are occasionally used in LINKAGE, and
>> these items have raised issues during recompiles.
>> Nothing terrible, but still a bump in the development road.
>> 
>> Are there any new features like this in COBOL 6.2?
>> 
>> Thanks,
>> 
>> .......Cameron
>> 
>> On Thu, Jul 20, 2017 at 8:33 AM, Tim Deller <[email protected]> wrote:
>> 
>>> "Conditional complication"?
>>> Sounds about right...
>>>
>>> ----------------------------------------------------------------------
>>> For IBM-MAIN subscribe / signoff / archive access instructions,
>>> send email to [email protected] with the message: INFO IBM-MAIN
>>>
>> 
>> ----------------------------------------------------------------------
>> For IBM-MAIN subscribe / signoff / archive access instructions,
>> send email to [email protected] with the message: INFO IBM-MAIN
>> 
>> ----------------------------------------------------------------------
>> For IBM-MAIN subscribe / signoff / archive access instructions,
>> send email to [email protected] with the message: INFO IBM-MAIN
>> 
>> ----------------------------------------------------------------------
>> For IBM-MAIN subscribe / signoff / archive access instructions,
>> send email to [email protected] with the message: INFO IBM-MAIN
>> 
>
>----------------------------------------------------------------------
>For IBM-MAIN subscribe / signoff / archive access instructions,
>send email to [email protected] with the message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to