[Info-vax] COBOL, <gack!> again! Return status.

Arne Vajhøj arne at vajhoej.dk
Mon Sep 11 16:24:51 EDT 2023


On 9/11/2023 4:17 PM, Arne Vajhøj wrote:
> On 9/11/2023 4:12 PM, Brian Schenkenberger wrote:
>> On 2023-09-11 19:59:05 +0000, Arne Vajhj said:
>>> $ type add2.cob
>>> identification division.
>>> program-id.add2.
>>> data division.
>>> working-storage section.
>>> 01  res     pic 9(9) comp.
>>> linkage section.
>>> 01  a       pic 9(9) comp.
>>> 01  b       pic 9(9) comp.
>>> procedure division using a,b giving res.
>>> main-paragraph.
>>>      compute res = a + b.
>>>      end program add2.
> 
>> I've tried that but compiler pukes on it.  I've tried:
>>
>> MOVE SS$_NORMAL TO RES.
>>
>> and
>>
>> COMPUTE RES = SS$_NORMAL *1.
>>
>> It just doesn't like it.
> 
> Move should be fine.
> 
> How did you declare RES and how did you declare SS$_NORMAL and
> what error did you get?

Anyway.

$ typ m2.cob
identification division.
program-id.m.
data division.
working-storage section.
01  a       pic 9(9) comp.
01  b       pic 9(9) comp.
01  res     pic 9(9) comp.
01  stat    pic 9(9) comp.
01  res2    pic 9(9) display.
01  stat2   pic 9(9) display.
procedure division.
main-paragraph.
     move 123 to a
     move 456 to b
     call "ADD3" using a,b,res giving stat
     move res to res2
     move stat to stat2
     display stat2 " " res2
     stop run.
$ cob m2
$ type add3.cob
identification division.
program-id.add3.
data division.
working-storage section.
01  SS$_NORMAL pic 9(9) comp value is external SS$_NORMAL.
01  stat    pic 9(9) comp.
linkage section.
01  a       pic 9(9) comp.
01  b       pic 9(9) comp.
01  res     pic 9(9) comp.
procedure division using a,b,res giving stat.
main-paragraph.
     compute res = a + b
     move SS$_NORMAL to stat.
     end program add3.
$ cob add3
$ link m2 + add3
$ run m2
000000001 000000579

Arne




More information about the Info-vax mailing list