Re: Alternative COBOL "telco" source program

From: Robert Wagner (robert.deletethis_at_wagner.net)
Date: 05/31/04


Date: Mon, 31 May 2004 19:14:47 GMT

LX-i <lxi0007@netscape.net> wrote:

>Robert Wagner wrote:
>> LX-i <lxi0007@netscape.net> wrote:
>>
>>
>>>when I
>>>discovered that I could put a value clause on a group item, it changed
>>>the way I defined tables (and other 01-level items). With my compiler,
>>>there is a caveat (not sure if it's standard-imposed or not) - you can't
>>>use a usage clause under a group level item with a value clause. So,
>>>for my bit-switches, I can't say...
>>>
>>>01 MySwitches value zeroes.
>>> 12 pic 1 binary-1.
>>>
>>>...which kind of stinks, but I can understand the limitation as well.
>>
>>
>> Group names are implicitly pic x. It's an error to initialize
bit/binary/packed
>> variables with F0 (EBCDIC) or 30 (ASCII). It's common for compilers to
disallow
>> that value while permitting 'move zeroes to MySwitches'. Go figure.
>
>It disallows any usage clauses. (I haven't tried "Display" - it may let
>that one slide...)
>
>> I use Value only to initialize constants i.e. fields that will never change.
>> With regular variables, there are at least two potential bugtraps. One is the
>> Initialize verb which, according to the '85 Standard, does not use your
Values.
>> The other is the operating system or Cobol runtime handling of called
programs.
>> If the caller does a Cancel, Values will be there on the next Call. But if
the
>> caller forgets or abends or someone else calls your .dll, they probably won't
>> be.
>
>Right. It would have been nice if the Initialize verb grabbed your
>initial values, instead of just spaces/zeroes. Didn't I read that
>that's an option in the 2002 standard? I've recently run into this
>issue, as I'm taking programs that were once-through guys, and made them
>loop endlessly (until the OS tells them to get lost). You find all
>kinds of interesting stuff - variables not initialized, cursors not
>closed properly, etc. :)
>
>> A third, less common, problem is Local-Storage. As discussed here, Micro
Focus
>> used to leave it uninitialized. It didn't issue a warning about Value
clauses,
>> as it would in Linkage-Section, it just didn't use them. That's now fixed,
but
>> there's a chance the shop's production compiler is older than its development
>> version, or another shop is using an old one.
>
>I have yet to use a compiler that has Local-Storage... I'll file this
>in my head for future reference.
>
>> FWIW, 'pic 1' seems like sufficient information for the compiler to define
one
>> bit. It is on the AS/400. If your compiler makes you also write 'binary-1',
that
>> seems redundant.
>
>I think it's required to flag it as an extension to the standard.
>There's a compiler option that says you don't have to have that there
>(and we use it), but it clutters up the print listings with extra
>remarks, so I try to use it. As far as their rationale for requiring a
>usage clause on Pic 1's... ? (Maybe if I end up working for Unisys one
>day I can find out.)
>
>
>--
>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>~ / \ / ~ Live from Montgomery, AL! ~
>~ / \/ o ~ ~
>~ / /\ - | ~ LXi0007@Netscape.net ~
>~ _____ / \ | ~ http://www.knology.net/~mopsmom/daniel ~
>~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
>~ I do not read e-mail at the above address ~
>~ Please see website if you wish to contact me privately ~
>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>



Relevant Pages

  • Re: c program binary/image in memory
    ... grammar and other requirements of the C language standard. ... I'm sure you have a copy of the C standard. ... > This part of the system is as important as the compiler actually, ... single area and initialize the area to all-bits-zero, ...
    (comp.lang.c)
  • Re: Copying std::map with assignment
    ... Undefined Behavior. ... Standard, but I'm sure the number is substantial there as well), and as so ... I recently asked some compiler gurus ... initialize it to 42 if that's what it felt like. ...
    (alt.comp.lang.learn.c-cpp)
  • Re: multiple definitions....
    ... > also i think with a GNU compiler) I get no errors or warnings. ... if you initialize one of your variables or none. ... to explicitly use "extern", to remember there are other declarations. ... The standard says both variables represent the same object, and in practice, ...
    (comp.lang.c)
  • Re: Numeric Edited and VALUE/MOVE
    ... Initialize Num-Edi to Value ... then all would work "as defined in the Standard". ... MYFLD PIC ZZZ,Z VALUE ALL '9'. ... What happens when you INITIALIZE MYFLD TO VALUE? ...
    (comp.lang.cobol)
  • Re: [C++] Need help with program please
    ... a return statement can involve the construction and copy of a ... That's what the function return mechanism does -- initialize the ... The standard clearly specifies that returning an rvalue ... >>perspective, objects have addresses, but temporaries don't. ...
    (alt.comp.lang.learn.c-cpp)