0% found this document useful (0 votes)
32 views10 pages

PRG1.Programming Using Jbase Basic-R10.WSS

Uploaded by

Gedefaye Anteneh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views10 pages

PRG1.Programming Using Jbase Basic-R10.WSS

Uploaded by

Gedefaye Anteneh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 10

Information in this document is subject to change without notice.

No part of this document may be reproduced or transmitted in any form or by any means, for any purpose,
without the express written permission of TEMENOS HEADQUARTERS SA.

COPYRIGHT 2007 - 2008 TEMENOS HEADQUARTERS SA. All rights reserved.


PRG1-Programming using T24 APIs
Workshop

Information in this document is subject to change without notice.

No part of this document may be reproduced or transmitted in any form or by any means, for any purpose,
without the express written permission of TEMENOS HEADQUARTERS SA.

COPYRIGHT 2007 - 2008 TEMENOS HEADQUARTERS SA. All rights reserved.


PRG2-Programming using T24 APIs

Table of Contents

Document History.......................................................................................................................... 3
WORKSHOP 1.......................................................................................................................... 4
Create a hashed file with the below mentioned structure to store details of trainees.............4
Workshop 2............................................................................................................................... 6
Write a program to display the following menu and perform appropriate action based on the
option chosen. All operations should be based on the TRAINEE file....................................6
WORKSHOP 3.......................................................................................................................... 9
Add a new field called STATUS in the TRAINEE table..........................................................9
Write a program which will check the number of tests passed by the trainee........................9
If the number is more than 5, then update the field STATUS to.............................................9
PERMANENT else PROBATION. Use dimensioned arrays in the program..........................9
Use MATREADU to read. Refer the www.jbase.com website for details on the MATREADU
statement............................................................................................................................... 9
WORKSHOP 4........................................................................................................................ 10

Kalaiselvi| Corporate Training


3
PRG2-Programming using T24 APIs

WORKSHOP 1
Create a hashed file with the below mentioned structure to store
details of trainees

@ID NAME CLASSIFICATION REGION TESTS WRITTEN SPECIALIZATION


(Multimedia,
programming, testing)

1 TOM TECHNICAL INDIA T24 jBASE Oracle Programming


2 JOHN BUSINESS US Retail Treasury Programming Multimedia

3 HARRY TECHNICAL UK T24 jBASE Oracle DB2 Multimedia

Solution

Kalaiselvi| Corporate Training


4
PRG2-Programming using T24 APIs

Kalaiselvi| Corporate Training


5
PRG2-Programming using T24 APIs

Workshop 2
Write a program to display the following menu and perform
appropriate action based on the option chosen. All operations
should be based on the TRAINEE file.

Trainee File – Data Manipulation Menu


********************************************
1. INSERT (To insert a new record)
2. UPDATE (To update an existing record)
3. DISPLAY (Display the details of a given record)
4. DELETE (To delete an existing record)
5. Exit
Once a record id is accepted, a check to see if the record already exists has to take
place
If the record id exists
Insert operation should not be permitted
All other operations can be permitted
If the record id does not exist
Insert operation should be permitted
All other operations should not be permitted

*----------------------------------------------------------------------
-------
* <Rating>-50</Rating>
*----------------------------------------------------------------------
-------
PROGRAM TRAINEE.RTN
CRT "TRAINEE INFORMATION"
OPEN "TRAINEE" TO F.TRAINEE THEN
CRT "OPEN SUCCESSFUL"
END
ELSE
CRT "FILE NOT FOUND"
END
MYCHOICE:
CRT "TRAINEE FILE - DATA MANIPULATION MENU......."
CRT "---------------------------------------------"
CRT " 1. INSERT"
CRT " 2. DISPLAY"
CRT " 3. UPDATE"
CRT " 4. DELETE"
CRT " 5. EXIT"
CRT " ENTER THE ACTION U NEED TO PERFORM (NUMERIC VALUE) "
INPUT Y.CHOICE

BEGIN CASE
CASE Y.CHOICE = 1
GOSUB PERFORM.INSERT

Kalaiselvi| Corporate Training


6
PRG2-Programming using T24 APIs

CASE Y.CHOICE = 2
GOSUB PERFORM.DISPLAY
CASE Y.CHOICE = 3
GOSUB PERFORM.UPDATE
CASE Y.CHOICE = 4
GOSUB PERFORM.DELETE
CASE Y.CHOICE = 5
EXIT(1)
CASE 1
CRT " INVALID OPTION ENTERED. EXITING ........."
EXIT(1)
END CASE
STOP
PERFORM.INSERT:
CRT "INSERTING TRAINEE DETAILS"
CRT "ENTER DETAILS TO CREATE A NEW RECORD"

R.TRAINEE=''

CRT "TRAINEE ID"


INPUT Y.TR.ID

CRT "NAME"
INPUT Y.NAME
R.TRAINEE<-1> =Y.NAME

CRT "CLASSIFICATION"
INPUT Y.CLASSIFICATION
R.TRAINEE<-1> = Y.CLASSIFICATION

CRT "REGION"
INPUT Y.REGION
R.TRAINEE<-1> = Y.REGION

CRT " TEST WRITTEN"


CRT " IF TRAINEE HAS TAKEN MULTIPLE COURSES DELIMIT VALUES USING
COMMA"
INPUT Y.TEST.WRITTEN
Y.TEST.COUNT = DCOUNT(Y.TEST.WRITTEN,',')
FOR Y.COUNT.TEST = 1 TO Y.TEST.COUNT
Y.TW=FIELD(Y.TEST.WRITTEN,',',Y.COUNT.TEST,1)
R.TRAINEE<4,-1>=Y.TW
NEXT Y.TEST.COUNT

WRITE R.TRAINEE TO F.TRAINEE,Y.TR.ID SETTING V.ERR.VAR ON ERROR


CRT "RECORD COULD NOT WRITTEN"
CRT "REASON " :V.ERR.VAR
END
GOSUB MYCHOICE

PERFORM.DISPLAY:
CRT "DISPLAYING TRAINEE INFO"
CRT " ENTER THE TRAINEE ID YOU WANT TO VIEW THE DETAILS"
INPUT Y.TR.ID
READ R.TRAINEE FROM F.TRAINEE,Y.TR.ID SETTING Y.ERR.VAR ELSE
CRT "UNABLE TO READ RECORD"
CRT "REASON:":Y.ERR.VAR
EXIT(1)
END
CRT "TRAINEE ID:":Y.TR.ID

Kalaiselvi| Corporate Training


7
PRG2-Programming using T24 APIs

CRT "NAME:":R.TRAINEE<1>
CRT "CLASSIFICATION:":R.TRAINEE<2>
CRT "REGION:":R.TRAINEE<3>
CRT "TEST WRITTEN:":R.TRAINEE<4>
GOSUB MYCHOICE

PERFORM.UPDATE:
CRT " UPDATING TRAINEE DETAILS"
CRT "ENTER THE RECORD ID FOR WHICH YOU WISH TO UPDATE"
INPUT Y.TR.ID
READU R.TRAINEE FROM F.TRAINEE, Y.TR.ID LOCKED
CRT "LOCKED BY PORT:":SYSTEM(43)
END ELSE
CRT "RECORD DOES NOT EXIST"
END
Y.OPERATION ='Y'
LOOP
WHILE Y.OPERATION EQ 'Y' DO
CRT " ENTER THE FIELD NUMBER AND THE NEW VALUE DELIMITED BY
_(UNDERSCORE) "
CRT "1. NAME 2. CLASSIFICATION 3. REGION 4. TEST WRITTEN"
CRT "THE VALUE FOR TEST WRITTEN SHOULB BE DELIMITED WITH ',' "
INPUT Y.FN.FV
Y.FIELD.NUM=FIELD(Y.FN.FV,'_',1,1)
Y.FIELD.VALUE=FIELD(Y.FN.FV,'_',2,1)
IF R.TRAINEE<Y.FIELD.NUM> NE 4 THEN
R.TRAINEE<Y.FIELD.NUM>=Y.FIELD.VALUE
END
ELSE
R.TRAINER<4>=''
Y.TEST.COUNT=DCOUNT(Y.FIELD.VALUE,',')
FOR Y.COUNT.TEST = 1 TO Y.TEST.COUNT
Y.TW=FIELD(Y.FIELD.VALUE,',',Y.COUNT.TEST,1)
R.TRAINEE<4,-1>=Y.TW
NEXT Y.COUNT.TEST
END
CRT " IF U WISH TO COUNTINUE, INPUT 'Y'"
INPUT Y.OPERATION
REPEAT
WRITE R.TRAINEE TO F.TRAINEE,Y.TR.ID SETTING V.ERR.VAR ON ERROR
CRT " RECORD COULD NOT BE WRITTEN"
CRT "REASON:":V.ERR.VAR
END

GOSUB MYCHOICE
PERFORM.DELETE:
CRT " DELETING TRAINEE DETAILS"
CRT "ENTER THE TRAINEE ID U WISH TO DELETE"
INPUT Y.TR.ID
DELETE F.TRAINEE,Y.TR.ID SETTING Y.ERR.VAR ON ERROR
CRT "UNABLE TO DELETE THE RECORD"
CRT "REASON:":Y.ERR.VAR
END
GOSUB MYCHOICE
END

Kalaiselvi| Corporate Training


8
PRG2-Programming using T24 APIs

WORKSHOP 3
Add a new field called STATUS in the TRAINEE table.

Write a program which will check the number of tests passed by the
trainee.

If the number is more than 5, then update the field STATUS to

PERMANENT else PROBATION. Use dimensioned arrays in the


program.

Use MATREADU to read. Refer the www.jbase.com website for


details on the MATREADU statement.

*----------------------------------------------------------------------
-------
* <Rating>-11</Rating>
*----------------------------------------------------------------------
-------
PROGRAM STATUS.RTN
CRT "UPDATING THE STATUS OF TRAINEE"
OPEN "TRAINEE" TO F.TRAINEE THEN
CRT " FILE OPENED SUCCESSFULLY"
END
ELSE
CRT " FILE NOT ABLE TO OPEN"
END
SEL.STMT='SELECT TRAINEE'
EXECUTE SEL.STMT RTNLIST KEY.LIST
LOOP

REMOVE Y.TR.ID FROM KEY.LIST SETTING POS


WHILE Y.TR.ID:POS
CRT Y.TR.ID:" "
DIM Y.TR.REC(10)
MATREAD Y.TR.REC FROM F.TRAINEE,Y.TR.ID ELSE
CRT "UNABLE TO READ RECORD"
END

Kalaiselvi| Corporate Training


9
PRG2-Programming using T24 APIs

Y.TEST.WRITTEN = Y.TR.REC(4)
Y.TEST.COUNT=DCOUNT(Y.TEST.WRITTEN,@VM)
IF Y.TEST.COUNT GT 3 THEN
Y.TR.REC(5)<1>='PERMANENT'
END
ELSE
Y.TR.REC(5)<1>='PROBATION'
END
MATWRITE Y.TR.REC ON F.TRAINEE,Y.TR.ID
REPEAT
END

WORKSHOP 4

*----------------------------------------------------------------------
-------
* <Rating>-11</Rating>
*----------------------------------------------------------------------
-------
PROGRAM STATUS.RTN
CRT "UPDATING THE STATUS OF TRAINEE"
OPEN "TRAINEE" TO F.TRAINEE THEN
CRT " FILE OPENED SUCCESSFULLY"
END
ELSE
CRT " FILE NOT ABLE TO OPEN"
END
SEL.STMT='SELECT TRAINEE'
EXECUTE SEL.STMT RTNLIST KEY.LIST
TRANSTART
LOOP

REMOVE Y.TR.ID FROM KEY.LIST SETTING POS


WHILE Y.TR.ID:POS
CRT Y.TR.ID:" "
DIM Y.TR.REC(10)
MATREAD Y.TR.REC FROM F.TRAINEE,Y.TR.ID ELSE
CRT "UNABLE TO READ RECORD"
END
Y.TEST.WRITTEN = Y.TR.REC(4)
Y.TEST.COUNT=DCOUNT(Y.TEST.WRITTEN,@VM)
IF Y.TEST.COUNT GT 3 THEN
Y.TR.REC(5)<1>='PERMANENT'
END
ELSE
Y.TR.REC(5)<1>='PROBATION'
END
MATWRITE Y.TR.REC ON F.TRAINEE,Y.TR.ID
REPEAT
TRANSEND
END

Kalaiselvi| Corporate Training


10

You might also like