Manipulate the fields of a table (quick introduction)

Posted by

 

All fields from a table are numbers, with an associated description. This association is set in libraries loaded by subroutines, which are looking like “I_F.filename”.

Example for Money Market table:

  • File Layout for MM.MONEY.MARKET
  •      PREFIX[MM.]      SUFFIX[]
    EQU MM.CUSTOMER.ID TO 1,     MM.CURRENCY TO 2, 
    MM.PRINCIPAL TO 3,           MM.DEAL.DATE TO 4, 
    MM.VALUE.DATE TO 5,          MM.MATURITY.DATE TO 6, 
    MM.CATEGORY TO 7,            MM.INT.RATE.TYPE TO 8, 
    MM.INTEREST.BASIS TO 9,      MM.INTEREST.RATE TO 10, 
    MM.INTEREST.KEY TO 11,       MM.INTEREST.SPREAD.1 TO 12, 
    MM.FIRST.DAY.ACCRUAL TO 13,  MM.TOT.INTEREST.AMT TO 14, 
    MM.INT.DUE.DATE TO 15,       MM.LIQ.DEFER.INTEREST TO 16, 
    MM.BROKER.CODE TO 17,        MM.BROKERAGE TO 18, 
    MM.BROKER.CCY TO 19,         MM.BROKER.AMOUNT TO 20, 
    MM.OUR.REMARKS TO 21,        MM.DRAWDOWN.ACCOUNT TO 22,

(…)

In programs (also called subroutines), once libraries are loaded, we only manipulate fields names which makes it easier to understand the routines. Consequently, after any T24 releases, even if field names are “moved” (e.g. associated field numbers are changed), libraries are maintaining the association integrity.

  • To consult mapping between fields numbers & descriptions:

JED BP I_F.filename(assuming your file is located in BP)

  • To get a single valued field content:

R.DX.TRADE<DX.TRA.CONTRACT.CODE>

  • To get a multi-valued field content:

FEES.CCY = R.DX.TRADE<DX.TRA.PRI.COMM.CCY,YY,ZZ>

  • To count the number of multivalued occurences:

NO.CUSTS = COUNT(R.DX.TRADE<DX.TRA.PRI.CUST.NO>,VM)+1 => counts number of delimiters VM in the string ‘R.DX.TRADE<DX.TRA.PRI.CUST.NO>’

or

NO.CUSTS = DCOUNT(FEES.AMT,@SM) => counts the number of strings delimited by @SM

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.