Approaches to Mainframe Migration

 The purpose of this blog is to know what are the real challenges of mainframe migration  and the different approaches to mainframe migration.


In mainframe data is maintained in VSAM, IMS, IDMS etc in non-relational formats such as networked and hierarchical structures or combination of both. Technical Challenges in migrating the mainframe in some of the IT companies are Data and referential integrity, incompatible file formats and structures. IT companies need to create schema, which includes mapping mainframe keys to concept of  primary and secondary keys, to maximize performance.


Approaches to Mainframe Migration:-

Mainframe migration is not an easy process. IT organizations need both a robust data migration tool set and  data migration methodology to migrate off the mainframe onto the Oracle system or any other system.

1> Data is migrated off the mainframe as a one-time data movement event, often completed during a period like on saturdays and sundays or the early morning hours. It requires an early planning as bulk of data has to be moved.

2> The second approach is data is migrated off the mainframe in batches (e.g., daily, weekly, monthly).

3> In third approach two production systems – the mainframe system and any other system – run in parallel   with data on each system and replicate data on the other. The hurdle is to to support both batch and real time bi-directional integration, since in many cases, both systems will be running for years before the mainframe is shut down.

4> This approach involves multiple data sources (e.g., VSAM, DB2, IMS,  etc.), which must be read and joined to produce a single view of the data inside the new system.

5> In fifth approach the data from all the mainframe sources is joined virtually to provide a “just in time” single view to the consuming applications or users

6> Mainframe system updates are executed by initiating batch jobs, or by such on-line transaction systems as Customer Information Control Systems (CICS) or Information ManagementSystem/TransactionManager(IMS/TM), formerly known as IMS/Data Communications (IMS/DC).

The top  six challenges associated with mainframe data migration projects are Identifying and analyzing source data, Accessing source data, Addressing data quality in legacy applications, Preparing and loading data into the target system, Supporting the data migration life cycle, Accommodating behavioral changes.

Role of ETL (Extract, Transform and load) in Banking

·        Extract 
·         The process of extracting data from external sources or database.
·         Transform 
·         The process of transforming data into new formats according to business rules. It reformats data and cleanse it to remove duplicates and maintains consistency.
·         Load
The process of loading the data into the end target or repository.

ETL is used to migrate data from one bank to another bank as ETL moves the data in bulk.The data used in ETL processes can come from any source: for example from a mainframe application, a flat file etc. ETL tool provides a visual flow of the system's logic.



The ideal approach for successfully managing a data migration project is cyclical. It allows IT companies to analyze the data, extract and transform the data, validate the data, load it into targets, and then, most importantly, repeat the process until the migration is successfully completed.


IBM DataStage and Informatica are examples of ETL solutions that have extensive background and experience in the ETL market with their ability to scale performance in handling very large data volumes



Difference between JCL and JCL Proc in IBM Mainframe



Job Control Language (JCL) is used to tell what program to execute,followed by program inputs and outputs. JCL defines how a job is executed on the mainframe.

There are three basic JCL statements:


1. The JOB statement is the first in a JCL stream. Its format is // jobname, keyword JOB, accounting information in brackets and keywords, MSGCLASS, MSGLEVEL, NOTIFIY, CLASS, etc.

2. The EXEC statement identifies the program to be executed via a PGM=program name keyword. Its format is //jobname EXEC PGM=program name. The PARM= keyword can be used to pass external values to the executing program.

3. The DD statement links the external dataset name (DSN) to the DDNAME coded within the executing program. It links the file names within the program code to the file names know to the MVS operating system. The syntax is // ddname DD DSN=dataset name. Other keywords after DSN are DISP, DCB, SPACE, etc.





PROC stands for procedure. It is ‘canned’ JCL invoked by a PROC statement.

If a segment of JCL is used repeatedly it may be coded once as a PROC (or JCL Procedure) and then used by many different steps within the job.


 An instream PROC is presented within the JCL; a catalogued PROC is referenced from a proclib partitioned dataset.

Sample JCL to do Endevor Scan in Mainframe

Endevor is a mainframe source code management tool. We can access endeavor function through ISPF panel(E). Endeavor maintains each element with the code name, system, subsystem and type. Suppose, you are doing analysis or design and you need to refer some code which has some text like report ABC or the program which uses certain file name etc. There can be certain instances when you don't have much time to go and open each and every code in Endevor and search for the certain text which you want. In that situation the JCL below can help you to do Endevor Scan:

//AAAAAA   JOB (BBBB,CCCC),MSGCLASS=X,CLASS=C,                        
//          MSGLEVEL=(1,1),NOTIFY= DDDD
//*********************************************************************
//*  ENDEVOR JCL STATEMENTS                                           *
//*********************************************************************
//NDVRBAT  EXEC PGM=NDVRC1,DYNAMNBR=1500,REGION=4096K,
//  PARM='C1BM3000'
//SYSPRINT DD SYSOUT=*
//*********************************************************************
//*             SORT WORK FILES                                       *
//*********************************************************************
//SORTWK01 DD UNIT=SYSDA,SPACE=(CYL,(1,2))
//SORTWK02 DD UNIT=SYSDA,SPACE=(CYL,(1,2))
//SORTWK03 DD UNIT=SYSDA,SPACE=(CYL,(1,2))
//C1TPDD01 DD UNIT=SYSDA,SPACE=(CYL,5),
//            DCB=(RECFM=VB,LRECL=260,BLKSIZE=6160)
//C1TPDD02 DD UNIT=SYSDA,SPACE=(CYL,5),
//            DCB=(RECFM=VB,LRECL=260,BLKSIZE=6160)
//*********************************************************************
//*             PANVALET SUPPORT                                      *
//*********************************************************************
//C1TPLSIN DD UNIT=SYSDA,SPACE=(CYL,5),
//            DCB=(RECFM=FB,LRECL=80,BLKSIZE=6160)
//C1TPLSOU DD UNIT=SYSDA,SPACE=(CYL,5)
//C1PLMSGS DD SYSOUT=*
//*********************************************************************
//*  OUTPUT DATA SETS                                                 *
//*********************************************************************
//C1MSGS1  DD SYSOUT=*
//C1MSGS2  DD SYSOUT=*
//C1PRINT  DD SYSOUT=*,DCB=(RECFM=FBA,LRECL=121,BLKSIZE=6171)
//SYSUDUMP DD SYSOUT=*
//SYSOUT   DD SYSOUT=*
//*********************************************************************
//* REQUEST DATA SET (BSTIPT01 CONTAIN THE NDVR SCL) 
//*********************************************************************
//BSTIPT01 DD *
LIST ELEMENT '*'
FROM ENVIRONMENT 'EEEE' SYSTEM 'FFF' SUBSYSTEM 'GGG'
TYPE 'HHHH' STAGE X
OPTIONS SHOWING TEXT NOSEARCH
WHERE TEXT EQ
'IIIIIIIII JJJJJ KKKKK LLLLLL’
COLUMNS 001 080
BUILD ACTION LIST
.



where AAAAAA is the job name
           BBBB is accounting information
           CCCC is name of the programmer
           DDDD is User id or &SYSUID
           EEEE is environment like PROD, TEST, AHOC etc
           FFF is the system’s name,platform or domain on which you are working 
           GGG is the subsystem’s name if any
           HHHH is the type of the program whether its COBOL DB2,COBOL,CICS DB2,ADHOC        
etc
           X is the stage where program resides like X,P(Production, Test etc)
           IIIIIIIII JJJJJ KKKKK LLLLLL is the texts which you need to search

        


Regular Expression (an exact text match) in SAS

SAS regular expressions enables us to locate patterns in text strings. The implementation of the Perl regular expression in SAS is said to be efficient. This blog is about how to use Perl Regular Expression to locate text match.


In the example shown below, the PRXMATCH function is used to return the position of the word "SAS" in each of the strings. PRXMATCH function is used much like the FIND function.It returns the first position in String where "SAS" is found.The PRXPARSE function is used to create a regular expression

title "Perl Regular Expression in SAS";
data _null_;
if _n_ = 1 then Pattern_num = prxparse("/SAS/");
*exact match for the letters 'SAS' anywhere in the string;
retain Pattern_num;
input String $60.;
Position = prxmatch(Pattern_num,String);
file print;
put Pattern_num= String= Position=;
datalines;
SAS is a collection of modules to process and analyze data
There are many functions used in SAS
Learning SAS is easy
Regular expressions in SAS
;

The Output would look like this:-

Perl Regular Expression in SAS


Pattern_num=1 String=SAS is a collection of modules to process and analyze data Position=1  
Pattern_num=1 String=There are many functions used in SAS Position=34                        
Pattern_num=1 String=Learning SAS is easy Position=10                                        
Pattern_num=1 String=Regular expressions in SAS Position=24                                  





The value of Position is the location of the letter "S" in "SAS" in each of the strings

Basic Trigonometric Functions in SAS

This Blog demonstrates some mathematics in SAS. We will be using basic trigonometric functions such as Sin, Cos, Tan in SAS.

SAS Statements would look like this:-

***Trigonometric Functions: COS, SIN, TAN;
data trig_metric;
if _n_ = 1 then Pi = constant('pi');
retain Pi;
do Angle = 0 to 360 by 45;
Radian = Pi*Angle/180;
Sin = sin(Radian);
Cos = cos(Radian);
Tan = tan(Radian);
output;
end;
drop Pi Radian;
run;
options ls=22 missing='-';
title "Trigonometric Functions";
proc report data=trig_metric nowd panels=99;
columns angle sin cos tan;
define angle / display 'Angle' width=5 format=4.;
define sin / display 'Sin' width=6 format=6.4;
define cos / display 'Cos' width=6 format=6.4;
define tan / display 'Tan' width=6 format=6.2;
run;


We have multiplied the angle in degrees by π/180 to convert to radians.



Output would look like this:-

Various Character Functions in SAS


While I was learning SAS, I  had to refer text often to get to know about various character functions available in SAS, So one day I decided why not to create a blog which summarizes most of the character functions at a place and here it is. I am just putting one liner explanation for a quick glance.


SUBSTR
Use: To extract part of a string. When the SUBSTR function is used on the left side of the equal sign, it can place specified characters into an existing string.
LENGTH
Use: To determine the length of a character value, not counting trailing blanks. A null argument returns a value of 1.
LENGTHC
Use: To determine the length of a character value, including trailing blanks
REVERSE
Use: To reverse the order of text of a character value.
COUNT
Use: To count the number of times a given substring appears in a string.
PROPCASE
Use: To capitalize the first letter of each word in a string.
COMPARE
Use: To compare two character strings
COMPBL
Use: To replace all occurrences of two or more blanks with a single blank character.
UPCASE
Use: To change all letters to uppercase.
LOWCASE
Use: To change all letters to lowercase
COMPRESS
Use: To remove specified characters from a character value
ANYALNUM
Use: To locate the first occurrence of an alphanumeric character (any uppercase or lowercase letter or number) and return its position
ANYALPHA
Use: To locate the first occurrence of an alpha character (any uppercase or lowercase letter) and return its position
ANYDIGIT
Use: To locate the first occurrence of a digit (numeral) and return its position. If none is found, the function returns a 0.
ANYPUNCT
Use: To locate the first occurrence of a punctuation character and return its position.
ANYSPACE
Use: To locate the first occurrence of a white space character (a blank, horizontal
or vertical tab, carriage return, linefeed, and form-feed) and return its position
ANYUPPER
Use: To locate the first occurrence of an uppercase letter and return its position
ANYLOWER
Use: To locate the first occurrence of a lowercase letter and return its position
FIND
Use: To locate a substring within a string.
FINDC
Use: To locate a character that appears or does not appear within a string
FINDW
Use: To search a string for a word, defined as a group of letters separated on both ends by a word boundary (a space, the beginning of a string, or the end of the string).
INDEX
Use: To locate the starting position of a substring in a string
INDEXC
Use: To search a character string for one or more characters
VERIFY
Use: To check whether a string contains any unwanted values.
CHAR
Use: To extract a single character from a string.
FIRST
Use: To extract the first character from a string
CAT
Use: To concatenate (join) two or more character strings or numeric values, leaving leading and/or trailing blanks unchanged. This function accomplishes the same task as the concatenation operator (||).
CATS
Use: To concatenate (join) two or more character strings or numeric values, stripping both leading and trailing blanks on character values
CATT
Use: To concatenate (join) two or more character strings or numeric values, stripping only trailing blanks on character values
CATX
Use: To concatenate (join) two or more character strings or numeric values, stripping both leading and trailing blanks on character values and inserting one or more separator characters between the strings.
CATQ
Use: This function is similar to the CATX function, since it joins strings or numeric values and allows you to choose a separator between each of the strings.
LEFT
Use: To left-align text values.LEFT doesn't remove the leading blanks; it moves them to the end of the string.
RIGHT
Use: To right-align a text string.If the length of a character variable has previously been defined and it contains trailing blanks, the RIGHT function will move the characters to the end of the string and add the blanks to the beginning so that the final length of the variable remains the same
TRIM
Use: To remove trailing blanks from a character value.
STRIP
Use: To strip leading and trailing blanks from character variables or strings.
SCAN
Use: Extracts a specified word from a character value, where word is defined as the characters separated by a set of specified delimiters
TRANSLATE
Use To exchange one character value for another. For example, to change values 1–3 to the values A–C.
TRANWRD
Use: To substitute one or more words in a string with a replacement word or words. It works like the find-and-replace feature of most word processors.
MISSING
Use: To determine if the argument is a missing (character or numeric) value.The function returns a 1 (true) if the value is a missing value, a 0 (false) otherwise
REPEAT
Use: To make multiple copies of a string.

Some of the Arithmetic functions are as follows: ABS(argument)->returns absolute value DIM(array-name) ->returns the number of elements in a one-dimensional array or the number of elements in a specified dimension of a multidimensional array.n specifies the dimension, in a multidimensional array, for which you want to know the the number of elements. DIM(array-name,bound-n) ->returns the number of elements in a one-dimensional array or the number of elements in the specified dimension of a multidimensional array .bound-n specifies the dimension in a multidimensional array, for which you want to know the number of elements. HBOUND(array-name) ->returns the upper bound of an array HBOUND(array-name,bound-n)->returns the upper bound of an array LBOUND(array-name) ->returns the lower bound of an array LBOUND(array-name,bound-n) ->returns the lower bound of an array MAX(argument,argument, ...) ->returns the largest value of the numeric arguments MIN(argument,argument, ...) ->returns the smallest value of the numeric arguments MOD(argument-1, argument-2) ->returns the remainder SIGN(argument) ->returns the sign of a value or 0 SQRT(argument) ->returns the square root

Mean, Average using SAS

Suppose we have a text file called data.txt containing a stock symbol, a price, and the
number of shares. Here are some sample lines of data:

TATA 67.66 100
DELL 24.60 200
GE 34.50 100
SATYAM 32.32 120
IBM 82.25 50
CTS 30.24 100

1. Using this raw data file, we have to create a temporary SAS data set (stock). We Choose variable names as the stock symbol, price, and number of shares. In addition, we create a new variable (call it Value) equal to the stock price times the number of shares.

2. Compute the average price and the average number of shares of your stocks.

The program would look like this:-













The Output would look like this:-


Basic Concepts of SAS (Statistical Analysis System)

What is SAS ?

SAS (Statistical Analysis System) is a collection of modules that are used to process and analyze data. SAS is a powerful and easy-to-use high level programming system. SAS is a set of solutions for enterprise- wide business users for performing:

1>   Applications Development
2>   Business planning
3>   Data entry
4>   Decision support
5>   Forecasting
6>   Graphics
7>   Operations research
8>   Project Management
9>   Retrieval and Management
10> Report writing
11> Statistical and Mathematical Analysis
12> Quality Improvement

It provides extensive data management tools and file handling tools. It helps in converting raw data into a meaningful information that is used in decision making.

SAS runs on many platforms ( Unix , MVS , Windows , VAX etc ). However for any SAS product to run , the Base SAS software must be installed in the system.


SAS Processing:-

A SAS program may contain a DATA step, a PROC STEP or any combination of DATA and PROC step.
DATA steps – create SAS data sets.
PROC steps – process SAS datasets like sorting, generating reports & graphs

The DATA step is an implied loop. This means that if a file is read in the data step, an automatic loop is executed till end of the file is reached. An automatic system generated variable _N_ is incremented each time the loop starts.

What are the rules of SAS Statements ?

1> Begin with an DATA or PROC (identifying keyword) and always ends with SEMICOLON
2> Statements can be in lower case or upper case.
3> SAS statements are free- format means they can begin or end in any column.
4> SAS detects the beginning of a step when it encounters a DATA or PROC statement.
5> SAS detects the end of a statement when it encounters a DATA or a PROC or a RUN or statement.
6> Length of variables should be 1 to 8 characters.
7> Variables should start with a letter or _(underscore).
8> Comments are like /* */
or * ; (for single line comments).

What is a SAS dataset?

SAS dataset is a SAS file consisting of two parts: Data portion and a Descriptor portion.
Data Portion:          It is a collection of data values
Descriptor Portion: The descriptor portion of a dataset contains information about the dataset like: Name of dataset, date and time the dataset was created, number of Observations,number of variables.

When we submit a DATA step, SAS software processes the DATA step and creates a new SAS data set.
Let's see exactly how that happens.SAS Data step is processed in two distinct phases:
During the compilation phase, each statement is scanned for syntax errors. Most syntax errors prevent further processing of the DATA step.
If the DATA step compiles successfully, then the execution phase begins. A DATA step executes once for each observation in the input data set, unless otherwise directed


What happens when a SAS program is submitted?

1> SAS software reads the statements and checks them for errors
2> When it encounters a DATA, PROC, or RUN statement, SAS software stops reading statements and executes the current step in the program.
3> Each time a step is executed, SAS software generates a log of the processing activities and the results of the processing.
The SAS log collects messages about the processing of SAS programs and any errors that may occur.
4> Separate sets of messages for each step in the program are produced.