HP3000-L Archives

September 2004, Week 4

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Walter Murray <[log in to unmask]>
Reply To:
Walter Murray <[log in to unmask]>
Date:
Fri, 24 Sep 2004 20:02:58 -0500
Content-Type:
text/plain
Parts/Attachments:
text/plain (62 lines)
 "Peter Smithson" <[log in to unmask]> wrote:
> This is the BUILD statement provided by the customer and the COBOL code
> for that file as provided -
>
> BUILD AHIST;REC=-14,,F,ASCII;KSAMXL;DISC=230000;KEY=
> (B,2,13,DUP;B,9,4,RDUP)
>
>            SELECT   AHS-FILE         ASSIGN TO "AHISTI"
>                                      ORGANIZATION IS INDEXED
>                                      ACCESS MODE  IS DYNAMIC
>                                      RECORD KEY   IS AHIST-PRIMARY-KEY
>                                      FILE STATUS  IS AHS-STATUS.
>
> Note the lack of any 2nd key or mention of duplicates.  I had the same
> error using ACUCOBOL (about the file not matching up) but I was able to
> use the following syntax in ACUCOBOL -
>
>           SELECT   AHS-FILE         ASSIGN TO "AHISTI"
>                                      ORGANIZATION IS INDEXED
>                                      ACCESS MODE  IS DYNAMIC
>                                      RECORD KEY   IS AHIST-PRIMARY-KEY
>                                 ALTERNATE KEY IS AHIST-ALTERNATE-KEY
>                                               WITH DUPLICATES
>                                      FILE STATUS  IS AHS-STATUS.
>
> I notice now that I missed off the "WITH DUPLICATES" on the primary key
> but the program would still run.  I get a compilation error trying to
> compile this 2nd version on MPE.

This shouldn't be expected to compile, because "ALTERNATE KEY" should be
"ALTERNATE RECORD KEY", according to the standard.  HP COBOL doesn't allow
you to omit the required word RECORD in the ALTERNATE RECORD KEY clause;
maybe ACUCOBOL does.

You didn't show us your file description entry (FD), which COBOL also checks
against the existing file.  Anyway, here are a file control entry (SELECT
clause) and file description entry (FD) that will work for the file you have
built.

    SELECT AHS-FILE
         ASSIGN TO "AHISTI"
         ORGANIZATION         IS INDEXED
         ACCESS MODE          IS DYNAMIC
         RECORD KEY           IS AHIST-PRIMARY-KEY
             WITH DUPLICATES
         ALTERNATE RECORD KEY IS AHIST-ALTERNATE-KEY
             WITH DUPLICATES
         FILE STATUS          IS AHS-STATUS.

 FD  AHS-FILE.
 01  AHS-RECORD.
     02  FILLER                     PIC X.
     02  AHIST-PRIMARY-KEY.
         03  FILLER                 PIC X(7).
         03  AHIST-ALTERNATE-KEY    PIC X(4).
         03  FILLER                 PIC XX.

Walter

* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *

ATOM RSS1 RSS2