Skip to main content

Input stream and data handling across session

How to get input from the user at the run time?

Interacting with the user, collecting and processing the real-time data is an important task of a software. So, how do we get the input from the user.
INPUT – keyword should be used in BASIC to get the data.

 How can I implement that in program?

1 PROGRAM GET.INPUT.FROM.USER
2 CRT “Enter your Name: ”
3 INPUT NAME
4 CRT “Hi ”:NAME
5 RETURN
6 END

The above code will print the below,
Enter your Name:
Anbu
Hi Anbu

“:” - Is the concatenation operator. At line 4, the string Hi is concatenated with the value in NAME variable.

OK. All the data can be processed with in a single session and how do I handle data across two or more session.

Creating a COMMON container:

Create a COMMON container, that will hold all the variables shared across the session. Let’s create a COMMON container.
What is the syntax:
COMMON//,

Example:
//COMMON1
PROGRAM COMMON1
COMMON/COMMON.CONT1/C, E
A=2; B=1; C=3
Z=A+B ;* value of Z is 3
C = A+C ;*value of C is 5
CALL COMMON2
CRT E ;* 5 will be printed.
RETURN
END

//COMMON2
SUBROUTINE COMMON2
COMMON/COMMON.CONT1/C, E
CRT C ;* 3 will be printed
CRT A ;* nothing will be printed
E=5;
RETURN
END

The above program clearly explains the data handling across sessions. The variables in the common container can only be accessed across session.

Do I need to use the common container in both routines? Yes, the exact same container should be used in two programs. It is the anatomy of BASIC.

How can I write a common container only once, without impacting the behavior?

Write the common container in a new file lets name it as I_COMM.VARI
//I_ COMM.VARI
COMMON/COMMON.CONT1/C, E

//COMMON1
PROGRAM COMMON1
$INSERT I_COMM.VARI
A=2; B=1; C=3
Z=A+B ;* value of Z is 3
C = A+C ;*value of C is 5
CALL COMMON2
CRT E ;* 5 will be printed.
RETURN
END

//COMMON2
SUBROUTINE COMMON2
$INSERT I_COMM.VARI
CRT C ;* 3 will be printed
CRT A ;* nothing will be printed
E=5;
RETURN
END

$INSERT - will include the file in that routine. This will be much useful, when there are many variables (about 50) in the common container.


Do you have better implementations, please let us know in the comments below?

Comments

Popular posts from this blog

How to get 5GB instantly in seedr?

Seedr is a torrent caching site which provides 2GB of caching for free. For those who are not aware of what the torrent is?  Torrent is a peer to peer communication protocol (P2P) for file sharing. It was introduced in the mid of 2001 for decentralizing the file sharing in this real world. How the files are shared via torrent? Files are uploaded to servers as we do traditionally but the interesting part comes here, these files can be downloaded only via torrent client like Bit torrent, µtorrent, Vuze or you can use any other clients available in the market. Just do a google search to find all the available clients for downloading files.  Why they are restricting the download to clients? Because, the concept here is each computer acts as a server, once you start the download, the client will start uploading the data. Someone on the internet will download the same file based on the data you upload, this process is called seeding, thus decentralizing the data and r...

Decision making statements - T24

As a programmer, it is essential for you to make your program to work better in all the cases. So, based on the real-time data, you have to decide how the program should work. So, it is important to take decision. Consider a simple case where you want to print the number provided by the user at runtime is even or odd. How to handle that in programs? Decision making statements comes in to play. So, what is the syntax and how to use that? IF condition THEN                 This block will execute when the if condition is satisfied or validated to true. END This is the syntax of the simple IF block. Ok. If the condition is not satisfied, then what will happen. I need to do something when IF condition is failed. How to handle that? ELSE block should be introduced. Here is the syntax, IF condition THEN               ...

Hello World - Getting Started with T24

Are you looking to develop great modules and local services for T24? This is the perfect place to start with. Let’s start from the basics. The core banking platform, T24 is developed with INFOBASIC code. This is the proprietary language of Temenos. T24 has the unique compiler to convert the BASIC code to object files with TAFc (Temenos Application Framework c) platform. An another flavour TAFj (Temenos Application Framework java), converts the BASIC to bytecode making it capable to run on any device with the Java runtime installed. The BASIC code remains same for both TAFc and TAFj Platform. Enough Intro! Let’s say hello to this world, How the syntax of this basic program looks like, PROGRAM program_name all the basic statements reside inside this block END Now, it is right time say hello, PROGRAM HELLO                 CRT “Hello World” END Yah, we did that. But, how to r...