Special Registers

Use selected SQL calls to reference and test special registers as column values. Special Registers include:
Restriction: This topic applies only when the AppMaster Builder AddPack has been installed, and applies only to Windows platforms.
  • CURRENT DATE
  • CURRENT TIME
  • CURRENT TIMESTAMP
  • CURRENT TIMEZONE

Use special registers in DB-DECLARE, DB-OBTAIN, and DB-PROCESS calls to:

  • Store and display the special register values.
  • Evaluate special register values in WHERE clauses for conditional processing.

Target:

SQL

Comment:

Do not use SQL function names, such as HOUR, TIMESTAMP, as column names.

Examples:

Store the value of CURRENT-DATE in a Working-Storage field.

DB-OBTAIN REC D2TAB-REC
... PM_PART_NO
... PM_COLOR (WS-COLOR)
... CURRENT DATE (WS-CURR-DATE)
... WHERE PM_PART_SHORT_DESC = 'WIDGET'
... AND PM_COLOR = 'RED'

Select rows by comparing column SHIP_DATE with the special register CURRENT DATE.

DB-PROCESS REC D2INVEN-REC
... DB-PROCESS-ID D2INV-ID
... IN_PART_NO
... IN_PART_SHORT_DESC
... IN_QTY_ONHAND
... WHERE SHIP_DATE = CURRENT DATE