Wednesday, 25 April 2018

Mainframe Terminologies


1.       SDSF – System Display and Search Facility
2.       SUBSYSTEM – TSO(Time Sharing Option) / SMF (Storage Management Facility) / CICS
3.       TELECOMMUNICATION – BTAM / TCAM / VTAM
4.       IMS – IMSDB / IMSDC
5.       DB2

6.       Security RACF (Resource Access Control Facility) / System Libraries (SYS1.NUCLEOUS / SYS1.LINKLIB / SYS1.SVCLIB

IBM Mainframe Tools

1.       FILEAIDPowerful editor, browse, edit, allocate, compare, copy, delete & print files / PARAMETERS, BROWSE / EDIT /EXIT.
2.       CHANGEMAN -   Create Package / diff. environment in which code can be tested / approval process. / BUILD, FREEZE, PROMOTE, APPROVE & DELETE.
3.       XPEDITOR -  Debug a program / Stage COBOL program in CHANGEMAN, make sure its status is active (While compiling select XPEDITOR option to ‘Y’ / JCL run COBOL program, enter ‘XP’ on command line in ISPF panel / F9 (to debug your program) / F12 (execute statement up to break point) / Break points – B(Before execution) / A(After execution) / Keep(K) – Keep <Variable Name> / PEEK <variable Name> / SKIP (Skip execution of particular line) / GOTO / WHEN (WHEN WS_X = 5456) / QUIT
4.       ISPF/TSO – PDF (Program development facility) / TSO Commands (TSO Mainview) can be embedded in REXX or CLISTs). / HEXON, HIDE, DISPLAY, VFMT & CHAR.
5.       ENDEVOR – Compile a Program & store every version of program. Run under MVS within TSO/ISPF environment in batch.
6.       ABEND-AID Detects diagnose abends and condition codes. Automatically collect program & environment information relevant for failure & present in manner easily understood.
7.       EASYTRIEVEReport generator product of CA technologies.
8.       BMC UtilitiesREORG, RUNSTATS, IMAGE Copy, RECOVERY etc.
9.       BMC Tools – SQL Explorer, File Manager, APPTUNE, MAINVIEW etc.
10.   SYBASE Power Designer
11.   SUPERC Utility – Option 3.12 (Compare Dataset).
12.   SEARCH_FOR – Option 314 (Search datasets for strings of data)
13.   QMF - Query Management Facility
14.   SPUFI SQL Processing using file input.
15.   CA7 Scheduling Tool
16.   File Master Plus
17.   ISPW – For Version Control

18.   TRITUNE/APTITUNE

REXX Tutorial


1.       REXX (Restructured Extended Executor) -  scripting language – TSO/CLIST/REXX.
Pgm - /*REXX*/ say "Hello World" - /* */ is used for comments
Pgm - /* REXX */ say add(5,6) exit add: parse arg a,b return a + b à  Output – 11

2.       Subroutines and Functions - Functions return a value whereas subroutines don’t.
a)       Function - /* REXX */ say add(5,6) exit add: parse arg a,b return a + b
b)      Subroutine - /* REXX */ add(5,6) exit add: parse arg a,b say a + b
c)       Executing Command - control language for a variety of command-based systems - /* REXX */ parse arg command "file1" command "file2" command "file3" exit.
d)      Keywords in Rexx - WHILE in a DO instruction, THEN, IF or WHEN clause.
e)       Comments in Rexx -  /* */

2.       Data Types – Integer (5), Big Integer (5000000000), Decimal (5.5), Float (number in scientific notation, 12E2), String (Hello).

3.       Variables - var-name, var-value - /* REXX */ X = 40 Y = 50 Result = X + Y say Result.


4.       Operators - Arithmetic Operators (+ -  * /  // %), Relational Operators ( = < > => <=), Logical Operators ( & \ &&), Bitwise Operators (bitand / bitor / bitxor)

5.       ARRAY - Allow you to group a list of values of the same type. array_name.0 = ‘first element’ or array_name.1 = ‘first element’ / Ex - /* REXX */ list.1 = 0 list.2 = 0 list.3 = 0.
Iterating through array elements – /* REXX */ list.1 = 10 list.2 = 20 list.3 = 30 number_of_elements = 3 do j = 1 to number_of_elements say list.j end.
Two-dimensional Arrays - /* Main program */ list.1 = 10 list.1.1 = 11 list.1.2 = 12 say list.1 say list.1.1 say list.1.2

6.       LOOPS
a)       do loop - execute a no of statement for certain no. of times.
b)      do-while - execute when condition being evaluated true,
c)       do-until - execute when condition being evaluated False.
Ex - /* Main program */ do i = 0 to 5 by 2 say "hello" end.

7.       Decision MakingIF END, IF-ELSE END, SELECT
Ex /* REXX */ i = 4 select when (i <= 5) then say "i is less than 5"

8.       METHODS
a)      NUMBERS (ABS, MAX, MIN, RANDOM, SIGN, TRUNC)
b)      STRING (left. Right, length, reverse, compare, copies, substr, pos, delstr)
9.       Function - FunctionName: PARSE ARG arguement1, arguement2… arguementN Return value. Ex – /* REXX */ say add(5,6) exit add: PARSE ARG a,b return a + b
a)       Working with Arguments, arg( ) – return the count of arguments defined by function i.e in above example ‘2’. arg(index) – value of argument at specific position i.e. in above example arg(1) is ‘5’.
b)      Recursive Functions - one that calls itself. Ex -  /* REXX */ do n = 1 to 5 say 'The factorial of' n 'is:' factorial( n ) end return  /* Function to get factorial */ factorial : procedure n = arg(1) if n = 1 then return 1 return n * factorial( n - 1 )

10.   Stack
a)       External data queue, block of memory that is logically external to Rexx. Instructions like push and queue place data into the stack.
b)      Instructions like pull and parse pull extract data from it.
c)       /* REXX */
/* This program shows how to use the Rexx Stack as either a */ /* stack or a queue. */
do j = 1 to 3 push ‘Stack: line #’ || j /* push 3 lines onto the stack */ end do j = 1 to queued() /* retrieve and display LIFO */ pull line say line end do j = 1 to 3 queue ‘Queue: line #’ || j  /* queue 3 lines onto the stack */ end do queued() /* retrieve and display FIFO */ pull line say line end exit 0 – OUTPUT – STACK: LINE #3 STACK: LINE #2  STACK: LINE #1 

11.   FILE I/O
a)       Reading the Contents of a File a Line at a Time (linein) – Ex - /* REXX */ line_str = linein(Example.txt) say line_str
OUTPUT – Example1 (here the file Example.txt contain 3 records Example1 Example2 & Example3)
/* REXX */ do while lines(Example.txt) > 0  line_str = linein(Example.txt) say line_str end
Output – Example1 Example2 Example3 
b)      Writing Contents to a File (lineout) –
 /* REXX */ out = lineout(Example.txt,"Example4")
Output – ‘Example4’ will be written to file Example.txt


12.   Functions For Files Lines, stream, charin, chars, charout

13.   Subroutines  /* REXX */ call add 1,2 exit add: PARSE ARG a,b c = a + b say c. Different Methods for Arguments – arg( ) , arg(index)


14.   Built-In FunctionsADDRESS, BEEP, DataType, DATE, DIGITS, ERRORTEXT, FORM, TIME, USERID, XRANGE, X2D, X2C

15.   System Commands

a)       dir – /* Main program */ dir if rc = 0 then say 'The command executed successfully' else say 'The command failed, The error code is =' rc (error number will be given in the rc variable name)
b)      Redirection Commands – < − to take in the input which comes from a file, > − to output the content to a file, >> − to output the content to a file. But the output is added to the end of the file to preserve the existing content of the file. Ex – /* REXX */ 'sort <sortin.txt> sortout.txt' – Output – a b c (sort command to sort a file called sortin.txt , data from the file is sent to the sort command, output of the sort command is then sent to the sortout.txt file).
c)       ADDRESS function - default environment used for the Input, Error and Output streams – /* Main program */ say ADDRESS('I') say ADDRESS('O') say ADDRESS('E')

16.   ParsingPARSE {UPPER|LOWER|CASELESS} source {template}
a)       SOURCE (ARG / LINEIN / SOURCE / VAR name)
b)      Template ( variable-name / literal string)
Ex – /* REXX */ parse value 'This is a Tutorial' with word1 word2 word3 word4 say "'"word1"'" say "'"word2"'" say "'"word3"'" say "'"word4"'" 
Output - 'This' 'is' 'a' 'Tutorial' - (here word1 etc. are template and ‘This is a Tutorial’ is source)
c)       Positional Parsing –
/* Main program */ testString = "Doe       John M.   03/03/78 Mumbai India"; parse var testString name1 11 name2 21 birthday 31 town 51 country say name1 say name2 say birthday say town say country.
output – Doe John M. 03/03/78 Mumbai India

17.   Signals/* REXX */ n = 100.45 if \ datatype( n, wholenumber ) then    signal msg    say 'This is a whole number'    return 0 msg :    say 'This is an incorrect number' – Output – This is an incorrect number.


18.   Debugging - Trace in Batch Mode – trace [setting] (setting – A, C, E, F , I, L, N)
/* Main program */ trace A /* Main program */ n = 100.45 if datatype( n, whole number ) then signal msg say 'This is a whole number' return 0 msg :    say ' This is an incorrect number ' / Trace Function – trace(), Trace Value - trace(trace level), Interactive Tracing - trace ?options - press the Enter button to move onto the next line of code.

19.   Error HandlingERROR, FAILURE, HALT, NOVALUE, NOTREADY, SYNTAX, LOSTDIGITS. Trapping Errors - signal on [Errorcondition].
/* Main program */ signal on error signal on failure signal on syntax signal on novalue beep(1) exit 0 error: failure: syntax: novalue: say 'An error has occured' say rc say sigl
Output – An error has occurred 40 6


20.   Extended Functionsb2c, bitclr, bitcomp, buftype, crypt, fork, getpid, hash.

21.   Instructionsaddress, drop, interpret, nop, pull, push



/*REXX*/
ADDRESS TSO "ALLOC F(INFILE) DSN('my.seq.dsn') SHR REU"
/* INFILE is a logical name for the file */
"EXECIO * DISKR INFILE ( FINIS STEM MYFILE."
/* MYFILE is the stem (array) that holds the data */
"FREE F(INFILE)" I = 1
/* MYFILE.0 will have the number of elements in the stem */
DO WHILE I <= MYFILE.0
SAY ' LINE ' I ' : ' MYFILE.I I = I + 1
END EXIT


IMS Tutorial


1.       OVERVIEW - Data Language Interface (DL/I), IMS Transaction Manager, IMS Database Management System (Access Method / Operating System / Disk Storage).  

2.       IMS DB Structure

a)       Hierarchical Structure - Segment (Student), Data Fields (Roll Number, Name, Course, Mobile Number).
b)      Segment Type - 255 different Segment types & 15 levels of hierarchy. Segment Occurrence. DL/I to manipulate IMS database. Call level interface (EXEC DL/I).

Aapplication Program à IMS Control Blocks à Call DL/I à Operating System access method (i.e. VSAM) -> Database

3.       IMS COBOL PGM Structure
IDENTIFICATION DIVISION
ENVIRONMENT DIVISION
DATA DIVISION à FILE SECTION, WORKING STORAGE SECTION (Function Codes / I/O Area / Segment Search Argument), LINKAGE SECTION (PCB Mask)
PROCEDURE DIVISION

4.       IMS DB - DL/I Terminology - Root Segment (Only One), Parent Segment, Dependent Segment, Child Segment, TWIN Segments, Sibling Segment, Database Record, Database Path.

5.       IMS DB - DL/I Processing - DL/I Call Sequential, Random Processing, Key Field, Search Field.


6.       IMS DB - Control Blocks
a)      Three Types - Database Descriptor (DBD), Program Specification Block (PSB), Access Control Block (ACB).
b)      Database Descriptor (DBD)1 for each database / DBDGEN (Database Descriptor Generator) - Assembly Language macro statements are used to create control blocks.  This control statement executes in JCL to create physical structure LIBRARY (root segment) & BOOKS as child segment.
c)       Program Specification Block(PSB) – 1 for each Program, application program can have diff views called application data structure defined in the PSB, one program use one PSB in single execution, multiple pgms can share PSB. PSB contains one PCB for each DL/I database the application program will access. If one pgm access 3 database than 3 PCB (Program Communication Block) in 1 PSB.
d)      SENSEG (Segment Level Sensitivity), Field Level Sensitivity.
e)       Access Control Block (ACB) - Combines the Database Descriptor and the Program Specification Block into an executable form. ACBGEN (Access Control Blocks Generator), generate ASB's, Online Pgm, need to prebuild ACB's for Batch can be at Pgm execution.

7.       IMS DB Programming
f)       JCL to run IMS DL/I batch module(DFSRRC00) - DL/I Module, PCB Mask, DLI/ Call Info, Input-Output Area.
g)      Application Pgm - Program Entry, Define PCB Area, Calls To DL/I, Check Status Codes, Termination. 
h)      Application pgm interfaces with IMS DL/I modules via following pgm elements. 
1)      An ENTRY statement specifies PCBs are utilized by pgm.
2)      PCB-mask co-relates with the information preserved in the pre-constructed PCB which receives return information from the IMS.
3)      Input-Output Area is used for passing data segments to and from the IMS database. 
4)      Calls to DL/I specify processing functions (fetch, insert, delete, replace, etc.). Check Status Codes to check the SQL return code of processing option to inform whether operation successful or not. Terminate statement end the processing application pgm includes the DL/I. 

8.       IMS DB - Cobol Basics   -
i)        DL/I calls inside COBOL pgm to communicate with IMS database - Entry Statement, Goback Statement, Call Statement.
j)       Entry Statement - Pass control from DL/I to COBOL pgm and vice versa. --> ENTRY 'DLITCBL' USING pcb-name1 [pcb-name2]. PCB definition inside the Linkage Section is called as PCB Mask. Relation between PCB masks and actual PCBs in storage is created by listing the PCBs in the entry statement. The sequence of listing in the entry statement should be same as they appear in the PSBGEN.
k)      GOBACK Statement - Returns the control to DL/I from the program.
l)        Call Statement - To request for DL/I services such as executing certain operations on the IMS database CALL 'CBLTDLI' USING DLI Function Code PCB Mask Segment I/O Area [Segment Search Arguments].
m)    DLI Function Code - Four-character fields that describe the I/O operation.
n)      PCB Mask – must be listed in ENTRY statement in same sequence as they appear in your pgm’s PSBGEN. PCB definition inside the Linkage Section, used in the entry statement.
o)      Segment I/O Area (Host Variable) - Name of an input/output work area, area of the application program into which the DL/I puts a requested segment (retrieved data) or from which it will get data for an update operation.
p)      Segment Search Arguments (Where condition, Segment name*Command Codes) - Optional parameters depending on the type of the call issued, to search data segments inside the IMS database. After each DL/I call, the DLI stores a status code. Single DL/I call have multiple SSAs (Unqualified / Qualified SSA)

9.       DL/I Function Codes4 Byte Code to tell DLI call pgm is making. what kind of which operation is going to be performed on the IMS database by the IMS DL/I call.
q)      Get Function – Get Unique (GU/GHU), Get Next (GN/GHN), Get Next Within Parent (GNP)
r)       Update Function – Insert(ISRT), Delete (DLET), Replace (REPL)
s)       Other Function – Checkpoint (CHKP), Restart (XRST), PCB (PCB)


10.   PCB MASKPCB (Programme communication block). For each database, the DL/I maintain an area of storage that is known as the program communication block. ENTRY statement creates a connection between PCB masks in the Linkage Section and the PCBs within the program’s PSB.
a)      PCB NAME, DBD NAME, Segment Level (never has a value greater than 15 because that is the maximum number of levels permitted in a DL/I database).
b)      Status Code - Two bytes of Character, Spaces – call successful, Non-Spaces – Unsuccessful, GB – end of file, GE – requested segment not found.
c)       PROC Options - Processing Option indicates what kind of processing the program is authorized to do on database.
d)      Reserved DL/I - Segment Name, Length FB Key, Number of Sensitivity Segments, Key Feedback Area

11.   IMS- SSA (Segment Search Arguments) - used to identify the segment occurrence being accessed, optional parameter.
e)       Two types – Unqualified SSA, Qualified SSA
f)       Unqualified SSA - Name of the segment being used inside the call.
g)      Qualified SSA - Provides the segment name with additional information that specifies signet occurrence to be processed.
h)      Command Codes - Reduce the number of DL/I calls, making the programs simple, used in both Qualified and Unqualified Call, specify asterisk in 9th position, command coded coded at 10th position, From 10th position onwards, DL/I considers all characters to be command codes until it encounters a space for an unqualified SSA and a left parenthesis for a qualified SSA – C (Concatenated Key), D (Path Call), F(First Occurrence), L(Last Occurrence), N(Path call ignore), P(Set Parentage)  etc. MUL-QUAL is a short term for Multiple Qualification in which we can provide boolean operators like AND or OR.
i)        Unqualified CALL doesn’t contain any SSA’s.
j)       Qualified CALL one or more SSA’s / GU call with single unqualified SSA’s.
k)      Message format Service (MFS) – MFSGEN

1.       IMS DB - Data Retrieval GU CALL, GN CALL, Using Command Codes, Multiple processing (Multiple PCB’s – define for single database), Multiple positioning – can maintain multiple positions in a database using a single PCB.

2.       IMS DB - Data ManipulationISRT Call, Get Hold Calls, REPL Call, DLET Call.


3.       IMS DB – Recovery - 
a)       Simple Approach - Periodical copies of imp datasets/ restoring backup copy in case dataset damaged.
b)      Abnormal Termination Routines - system interferes so that recovery can be done after the Abnormal END.
c)       DL/I Log - DL/I records all the changes made by an application program in a file which is known as the log file.
d)      Recovery – Forward and Backward – Forward and Backward recovery.
e)       Checkpoint - stage where the database changes done by the application program are considered complete and accurate, can be established using a checkpoint call (CHKP), causes a checkpoint record to be written on the DL/I log. CALL 'CBLTDLI' USING DLI-CHKP PCB-NAME CHECKPOINT-ID – Basic and Symbolic Check-pointing.

4.       IMS DB - Secondary Indexing - Used when we want to access a database without using the complete concatenated key, Index Pointer Segment (Prefix & Data Element), Secondary Keys, Secondary Data Structures, Independent AND Operator, Sparse Sequencing.
a)       DBDGEN – need to create two DBD’s using two DBDGEN’s for creating a relationship between an indexed database and a secondary indexed database.
b)      PSBGEN - Processing sequence for the database on the PROCSEQ parameter of the PSB macro.


5.       IMS DB - Logical Database - IMS database has a rule that each segment type can have only one parent. DL/I allow the DBA to implement logical relationships in which a segment can have both physical and logical parents. New data structure after implementing the logical relationship is known as the Logical Database, Logical Child Segment, Logical Twins.
Logical Relationship Types – Unidirectional, Bidirectional, Physical & Virtual.
Concatenated Segment - Logical child segment, Destination parent segment.

6.       IMS status Codes
a)       SPACES – Successful IMS call
b)      GB – End of DB
c)       GE – Requested segment not found
d)      II – End of DB reached without satisfying a GN call.
e)       GA, GK – Tried insert a segment that already exists on database.
f)       DA – REPL issued, Key field modified.
g)      DJ – DLET or REPL issued without successful ‘GET’ or ‘GET Hold’ commands. (Get – High level interface / Get Hold – call level interface).

7.       IMS Checkpoint Logic

To commit n(i.e. 1000) records in COBOL-IMS-DB2 program. In normal COBOL program we can COMMIT. In COBOL IMS DB2 program we require check point logic. DFRSCOO Utility to run IMS program, parameter DBR (Database recovery) = 4.
CBLDLI – XRST, If IO – AREA = ‘SPACE’, job running for first time. IO – AREA store file Key. CHKP (Check Point) – To commit 1000 records (frequency) – CBLDLI – CHKP IO-PCB IO-AREA.

8.       IMS Imp Points
-          STOP RUN not be used only GOBACK.
-          BMP (Batch Message Processing)
-          MPP (Message Processing Program)
-          CICS & Online IMS MPP does not allow COBOL definition of files, IMS allow only for Batch Programs.

9.       Introduction to DL/I database Organization
HS, HSAM, HISAM, SHSAM, SHISAM, HD, HDAM, HIDAM, GSAM, MSDB, DEDB.
10.   A -> B -> C (How to access with GNP Syntax).