HP3000-L Archives

November 2004, Week 2

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:
Tony Summers <[log in to unmask]>
Reply To:
Tony Summers <[log in to unmask]>
Date:
Thu, 11 Nov 2004 16:01:27 -0000
Content-Type:
text/plain
Parts/Attachments:
text/plain (210 lines)
Step 1 - ws and intrinsic call 

  3  DBKI-SUB                   PIC 9(4) COMP SYNC.
   3  DBKI-KEYINFO-PARAM.
    5 FILLER                     PIC X(32).
    5 DBKI-TOTAL-KEYS            PIC 9(4) COMP SYNC.
    5 DBKI-KEY-CONTROL-AREA      OCCURS 16.
     7 DBKI-KEY-TYPE-LENGTH      PIC 9(4) COMP SYNC.
     7 DBKI-KEY-LOCATION         PIC 9(4) COMP SYNC.
     7 DBKI-KEY-DUPLICATE        PIC S9(4) COMP SYNC.
     7 FILLER                    PIC 9(4) COMP SYNC.

   3  DBKI-KEYINFO-CONTROL.
    5 FILLER                     PIC X(26).
    5 DBKI-KEYSTART-FIELD        PIC XX.
    5 FILLER                     PIC X(20).
    5 DBKI-RECORD-SIZE           PIC 9(4) COMP SYNC.
    5 FILLER                     PIC X(24).
    5 DBKI-FREMOVE               PIC 9(9) COMP SYNC.
    5 FILLER                     PIC X(32).
    5 DBKI-FWRITE                PIC 9(9) COMP SYNC.
    5 DBKI-FUPDATE               PIC 9(9) COMP SYNC.
    5 FILLER                     PIC X(138). 


$PAGE " "
 MDHXSC-READ-KEYINFO-FOR-FILE SECTION.
*
*    Obtain current key and fremove etc values
*
 HXSC-ENTER.
*
     CALL INTRINSIC "FGETKEYINFO" USING DBKK-FILE-NUMBER,
                                        DBKI-KEYINFO-PARAM,
                                        DBKI-KEYINFO-CONTROL.
*
      IF      CCC = 0
              NEXT SENTENCE
      ELSE IF CCC < 0
              MOVE "FP"          TO DBHX-ULT-RETURN
              PERFORM MDHXZZ-ERROR
      ELSE IF CCC > 0
              MOVE "FQ"          TO DBHX-ULT-RETURN
              PERFORM MDHXZZ-ERROR.
*
 HXSC-EXIT.
     EXIT.

Step 2 - unpacking the Key information from the COMP sync values.  

This was the fun bit - trying to unpack the start,size and whether or
not the key allows duplicates.  The code below is taken from one of my
programs which compares the key sizes against pre-defined values (RKKK-)
in a copylibrary. 


*     Key type must by B for our database therefore
*     key type length must be in range 0 or 4096 thru 8192
*     If non-zero subtract 4096 (bit 0:3 = 1) from value to
*     obtain actual length.
*     The duplicate flag is harder to obtain, being only the
*     first bit of a 1 word field. I've taken the assumption
*     that if that bit is signed then the comp sync value of
*     that field will appear negative in cobol
*
      MOVE 0                     TO DBKI-SUB.
*
 HXBC-LOOP.
*
      ADD 1                      TO DBKI-SUB.
*
      IF  DBKI-SUB > 16
          GO TO HXBC-FINISH.
*
       IF  DBKI-SUB > DBKI-TOTAL-KEYS
           MOVE 0             TO DBKI-KEY-TYPE-LENGTH (DBKI-SUB)
                                  DBKI-KEY-DUPLICATE (DBKI-SUB)
                                  DBKI-KEY-LOCATION (DBKI-SUB).
*
      IF  DBKI-KEY-TYPE-LENGTH (DBKI-SUB) = 0
          GO TO HXBC-COMPARE.
*
*     Key on ksam file is not of type Byte (first 4 bits of field)
*
      IF  DBKI-KEY-TYPE-LENGTH (DBKI-SUB) > 8192
          MOVE "AC"              TO DBHX-ULT-RETURN
          PERFORM MDHXZZ-ERROR.
*
*     This removes the field type from the field leaving length
*
      SUBTRACT 4096 FROM DBKI-KEY-TYPE-LENGTH (DBKI-SUB)
        GIVING DBKI-KEY-TYPE-LENGTH (DBKI-SUB).
*
*     Check key not > 86 bytes
*
      IF  DBKI-KEY-TYPE-LENGTH (DBKI-SUB) > 86
          MOVE "AE"              TO DBHX-ULT-RETURN
          PERFORM MDHXZZ-ERROR.
*
*     If bit set then field appears to be negative which implies
*     duplicates are allowed  - adjust the field to correspond to
*     the values that the bit can take
*
      IF  DBKI-KEY-DUPLICATE (DBKI-SUB) < 0
          MOVE 1                 TO DBKI-KEY-DUPLICATE (DBKI-SUB)
      ELSE
          MOVE 0                 TO DBKI-KEY-DUPLICATE (DBKI-SUB).
*
*     The primary key does not allow duplicates
*
      IF  DBKI-SUB = 1
      AND DBKI-KEY-DUPLICATE (DBKI-SUB) = 1
          MOVE "AD"              TO DBHX-ULT-RETURN
          PERFORM MDHXZZ-ERROR.
*
 HXBC-COMPARE.

     IF  DBKK-REQUESTED-OPEN-MODE = "14"
         PERFORM MDHXBC-2-RETURN-INFO
         GO TO HXBC-LOOP.
*
*     Now compare the adjusted key information with the
*     corresponding information in the RKKK area.
*     For the first 8 entries only !!!!!!
*
*     Too many keys for this version of the handler ?
*
      IF   DBKI-SUB > 8
           IF  DBKI-KEY-TYPE-LENGTH (DBKI-SUB) <> 0
               MOVE "AF"         TO DBHX-ULT-RETURN
               PERFORM MDHXZZ-ERROR
           ELSE
               GO TO HXBC-LOOP.
*
*     Start position....
*
      IF  DBKI-KEY-LOCATION (DBKI-SUB)
      <>  DBKK-KEY-START    (DBKI-SUB)
          MOVE "AG"              TO DBHX-ULT-RETURN
          PERFORM MDHXZZ-ERROR.
*
*    And compare key sizes too (remember KK value is negative
*    when keys are not allowed)
*
     IF (   DBKI-KEY-DUPLICATE (DBKI-SUB) = 1
        AND DBKI-KEY-TYPE-LENGTH (DBKI-SUB)
          = DBKK-KEY-SIZE        (DBKI-SUB)       )
*
     OR (   DBKI-KEY-DUPLICATE (DBKI-SUB) = 0
        AND DBKI-KEY-TYPE-LENGTH (DBKI-SUB) +
            DBKK-KEY-SIZE        (DBKI-SUB) = 0   )
            GO TO HXBC-LOOP.
*
*    Failed to cross check Key size
*
     MOVE "AH"                   TO DBHX-ULT-RETURN
     PERFORM MDHXZZ-ERROR.
*
 HXBC-FINISH.
*
*     and finally compare record size and warn on capacity
*
     IF  DBKI-RECORD-SIZE <> DBKK-RECORD-SIZE
         MOVE "AI"               TO DBHX-ULT-RETURN
         PERFORM MDHXZZ-ERROR.
*
*    Issue file capacity warning when only really near FLIMIT


The contents of this email are confidential to the intended recipient
and may not be disclosed. Although it is believed that this email and
any attachments are virus free, it is the responsibility of the recipient to confirm this.

Smith & Williamson Corporate Finance Limited - A member of M&A
International Inc. http://www.mergers.net Registered in England No.
4533970. Authorised and regulated by the Financial Services Authority 
Smith & Williamson Investment Management Limited, Registered No. 976145. Authorised and regulated by the Financial Services Authority.
Smith & Williamson Pension Consultancy Limited - Independent
Intermediary. Registered No. 3133226. Authorised and regulated by the
Financial Services Authority.
Smith & Williamson Fund Administration Limited, Registered No. 1934644. Authorised and regulated by the Financial Services Authority.
Smith & Williamson Limited - A member of Nexia International.
Registered in England No. 4534022. Regulated by the Institute of
Chartered Accountants in England & Wales for a range of investment
business activities.

Registered Office: No 1 Riding House Street, London W1A 3AS
Telephone: 020 7637 5377 http://www.smith.williamson.co.uk

Nexia Audit Limited - A member of Nexia International. Registered in
England No. 4469576. Registered to carry on audit work and regulated by the Institute of Chartered Accountants in England & Wales for a range of investment business activities.

Registered Office: No 1 Riding House Street, London W1A 3AS
Telephone: 020 7637 5377 http://www.nexiaaudit.co.uk

NCL Investments Limited, Registered No. 1913794.
Member of the London Stock Exchange authorised and regulated by the Financial Services Authority.

Registered Office: Bartlett House, 9-12 Basinghall Street, London  EC2V 5NS
Telephone: 020 7600 2801 


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________

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

ATOM RSS1 RSS2