Archive for category Programming

Update a record in live & history file during EOD

Just an example of elements to include in a routine that update a record during the EOD (end of day process). If this is done properly, you must update the last record version and put the previous one in history.   In the below example, we’re updating a record from DX.TRADE file: One: open files […]

, , , , ,

No Comments

Common Variables

  Find below the list of common variables used in subroutines. They’re accessible as long as you include “$INSERT I_COMMON” in your programs. R.COMPANY(x)    = Record COMPANY profile R.DATES(x)      = Record DATES R.NEW(x)        = Record NEW R.NEW.LAST(x)   = LAST Record NEW e.g. important for pgm. DATA.CAPTURE to update batch totals when changing an not authorised […]

, , , , , ,

No Comments

Function usage

JBase-Basic allows the definition of functions, like in any standard programing language. Benefit is that programs calling functions are much easier to read compared to classic calling of a subroutine. To do so, name your program “FUNCTION” instead of naming it “SUBROUTINE”.  Of course, you will pass parameter(s) as arguments. From any program you’ll be able to call […]

, , , ,

No Comments

LOCATE and FINDSTR functions

LOCATE Function When searching for a value in an array, you can use the common “LOCATE” function. You need to specify  the dimension of the array, considering that you’re looking for a string in a: valued array (separator= FM), you will use: LOCATE xxx IN array<1> SETTING POS THEN… multivalued array (separator= VM), you will use: […]

No Comments

Date Time Stamp

Various commands to manipulate date and time DATE() returns the system date, compared to TODAY which returns T24 date (banking date). Examples, if today is 15.10.2013 and banking date is 09.10.2013: OCONV (DATE(), “D2”) gives 15 OCT 13 TODAY                         gives 20131009 OCONV(TIME(),’MTS’)   gives 09:30:17 TIMEDATE ()                gives 09:30:17 15 OCT 2013 Quick tip when you need […]

, , , , , , ,

No Comments

Fields Definitions

Compared to standard RDBMS, T24 applications (or table) have their structure hard-coded. Who said 🙁 ??! Fields definitions relates to the dictionary of the application (table). It contains all the field data types and specific rules attached to every single field. If you create a new table (or application), you will have to – either add an attached […]

,

No Comments

Dynamic versus dimensioned / matrice array

Within a jBase-Basic program, a data array can be represented as a: – Used with array_name<datax> or alternatively as a: – A typical example of matrice is R.NEW – Also named «dimensioned array» – Used with: array_name(datax) To be noticed: – When writing in a table, always do it with a dynamic array. – When […]

, , , , , ,

No Comments

Write trace in a log file

Sometimes you need to add some program traces in a log file to understand more clearly what is going on. This especially for PHANTOM programs you don’t want to launch in INTERACTIVE mode.   Just add, when you want to trace: LOG.TEXT = ‘BLABLA’ ; GOSUB WRITE.LOG And at the end of your program: WRITE.LOG: […]

, , , , , , , , , ,

No Comments

“black belt” LIST command under Jbase

SQL: select left(value_date,6), count(*) from security_transfer where broker_no = ‘595701’and transaction_type like ‘F%’ and value_date like ‘2010%’ group by left(value_date,6) JBASE translation>LIST FBNK.SECURITY.TRANSFER EVAL ‘”1″‘ AS NB BREAK.ON EVAL ‘VALUE.DATE[1,6]’ AS DATE TOTAL NB WITH DATE LIKE “2010…” AND BROKER.NO EQ “595701” AND TRANSACTION.TYPE LIKE “F…” BY DATE ID.SUP DET.SUP  

, , , , , , , ,

No Comments

Create a new application, starting from a standard TEMPLATE

If the standard package is not enough for you, you can easily create a new application from scratch 🙂 Steps : a. Create a new program, after having chosen the applicable type* b. Compile,  setting in comment the I_Fxxx. of the new application. c. Logoff d. create a new PGM.FILE entry for this application. e. […]

, , , , , , , ,

No Comments

Display messages to the user

Display a simple message Example of coding: TEXT = “Your input overrides tolerance of” TEXT := “<CR>” TEXT :” MAX.TOL : “%” CALL REM Display a message to block the inputter Example of coding: block the user as long as a field has not been input             IF (COMI = ”) THEN                 TEXT = […]

, , , , , , ,

No Comments

JBase Programmer’s Guides

Programmers_Reference_Manual.pdf: Advanced Programmers Reference Manual.pdf :

, , , , , , ,

No Comments

How to modify the default enrichment of a field

(to be used in a version) STANDARD.SELECTION Create  an I-desc that contains the new enrichment DX.CONTRACT.MASTER 15. 5 USR.FIELD.NAME. SHORT.NAME.SIZE 16. 5 USR.TYPE……. I 17. 5. 1 USR.FIELD.NO SHORT.NAME; 17. 5. 2 USR.FIELD.NO CONTRACT.SIZE; 17. 5. 3 USR.FIELD.NO @1:” – Contract Size: “:@2 20. 5 USR.DISPLAY.FMT 50L 24. 5 USR.SINGLE.MULT S Create a subroutine to […]

, , , , , , , ,

No Comments

Validation routine in a Version

In a version, you can manipulate fields contents by using a validation routine. It is defined in a version using the two fields: 58. 1 VALIDATION.FLD 59. 1 VALIDATION.RTN where VALIDATION.FLD is the field that should -once populated- trigger a routine, and VALIDATION.RTN is the routine name. Multiple utilization examples such as: – once field […]

, , , , , , , ,

No Comments

Jbase Editor tips & tricks

Quit Editor after multiple select After a SELECT + EDIT / jed, to quit the editor: Escape !EXK + Return Escape EXK + Return When editing a record: insert VM & SM separator Place the cursor between the two values and strike: Ctrl ]         Insert ]  value mark       Ctrl \         Insert \ subvalue mark   […]

, , , , , , ,

No Comments

DEBUGGER

2 ways to invoke the debugger: launching debugger once a program is called and reaching a specific line number: Launch a “Break” command (or  Shift + Backspace if break is de-activated) then: B <space> line nb , program name‘ The line number should correspond to an instruction line (not a comment!). The debugger has then […]

, , , , , , ,

No Comments

Number(s) Formatting

Rounding an amount according to pre-set formats: FMT(number, format) Example: Y.VAR = “8” : VM : “12” FMTS(Y.VAR,”R2″) => gives Y.VAR = ‘8.00’:VM:’12.00′ Rounding an amount according to currency definition: CALL EB.ROUND.AMOUNT(CCY,CURRENCY.AMT,param,””) => param: ‘1’ = non-cash rounding ‘2’ = cash rounding or alternatively: CALL SC.FORMAT.CCY.AMT(LCCY,AMT)   Fill a number with zeros and a fixed lengh: #n: Spaces. […]

, , , , , , ,

No Comments

Dates Manipulation

Get detailed date time information: * Time HH:MM:SS DD MMM YYYY CURRENT.TIME = TIMEDATE() CURRENT.TIME = CURRENT.TIME[1,2]: ‘:’ : CURRENT.TIME[4,2]: ‘:’ : CURRENT.TIME[7,2] * will give a time of “18:51:00″ for instance. Date formatting: CALL DIETER.DATE(DATE.IN,DATE.OUT,’D’) Example: ORD.DATE = R.DXO<DX.ORD.TRADE.DATE> (for instance= ‘20151106’) ORDER.DATE = ” IF (ORD.DATE) THEN CALL DIETER.DATE(ORD.DATE,ORDER.DATE,’D’) => gives ORDER.DATE = […]

, , , , , , ,

7 Comments

Write directly a record in a table

WRITE “R.RECORD” TO “F.TABLE.NAME”, “RECORD.KEY” Example : FN.DX.MARKET.PRICE = “F.DX.MARKET.PRICE” F.DX.MARKET.PRICE = “” CALL OPF(FN.DX.MARKET.PRICE, F.DX.MARKET.PRICE) (…) WRITE R.DX.MKT.PRICE TO F.DX.MARKET.PRICE, DX.MARKET.PRICE.KEY ON ERROR PRINT “ERROR, COULD NOT WRITE” END  

, , , , , , ,

No Comments

Write properly a record in a table (CALL F.WRITE)

CALL F.WRITE (FN.TABLE.NAME, RECORD.ID, R.RECORD) Example : FN.FILENAME = ‘F.FILENAME’ ; FV.FILENAME = ” CALL OPF(FN.FILENAME, FV.FILENAME) R.RECORD<DX.CM.FIELD1> = ‘TOTO’ R.RECORD<DX.CM.FIELD2> = ‘TUTU’ R.RECORD<DX.CM.FIELD3> = ‘TITI’ CALL F.WRITE(FN.FILENAME, RECORD.ID, R.RECORD) CALL JOURNAL.UPDATE(RECORD.ID)

, , , , , , ,

No Comments

Build and fill an array then retreive it

The target is to build -within a program – a list of items, then use this list for any purpose (produce an a-mail, a report, etc…). To achieve this, I’ve splitted the tasks in several steps: 1. Main ARRAY initialization, to store any content ARRAY.NAME = ” 2. Give names to fields in order to […]

, , , , , , ,

No Comments

Read an History file with a Live key

Read an History file with a Live key Use the program EB.READ.HISTORY.REC to read the history file. You take the live key, and the program will return the last History record as well as fills the Record from History. Example : CALL EB.READ.HISTORY.REC(FN.EFG.FUTURES$HIS, RECORD.ID, R.EFG.FUTURES$HIS, ”) Note: after this call, RECORD.ID will contain the last […]

, , , , , , ,

No Comments

Return a list of keys with a QSELECT

CALL EB.READLIST can also be used with a QSELECT. The QSELECT is selecting all fields from a table, not only the keys (@ID) compared to the SELECT. This is very usefull to read a CONCAT.FILE, in which call records (@RECORD)are only containing a single field. Example of a CONCAT.FILE: LIST FBNK.DX.ORD.VERSION.NO @RECORD @ID…………………………..    @RECORD………………….. DXORD0931005013 […]

, , , , , , ,

No Comments

Return a list of keys after a SELECT (CALL EB.READLIST)

CALL EB.READLIST (SELECT.STATEMENT, KEY.LIST, LIST.NAME, SELECTED, SYSTEM.RETURN.CODE) Routine to return a list of keys from a select statement. Introduced to cater for a change of syntax in the READLIST statement from rev 5 to rev 6. The routine allows both versions of the syntax. Parameter Description SELECT.STATEMENT Execute statement (optional – select can be active) […]

, , , , , , ,

No Comments

Extract a range of keys after a CALL OPF(FOR NEXT, LOOP REMOVE)

Extract a range of keys after a CALL OPF Y.DATE = TODAY READ R.DX.DAILY.TRANS FROM F.DX.DAILY.TRANS,Y.DATE ELSE R.DX.DAILY.TRANS = “” Y.DX.NUM = DCOUNT(R.DX.DAILY.TRANS,@FM) Using FOR…NEXT : FOR I = 1 TO Y.DX.NUM Y.DX.ID = R.DX.DAILY.TRANS<I>[“*”,1,1] Y.DX.REV = R.DX.DAILY.TRANS<I>[“*”,2,1] NEXT I Or using LOOP REPEAT LOOP REMOVE Y.DX.ID FROM R.DX.DAILY.TRANS SETTING TAG WHILE Y.DX.ITEM:TAG Y.DX.REV = […]

, , , , , , ,

No Comments

Manipulate the fields of a table (quick introduction)

  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 […]

, , , , , , ,

No Comments

Get a foreign data from a local table (CALL DBR)

Get a foreign data from a local table When you work with a table, you may need information stored in external tables. To do this, you will use foreign keys in your local table to join an external table. Considering: KEY the foreign key in your local table TABLE_NAME your external table FIELD.ATTRIBUTE the field […]

, , , , , , ,

No Comments

Get a whole record, then extract multiple fields (CALL OPF, CALL F.READ)

CALL OPF, CALL F.READ

, , , , , , ,

No Comments

This is How Globus Works

This is How Globus Works…

, , , , , , ,

No Comments