Saturday, January 23, 2016

My Technical Memories - Memory 3

Ah! What is it? I could see a  lot of symbols. I had to ponder about it  a bit… Na.. I am joking. How can I ever forget Unix Shell Scripts? I have a long lasting relationship with it. It is really interesting to read my thoughts after a long… long… time. Here comes a small and simple snippet of thoughts….
Unix Shell Script to check every minute whether a user is logged in or not?
# usage is : username
if [ $# -lt 1 ]; then
   echo improper usage
   echo Correct usage is : $0 username
   exit 1
while true
    who | grep `$logname`  > /dev/null
    if [ $? –eq 0 ] ; then
       echo $logname has logged in
       if [ $time – ne 0 ]; then
         echo $logname is $time minutes late
      exit 0
     time=`expre $time + 1`
     sleep 60

Unix and its look alike or derivatives are really amazing, may it be linux, solaris, venix, xenix, HP-unix, SCO- Unix. I hope I recollected my memory accurately. Why don’t you just execute and check… Lot more on its way… see you again later….

Thursday, January 21, 2016

My Technical Memories: Memory - 2

Here is what I found in the second memory. It looked like a random access to my thoughts. I wondered to see that right from IDENTIFICATION DIVISION it took me to COBOL data files. I thought of sharing it rather than putting it into the background. So here it comes. COBOL file or as a matter of fact any file is a collection of data stored on secondary storage device. In a broader perspective COBOL support three types of file organization.
  • Sequential File
  • Indexed File
  • Random File

Sequential File stores the data in the same order in which the data data is provided by the user. Sequential file can be Line, Record or Printer sequential file. Organization of the data in file can be specified in code as:
Organization can be otherwise RECORD SEQUENTIAL or PRINTER SEQUENTIAL. By default it is RECORD SEQUENTIAL.
Indexed File  stores data using an Indexed key. Each record contains the primary key which is unique. In Indexed file you can store unique data. It can also be considered Master file or Master Data as we refer in COBOL. Separate file will be created with .idx extension to the data file. It will look something like this:
By the way, you have a facility to define DUPLICATE KEYS, in that case file can contain redundant data, but hold on, there is a limit which varies depending on type of Index file. Indexed file can be accessed or in other words I can say that data in Indexed file can be organized in three different ways i.e. INDEXED SEQUENTIAL (default, records are accessed on Ascending/Descending Record Key), INDEXED RANDOM (Value of Record Key is used to access the Record) and INDEXED DYNAMIC (Program can switch between Sequential or Random mode by using appropriate I/O statements).
Relative File  identifies each record by ordinal position. This facilitates to access files sequentially or Randomly by using ordinal position in sequence or randomly. If you provide relative position while writing file as 1 and then 100, when you open this data file, can you imagine what will you see? Now, that it my question to you. I was fathomed by what I saw, it was interesting. Another interesting thing I noted while working on Relative files is that although I can create variable length records, System assume the size of largest record length and uses padding for unused spaces. The beneficial side is it brings speed. System can calculate the position of record to be accessed by using relative key and record length. So this is how it looks like:
Like Indexed file, Relative file can be accessed sequentially or randomly is ACCESS MODE is DYNAMIC.
Enjoy this read and look for more… Now what will be next…I have no idea, it depends, I need to decide whether I have to access my memory sequentially or randomly… have fun..

Monday, January 18, 2016

My Technical Memories : Memory - 1

I just opened my thoughts pot. Ah! I felt it was in a mess. So many different types of thoughts: Technical, Personal etc. It was just like if you have been downloading and saving a lot of information in a hard disk to manage it later. I realized I have been doing it. So I imposed a responsibility on myself to arrange it all. Now the question was how to proceed? To manage technical section of my thoughts was a huge task, as I have been working in the industry from a long time. So I opened that area and started looking at the thoughts to classify and manage. The first thought which I saw was related to COBOL. I have a special soft spot for COBOL, as this is the technology which I used in my very first job. So here it is :

Every COBOL program must have four divisions in the following order:


Is this statement TRUE?

PS: I thought of putting my random technical thoughts here... keep looking for more...