Mainframes run the world
Despite the excitement that has surrounded the Web and new programming models like Java and J2EE (as well as Microsoft’s .NET), older, less ‘trendy’ technologies account for the vast bulk of computer processing today.
IBM and the mainframe
IBM is the leading mainframe vendor, with over 70% market share. Therefore, while this report covers the global mainframe market – it is largely dominated by IBM.
IBM is committed to its mainframe technology
the recent release of the z/os demonstrated the fact that IBM is committed to supporting its existing clients and sees a long-term future in the platform. IBM has invested well over $1 billion in developing the z/os .
The future of the mainframe
This reports says that over the next five years the number of individual mainframe machines will fall, but the total number of deployed MIPS will continue to rise.
Monday, December 10, 2018
Saturday, November 17, 2018
Decorator Design Pattern C++
In object-oriented programming, the decorator pattern is a design pattern that allows behavior to be added to an individual object, dynamically, without affecting the behavior of other objects from the same class.
#include<iostream>
using namespace std;
class pizza{
public:
virtual string getdescription() =0;
virtual int price() = 0;
};
class plainpizaa:public pizza{
public:
virtual string getdescription()
{
return "plain pizza";
}
virtual int price()
{
return 5;
}
};
class pizzaDecorator:public pizza{
protected:
pizza *m_pPizza;
public:
pizzaDecorator(pizza *_piza):m_pPizza(_piza){}
virtual string getdescription()
{
return m_pPizza->getdescription();;
}
virtual int price()
{
return m_pPizza->price();
}
};
class tomato:public pizzaDecorator
{
public:
tomato(pizza *_pizza)
:pizzaDecorator(_pizza){}
string getdescription()
{
string temp = m_pPizza->getdescription();
temp +="Tomato";
return temp;
}
int price()
{
return m_pPizza->price() + 2;
}
};
class cheese:public pizzaDecorator
{
public:
cheese(pizza *_pizza)
:pizzaDecorator(_pizza){}
string getdescription()
{
string temp = m_pPizza->getdescription();
temp +="cheese";
return temp;
}
int price()
{
return m_pPizza->price() + 1;
}
};
int main()
{
pizza *p = new tomato(new cheese(new plainpizaa()));
cout<<p->price();
return 0;
}
Command design pattern in C++
Definition By Wiki:
Command pattern. In object-oriented programming, the command pattern is a behavioral design pattern in which an object is used to encapsulate all information needed to perform an action or trigger an event at a later time.
There are 2 examples in the below given code one with the device and other with stock buy,sell order
// cmd pattern decouples the commands and the underlying object
// you just need to pass the underlying concrete object on which you want to call the command
// to the command concrete object
//
#include<iostream>
using namespace std;
//#define TV_EXAMPLE
#define STOCK_ORDER
#ifdef TV_EXAMPLE
class cmd{
public:
virtual void execute()=0;
};
class device{
public:
virtual void on() = 0;
virtual void off() = 0;
//virtual void volincrease() = 0;
//virtual void voldcrease() = 0;
};
class tv:public device{
public:
void on()
{
cout<<"TV on";
}
void off()
{
cout<<"TV off";
}
};
class on:public cmd{
public:
on(device *_d):d(_d){}
device *d;
void execute()
{
d->on();
}
};
class off:public cmd{
public:
off(device *_d):d(_d){}
device *d;
void execute()
{
d->off();
}
};
Sunday, November 11, 2018
Tuesday, May 1, 2012
Remove Multiple spaces to one in COBOL
Hi Guys
I was asked this question in some interview and find it interesting .Please check the below given program and do suggest me if you have some better solution
identification division.
program-id. bdemo.
environment division.
input-output section.
file-control.
select infile assign to "../xyz/input.txt"
organization is line sequential.
select outfile assign to "../xyz/output.txt"
organization is line sequential.
select workfile assign to "../xyz/temp.txt".
data division.
file section.
fd infile
label records are standard
record contains 132 characters
data record is in-rec.
01 in-rec.
05 filler pic x(132).
fd outfile
label records are standard
record contains 132 characters
data record is out-rec.
01 out-rec.
05 filler pic x(132).
working-storage section.
01 ws-end-of pic x.
88 ws-eof value 'Y'.
88 ws-not-eof value 'N'.
01 ws-space pic x.
88 first-char value 'Y'.
88 first-space value 'N'.
01 i pic 9(3) value 1.
01 j pic 9(3) value 1.
01 ws-left pic 9(3) value zeros.
linkage section.
procedure division .
1000-pgm-start.
display "ksingh".
open input infile .
open output outfile.
set ws-not-eof to true.
perform display-para until ws-EOF.
close infile.
close outfile.
exit program.
remove-spaces.
move 1 to i.
move 1 to j.
set first-space to true.
if in-rec(i:1) = space
set first-space to true
else
set first-char to true
end-if.
move 1 to i.
move 1 to j.
perform 132 times
if in-rec(i:1) = space
add 1 to i
set first-space to true
else
if (first-space)
move " " to out-rec(j:1)
add 1 to j
end-if
set first-char to true
move in-rec(i:1) to out-rec(j:1)
add 1 to i
add 1 to j
end-if
end-perform.
compute ws-left = 132 - j .
move spaces to out-rec(j:ws-left).
write out-rec.
remove-spaces-end.
display-para.
read infile at end set ws-EOF to true.
if (not ws-eof)
perform remove-spaces thru
remove-spaces-end
display in-rec.
display-para-exit.
exit
cob_ques
Monday, September 5, 2011
what is RETURN-CODE special register in COBOL?
When control is returned to a COBOL program or method from a call, the contents of register 15 are stored into the RETURN-CODE special register of the calling program or method. When control is returned from a COBOL program to the operating system, the special register contents are returned as a user return code.
You might need to think about this handling of the RETURN-CODE special register when control is returned to a COBOL program from a non-COBOL program. If the non-COBOL program does not use register 15 to pass back the return code, the RETURN-CODE special register of the COBOL program might be updated with an invalid value. Unless you set this special register to a meaningful value before your Enterprise COBOL program returns to the operating system, a return code that is invalid will be passed to the system
cob_ques
Friday, September 2, 2011
How we can reverse a string in COBOL without cobol function reverse?
Popular Posts
-
Hi Guys I was asked this question in some interview and find it interesting .Please check the below given program and do suggest me i...
-
Please read the below given code. If you don't want to calculate the string lenth before the string reversal then you ...
-
GDG is a group of datasets that are related to each other chronologically or functionally.Each of the dataset is called a generation number....
-
CONDITION name is identified with special level ‘88’. A condition name specifies the value that a field can contain and used as abbreviat...
-
There are four divisions in a COBOL program and the data division is an optional one. 1.Identification Division. 2.Environment Division. ...
-
DISPLAY Default. Number of bytes required equals to the size of the data item.If we don't mention anything then default Usage is Disp...
-
SYNC clause is specified with COMP, COMP-1 and COMP-2 items. These items are expected to start at half/full/double word boundaries for fa...
-
In object-oriented programming, the decorator pattern is a design pattern that allows behavior to be added to an individual object, dy...
-
JCL (Job Control Language) is used to DEFINE and CONTROL the JOB to the operating system. Definition involves definition of the programs...