Re: COBOL KEY SEGMENTS




<alexandretalbert@xxxxxxxxx> wrote in message
news:1163074324.989902.144990@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi folks!!

Can anyone tell me why COBOL creates every key segment (for indexed
files) as STRING?? Even if the KEY FILEDS are numeric (PIC 9) ..

For example:

FD DC0030.
01 DC0030-REC.
02 DC0030-CODE PIC 9(3).
02 DC0030-NAME PIC X(50).

SELECT DC0030 ASSIGN TO WS0030-CAM-GERAL
ORGANIZATION IS INDEXED
ACCESS MODE IS DYNAMIC
LOCK MODE IS AUTOMATIC
FILE STATUS IS WS-8005-STATUS
RECORD KEY IS DC0030-CODE

When the programa creates the file (btrieve), I can see (with BUTIL
utility) that its index has ONE STRING SEGMENT instead NUMERIC
SEGMENT..Why ?? DC0030-CODE is NUMERIC!!

Any idea will be appreciated!!!
Thnks!!

You haven't identified the compiler you are using so this
may not apply; but I looked in my Micro Focus COBOL
System Reference under File Handling and found the
following:

-----quote
Key Types

The following points apply to keys when using Btr2xfh:

ExtFH has only one type of key. This is the equivalent of
the Btrieve format string and on a Btrieve Stat operation,
all of the keys are returned as having string format.
-----end quote

Perhaps the answer, simply stated, is: It just does!



.



Relevant Pages

  • Re: INDEXES: BTRIEVE vs EXTFH (cobol)
    ... In SQL, you can specify just about anything, but at the lower MKDE ... the engine has to pick the right Btrieve ... When COBOL needs to find this value, it knows that the key is a string. ...
    (comp.databases.btrieve)
  • Re: [OT] My First C# (warning - long post)
    ... cut me some slack - show me a COBOL program with less than 15 working-storage variables! ... Yes, the Trimis probably extra now, but that was my attempt to get it to quit griping at me that I had given it a "String", when it wanted a "char". ... public string IBreturn ...
    (comp.lang.cobol)
  • Re: [OT] My First C# (warning - long post)
    ... cut me some slack - show me a COBOL program with less than 15 ... string,. ... Here's a sample from live code that covers Casting string to Char, ... public string IBreturn ...
    (comp.lang.cobol)
  • Re: J4 - presentation/discussion on "Future of the COBOL Standard"
    ... Belief trumps evidence in the land of Cobol. ... It says the size of the array DEPENDS ... Suppose you're flying a kite and someone asks the size of the tether string. ... This seldom comes up in ODO discussions. ...
    (comp.lang.cobol)
  • Re: string to correct integer
    ... I tried, Fujitsu choked on recursion, so I deleted it. ... Floating point would be the most generic output format. ... Cobol, even though it's a 'Cobol thing'. ... I do expect the string tohave ...
    (comp.lang.cobol)