• Jobs
  • Support
Sign in
  • Jobs
  • Support
    • Developer Overview
  • Business Context

    • Business Overview
    • Business Rules Summary
    • Business Glossary
  • Architecture Documentation

    • System Architecture
    • Component Catalog
    • Data Flow
    • Database Schema
      • Overview
      • Entity Relationship Diagram
      • VSAM File Definitions
      • DB2 Database Schema (Optional)
      • IMS Database Schema (Optional)
      • Key Relationships Summary
      • Storage Estimates
      • Backup and Recovery
      • Performance Optimization
    • Integration Points
  • Sign in
DocumentationCode Explorer
Loading...
Hypercubic

© Copyright 2025. All rights reserved.

On this page

  1. Overview
  2. Entity Relationship Diagram
  3. VSAM File Definitions
  4. DB2 Database Schema (Optional)
  5. IMS Database Schema (Optional)
  6. Key Relationships Summary
  7. Storage Estimates
  8. Backup and Recovery
  9. Performance Optimization

Database Schema

Overview

The AWS CardDemo application uses a hybrid database architecture combining three data storage technologies:

  • VSAM Files - Primary operational data storage
  • DB2 Relational Database - Transaction types and fraud tracking (optional)
  • IMS Hierarchical Database - Authorization processing (optional)

Entity Relationship Diagram

Loading diagram...

VSAM File Definitions

1. ACCTDAT - Account Master File

Purpose: Stores credit card account information including balances and limits

File Specifications:

  • Organization: KSDS (Key Sequenced Data Set)
  • Key: ACCT-ID (Position 0, Length 11)
  • Record Size: 300 bytes (fixed)
  • Access: Random and sequential
  • Share Options: (2,3) - Multi-region access

Field Layout:

Field NamePositionLengthTypeDescription
ACCT-ID1-11119(11)Account ID (Primary Key)
ACCT-ACTIVE-STATUS121X(01)Account status (A=Active, C=Closed)
ACCT-CURR-BAL13-2412S9(10)V99Current balance (signed)
ACCT-CREDIT-LIMIT25-3612S9(10)V99Credit limit
ACCT-CASH-CREDIT-LIMIT37-4812S9(10)V99Cash advance limit
ACCT-OPEN-DATE49-5810X(10)Account open date (YYYY-MM-DD)
ACCT-EXPIRATION-DATE59-6810X(10)Account expiration date
ACCT-REISSUE-DATE69-7810X(10)Card reissue date
ACCT-CURR-CYC-CREDIT79-9012S9(10)V99Current cycle credits
ACCT-CURR-CYC-DEBIT91-10212S9(10)V99Current cycle debits
ACCT-ADDR-ZIP103-11210X(10)Account ZIP code
ACCT-GROUP-ID113-12210X(10)Discount group ID (FK)
FILLER123-300178X(178)Reserved

Business Rules:

  • ACCT-CURR-BAL can be negative (customer owes)
  • ACCT-CURR-BAL ≤ ACCT-CREDIT-LIMIT (enforced by application)
  • ACCT-ACTIVE-STATUS = 'A' for active accounts

Indexes:

  • Primary: ACCT-ID (unique)

2. CUSTDAT - Customer Master File

Purpose: Stores customer demographic and identification information

File Specifications:

  • Organization: KSDS
  • Key: CUST-ID (Position 0, Length 9)
  • Record Size: 500 bytes (fixed)
  • Share Options: (2,3)

Field Layout:

Field NamePositionLengthTypeDescription
CUST-ID1-999(09)Customer ID (Primary Key)
CUST-FIRST-NAME10-3425X(25)First name
CUST-MIDDLE-NAME35-5925X(25)Middle name
CUST-LAST-NAME60-8425X(25)Last name
CUST-ADDR-LINE-185-13450X(50)Address line 1
CUST-ADDR-LINE-2135-18450X(50)Address line 2
CUST-ADDR-LINE-3185-23450X(50)Address line 3
CUST-ADDR-STATE-CD235-2362X(02)State code
CUST-ADDR-COUNTRY-CD237-2393X(03)Country code
CUST-ADDR-ZIP240-24910X(10)ZIP/Postal code
CUST-PHONE-NUM-1250-26415X(15)Primary phone
CUST-PHONE-NUM-2265-27915X(15)Secondary phone
CUST-SSN280-28899(09)Social Security Number
CUST-GOVT-ISSUED-ID289-30820X(20)Government ID
CUST-DOB-YYYY-MM-DD309-31810X(10)Date of birth
CUST-EFT-ACCOUNT-ID319-32810X(10)EFT account ID
CUST-PRI-CARD-HOLDER-IND3291X(01)Primary cardholder flag
CUST-FICO-CREDIT-SCORE330-33239(03)FICO score
FILLER333-500168X(168)Reserved

Relationships:

  • One customer can have multiple accounts (1:N)

3. CARDDAT - Card Master File

Purpose: Stores credit card details and status

File Specifications:

  • Organization: KSDS
  • Key: CARD-NUM (Position 0, Length 16)
  • Record Size: 150 bytes (fixed)
  • Share Options: (2,3)

Field Layout:

Field NamePositionLengthTypeDescription
CARD-NUM1-1616X(16)Card number (Primary Key)
CARD-ACCT-ID17-27119(11)Account ID (FK, AIX key)
CARD-CVV-CD28-3039(03)Card verification value
CARD-EMBOSSED-NAME31-8050X(50)Name on card
CARD-EXPIRATION-DATE81-9010X(10)Expiration date
CARD-ACTIVE-STATUS911X(01)Card status
FILLER92-15059X(59)Reserved

Alternate Index:

  • CARDAIX: CARD-ACCT-ID (non-unique, with UPGRADE)
    • Allows retrieval of all cards for an account
    • Path: AWS.M2.CARDDEMO.CARDDATA.VSAM.AIX.PATH

Relationships:

  • Each card belongs to one account (N:1)
  • Account to cards is one-to-many (1:N)

4. CCXREF - Card Cross-Reference File

Purpose: Cross-references cards to customers and accounts for quick lookup

File Specifications:

  • Organization: KSDS
  • Key: XREF-CARD-NUM (Position 0, Length 16)
  • Record Size: 50 bytes (fixed)
  • Share Options: (2,3)

Field Layout:

Field NamePositionLengthTypeDescription
XREF-CARD-NUM1-1616X(16)Card number (Primary Key)
XREF-CUST-ID17-2599(09)Customer ID (FK)
XREF-ACCT-ID26-36119(11)Account ID (FK, AIX key)
FILLER37-5014X(14)Reserved

Alternate Index:

  • CXACAIX: XREF-ACCT-ID (non-unique, with UPGRADE)
    • Allows retrieval of all cards for an account
    • Path: AWS.M2.CARDDEMO.CARDXREF.VSAM.AIX.PATH

Usage Pattern:

  • Fast card-to-account-to-customer lookups
  • Used extensively in transaction validation

5. TRANSACT - Transaction Master File

Purpose: Stores posted transaction records

File Specifications:

  • Organization: KSDS
  • Key: TRAN-ID (Position 0, Length 16)
  • Record Size: 350 bytes (fixed)
  • Share Options: (2,3)

Field Layout:

Field NamePositionLengthTypeDescription
TRAN-ID1-1616X(16)Transaction ID (Primary Key)
TRAN-TYPE-CD17-182X(02)Transaction type code (FK)
TRAN-CAT-CD19-2249(04)Category code
TRAN-SOURCE23-3210X(10)Transaction source
TRAN-DESC33-132100X(100)Description
TRAN-AMT133-14412S9(09)V99Amount (signed)
TRAN-MERCHANT-ID145-15399(09)Merchant ID
TRAN-MERCHANT-NAME154-20350X(50)Merchant name
TRAN-MERCHANT-CITY204-25350X(50)Merchant city
TRAN-MERCHANT-ZIP254-26310X(10)Merchant ZIP
TRAN-CARD-NUM264-27916X(16)Card number (FK)
TRAN-ORIG-TS280-30526X(26)Original timestamp
TRAN-PROC-TS306-33126X(26)Processing timestamp (AIX)
FILLER332-35019X(20)Reserved

Alternate Index:

  • Transaction AIX: TRAN-PROC-TS (non-unique, with UPGRADE)
    • Allows chronological access to transactions

Transaction Types:

  • Positive amounts: Charges, purchases
  • Negative amounts: Credits, refunds, payments

6. TCATBALF - Transaction Category Balance File

Purpose: Maintains running balances by transaction category for interest calculation

File Specifications:

  • Organization: KSDS
  • Key: TRAN-CAT-KEY (Position 0, Length 17, composite)
  • Record Size: 50 bytes (fixed)
  • Share Options: (2,3)

Field Layout:

Field NamePositionLengthTypeDescription
TRAN-CAT-KEY1-1717CompositeComposite key
  TRANCAT-ACCT-ID1-11119(11)Account ID
  TRANCAT-TYPE-CD12-132X(02)Transaction type
  TRANCAT-CD14-1749(04)Category code
TRAN-CAT-BAL18-2912S9(09)V99Category balance
FILLER30-5021X(22)Reserved

Usage:

  • Updated during transaction posting
  • Read during interest calculation
  • Enables category-specific interest rates

7. DISCGRP - Disclosure Group File

Purpose: Stores interest rates and fee structures by account group and category

File Specifications:

  • Organization: KSDS
  • Key: DIS-GROUP-KEY (Position 0, Length 16, composite)
  • Record Size: 50 bytes (fixed)
  • Share Options: (2,3)

Field Layout:

Field NamePositionLengthTypeDescription
DIS-GROUP-KEY1-1616CompositeComposite key
  DIS-ACCT-GROUP-ID1-1010X(10)Account group ID
  DIS-TRAN-TYPE-CD11-122X(02)Transaction type
  DIS-TRAN-CAT-CD13-1649(04)Category code
DIS-INT-RATE17-226S9(04)V99Interest rate
FILLER23-5028X(28)Reserved

Usage:

  • Different interest rates by account group
  • Category-specific rates (purchases, cash advances)
  • Monthly interest calculation

8. USRSEC - User Security File

Purpose: Stores user authentication and authorization data

File Specifications:

  • Organization: KSDS
  • Key: USER-ID (Position 0, Length 8)
  • Record Size: 100 bytes (fixed)
  • Share Options: (2,3)

Field Layout:

Field NamePositionLengthTypeDescription
SEC-USR-ID1-88X(08)User ID (Primary Key)
SEC-USR-PWD9-168X(08)Password (encrypted)
SEC-USR-TYPE171X(01)User type (A=Admin, U=User)
SEC-USR-FNAME18-4225X(25)First name
SEC-USR-LNAME43-6725X(25)Last name
FILLER68-10033X(33)Reserved

User Types:

  • 'A': Administrator (full access)
  • 'U': Regular user (restricted access)

DB2 Database Schema (Optional)

1. TRANSACTION_TYPE Table

Purpose: Reference data for transaction type codes

CREATE TABLE CARDDEMO.TRANSACTION_TYPE (
    TR_TYPE         CHAR(2) NOT NULL,
    TR_DESCRIPTION  VARCHAR(50) NOT NULL,
    PRIMARY KEY (TR_TYPE)
)

Indexes:

CREATE UNIQUE INDEX CARDDEMO.XTRAN_TYPE
ON CARDDEMO.TRANSACTION_TYPE (TR_TYPE ASC)

Sample Data:

TR_TYPETR_DESCRIPTION
01Purchase
02Cash Advance
03Payment
04Fee
05Interest

2. TRANSACTION_TYPE_CATEGORY Table

Purpose: Maps transaction types to specific categories

CREATE TABLE CARDDEMO.TRANSACTION_TYPE_CATEGORY (
    TRC_TYPE_CODE     CHAR(2) NOT NULL,
    TRC_TYPE_CATEGORY CHAR(4) NOT NULL,
    TRC_CAT_DATA      VARCHAR(50) NOT NULL,
    PRIMARY KEY (TRC_TYPE_CODE, TRC_TYPE_CATEGORY),
    FOREIGN KEY (TRC_TYPE_CODE)
        REFERENCES CARDDEMO.TRANSACTION_TYPE(TR_TYPE)
        ON DELETE RESTRICT
)

Indexes:

CREATE UNIQUE INDEX CARDDEMO.X_TRAN_TYPE_CATG
ON CARDDEMO.TRANSACTION_TYPE_CATEGORY
(TRC_TYPE_CODE ASC, TRC_TYPE_CATEGORY ASC)

Relationships:

  • Each type can have multiple categories (1:N)
  • Foreign key ensures referential integrity

3. AUTHFRDS Table (Fraud Tracking)

Purpose: Stores authorization transactions marked as fraudulent

CREATE TABLE CARDDEMO.AUTHFRDS (
    CARD_NUM                CHAR(16) NOT NULL,
    AUTH_TS                 TIMESTAMP NOT NULL,
    AUTH_TYPE               CHAR(4),
    CARD_EXPIRY_DATE        CHAR(4),
    MESSAGE_TYPE            CHAR(6),
    MESSAGE_SOURCE          CHAR(6),
    AUTH_ID_CODE            CHAR(6),
    AUTH_RESP_CODE          CHAR(2),
    AUTH_RESP_REASON        CHAR(4),
    PROCESSING_CODE         CHAR(6),
    TRANSACTION_AMT         DECIMAL(12,2),
    APPROVED_AMT            DECIMAL(12,2),
    MERCHANT_CATAGORY_CODE  CHAR(4),
    ACQR_COUNTRY_CODE       CHAR(3),
    POS_ENTRY_MODE          SMALLINT,
    MERCHANT_ID             CHAR(15),
    MERCHANT_NAME           VARCHAR(22),
    MERCHANT_CITY           CHAR(13),
    MERCHANT_STATE          CHAR(2),
    MERCHANT_ZIP            CHAR(9),
    TRANSACTION_ID          CHAR(15),
    MATCH_STATUS            CHAR(1),
    AUTH_FRAUD              CHAR(1),
    FRAUD_RPT_DATE          DATE,
    ACCT_ID                 DECIMAL(11),
    CUST_ID                 DECIMAL(9),
    PRIMARY KEY (CARD_NUM, AUTH_TS)
)

Indexes:

CREATE UNIQUE INDEX CARDDEMO.XAUTHFRD
ON CARDDEMO.AUTHFRDS (CARD_NUM ASC, AUTH_TS DESC)
WITH COPY YES

IMS Database Schema (Optional)

Authorization Database (HIDAM Structure)

Loading diagram...

1. PAUTSUM0 - Authorization Summary (Root)

Purpose: Summary of pending authorizations by account

Field Structure:

Field NameLengthTypeDescription
PA-ACCT-ID6COMP-3 S9(11)Account ID (sequence field)
PA-CUST-ID99(09)Customer ID
PA-AUTH-STATUS1X(01)Authorization status
PA-ACCOUNT-STATUS10X(02) OCCURS 5Account status array
PA-CREDIT-LIMIT6COMP-3 S9(09)V99Credit limit
PA-CASH-LIMIT6COMP-3 S9(09)V99Cash limit
PA-CREDIT-BALANCE6COMP-3 S9(09)V99Credit balance
PA-CASH-BALANCE6COMP-3 S9(09)V99Cash balance
PA-APPROVED-AUTH-CNT2COMP S9(04)Approved count
PA-DECLINED-AUTH-CNT2COMP S9(04)Declined count
PA-APPROVED-AUTH-AMT6COMP-3 S9(09)V99Approved total
PA-DECLINED-AUTH-AMT6COMP-3 S9(09)V99Declined total

Size: 100 bytes


2. PAUTDTL1 - Authorization Details (Child)

Purpose: Individual authorization transaction details

Field Structure (Key Fields):

Field NameLengthTypeDescription
PA-AUTH-DATE-9C3COMP-3 S9(05)Date (compressed)
PA-AUTH-TIME-9C5COMP-3 S9(09)Time (compressed)
PA-CARD-NUM16X(16)Card number
PA-AUTH-TYPE4X(04)Authorization type
PA-TRANSACTION-AMT6COMP-3 S9(10)V99Transaction amount
PA-APPROVED-AMT6COMP-3 S9(10)V99Approved amount
PA-AUTH-RESP-CODE2X(02)Response code
PA-MERCHANT-NAME22X(22)Merchant name
PA-TRANSACTION-ID15X(15)Transaction ID

Size: 200 bytes

Hierarchy:

  • One PAUTSUM0 can have many PAUTDTL1 children
  • Sequence field: Composite date+time

Key Relationships Summary

Loading diagram...

Relationship Table:

ParentChildTypeKey
CUSTOMERACCOUNT1:NCUST-ID
ACCOUNTCARD1:NACCT-ID
CARDTRANSACTION1:NCARD-NUM
ACCOUNTCARD-XREF1:NACCT-ID
CARDCARD-XREF1:1CARD-NUM
ACCOUNTTCAT-BALANCE1:NACCT-ID
ACCOUNTDISCOUNT-GROUPN:1GROUP-ID
TRANSACTIONTRANSACTION-TYPEN:1TRAN-TYPE-CD

Storage Estimates

VSAM File Sizes

FileRecord SizeEst. RecordsEst. SizeGrowth Rate
ACCTDAT300 bytes50,00015 MB5% annually
CUSTDAT500 bytes50,00025 MB5% annually
CARDDAT150 bytes100,00015 MB10% annually
CCXREF50 bytes100,0005 MB10% annually
TRANSACT350 bytes1,000,000350 MB20% monthly
TCATBALF50 bytes500,00025 MB15% monthly
DISCGRP50 bytes1,00050 KBMinimal
USRSEC100 bytes50050 KBMinimal

Total VSAM: ~435 MB (initial), grows to ~1 GB annually

DB2 Table Sizes

TableEst. RowsRow SizeEst. Size
TRANSACTION_TYPE100~60 bytes6 KB
TRANSACTION_TYPE_CATEGORY500~60 bytes30 KB
AUTHFRDS100,000~300 bytes30 MB

IMS Database Sizes

DatabaseSegmentsEst. Size
DBPAUTP0 (Primary)50K summary + 500K details110 MB
DBPAUTX0 (Index)50K entries2 MB

Backup and Recovery

VSAM Files

Backup Strategy:

  • Daily: IDCAMS EXPORT to sequential files
  • Weekly: Full backup via REPRO
  • Monthly: Archive to tape/S3

Recovery Procedures:

// IDCAMS IMPORT
//   INFILE(BACKUP.DATASET)
//   OUTFILE(VSAM.CLUSTER)

DB2 Tables

Backup Strategy:

  • Automatic: DB2 image copies (COPY YES indexes)
  • Log-based recovery via RECOVER utility
  • Point-in-time recovery capability

IMS Databases

Backup Strategy:

  • IMS utilities: DFSURDB0 (Database Recovery)
  • GSAM unload/reload for data migration
  • Exit routines enabled for logging

Performance Optimization

VSAM Tuning

Recommendations:

  • CI Size: 4096 bytes (standard)
  • CA Size: 1 cylinder
  • FREESPACE: 10% CI, 20% CA for high-update files
  • Buffers: Increase for frequently accessed files
  • AIX: UPGRADE option for automatic maintenance

DB2 Tuning

Recommendations:

  • Indexes: Unique indexes on primary keys
  • Statistics: Run RUNSTATS regularly
  • Buffer Pools: Dedicated pools for high-activity tables
  • Compression: Enable for large tables

IMS Tuning

Recommendations:

  • HIDAM: Provides both indexed and sequential access
  • SCAN: Set to appropriate level (3 for this database)
  • Buffer Pools: Size based on active working set

Was this page helpful?