[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [GNU-COBOL] PIC





Boris Kortiak wrote:

> >>> "David L. Nicol" <david@kasey.umkc.edu> 10/26/99 07:07PM >>>
> Randall Bart wrote:
>
> -RB
> > The most tedious of all items of COBOL grammar is PICTURE.
>
> -DN
> I'm getting out of this that PIC is short for PICTURE,
> and that PICTURE is a language for defining record structure
> of packed data.
>
> Someone enumerated a few PIC primitives, possibly all
> of them.  Do vendors add vendor-specific letters to PIC
> syntax?
>
> -BK
> PIC is not a language, its just a clause element to tell the compiler what to do with the following character string.  For instance a record (table row? column headings?) would be described like this: (Note this is easier to read in fixed pitch font)
>
> 01  ADDRESS-BOOK.                                     ->   Structure-name
>     03  ADDRESS-KEY-0.                                -> sub-structure-name
>         05  LAST-NAME          PIC  X(30).        -> data-name type and storage requirements
>         05  FIRST-NAME         PIC  X(20).
>         05  MIDDLE-NAME          PIC X(20).
>     03  TELEPHONE-NUMBER.                       -> sub-structure-name
>         05  COUNTRY-CODE      PIC  9(03).
>         05  AREA-CODE              PIC  9(04).
>         05  EXCHANGE               PIC 9(04).
>         05  NUMBER                   PIC 9(05).
>     03  MONEY-OWED           PIC S9(05)V9(02).
>
> This describes a storage are with the following:
> ADDRESS-BOOK is a string of 86 characters.    ->address location of struc
> ADDRESS-KEY-0 is a string of 70 characters.    ->address location of sub-struc
> LAST-NAME is a string of 30 characters.            ->JUST 30 locations
> FIRST-NAME is a string of 20 characters
> MIDDLE-NAME is a string of 20 characters.

TELEPHONE-NUMBER                                       ->address location of sub-struc

>
> TELEPHONE-NUMBER is a string of 16 characters.
> COUNTRY-CODE is an integer of 3 digits.
> AREA-CODE is an integer of 4 digits
> EXCHANGE is an integer of 4 digits
> NUMBER is an integer string of 5 digits
> MONEY-OWED is a signed integer string of 7 digits with the last two digits to be aligned to the right of any decimal point (for comparisons, moves, &c).

to move into a structure you have to qualify e.g.
MOVE read-data TO LAST-NAME OF (IN) ADDRESS-BOOK  ---- or
MOVE read-data TO LAST-NAME OF (IN) ADDRESS-KEY-0
OF or IN is used interchangeably in this instance.
Ken

>
>
> --
> This message was sent through the gnu-cobol mailing list.  To remove yourself
> from this mailing list, send a message to majordomo@lusars.net with the
> words "unsubscribe gnu-cobol" in the message body.  For more information on
> the GNU COBOL project, send mail to gnu-cobol-owner@lusars.net.


--
This message was sent through the gnu-cobol mailing list.  To remove yourself
from this mailing list, send a message to majordomo@lusars.net with the
words "unsubscribe gnu-cobol" in the message body.  For more information on
the GNU COBOL project, send mail to gnu-cobol-owner@lusars.net.