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.

Key messages

The mainframe is alive and well as a platform for very large workloads.

Monday, August 29, 2011

Generation Data Groups (GDG)

GDG is a group of datasets that are related to each other chronologically or functionally.Each of the dataset is called a generation number.
The generation number distinguishes each generation from others.
In order to create a GDG the following things must be specified to the OS :
1)the name of the GDG
2)The number of the generations that are to be retained
3)Whether or not the oldest generation is to be uncataloged once the limit for the number of the generations that are to be retained is reached.
4)Whether or not all generations are to be uncataloged once the limit for the number of the generations that are to be retained is reached.
5)whether or not an entry for a dataset that is deleted from a GDG is to be uncataloged from the volume it resides on.

Following is the example of the JCL whcih creates a GDG Base.

After creating the base you have to add a Generation to it with the following JCL




You can also alter and delete the GDG parameters using the following control card.
//SYSIN DD *
ALTER ABCDE.USERID.GDG LIMIT(255)
/*
//SYSIN DD *
DELETE (ABCDE.USERID.GDG)GDG
/*

jcl_fun

JCL statements

JOB Statement
Sample Syntax:
//JOBNAME JOB (ACCOUNTING INFO), (PROGRAMMER NAME),
// TIME=(MINUTES,SECONDS), CLASS=A,MSGCLASS=A,PRTY=14,ADDR=VIRT,
// REGION=nK,MSGLEVEL=(A,B),COND=(N,OPERATOR), TYPRUN=SCAN

JOBNAME
It identifies name of the job. The job is identified in the JES SPOOL using this name. Naming rules are already mentioned in the coding sheet section.

ACCOUNTING INFO (Mandatory. Installation Dependant.)
1. Resource usage charges are charged to the account mentioned here.
2. If you don’t know your installation account, you cannot submit the job. It is like when you don’t have account, you cannot withdraw cash in bank.
3. Maximum 142 characters can be coded as accounting information.

PROGRAMMER NAME
Programmer name or program functionality or group can be mentioned. It is used for documentation (Max 20 chars)

CLASS (Installation Defined)
1. CLASS is coded with single alphanumeric character (A-Z, 0-9).
2. During installation, every CLASS and its properties are defined.
3. Definition describes the job characteristics like CPU time usage, number of tape/cart usage and other resource constraints.
4. Every class is assigned to one or more initiators. The jobs run in initiator address space. One initiator can process one job at one time.

PRTY
Syntax: PRTY=N (N can be 0 –15).
1. While selecting the jobs with same class for execution, JES schedules the high priority jobs first. The job coded with PRTY=15 has the highest priority and PRTY=0 has the lowest priority.
2. PRTY works within the JOBCLASS. If there are 2 jobs with CLASS A is submitted and one with PRTY 3 and other with PRTY 4 then PRTY 4 will get into execution queue first.
3. PRTY function is disabled in most of the installations.

MSGLEVEL
Syntax: MSGLEVEL=(X,Y) (X can be 0-2 & Y can be 0-1)
1. It is used to control the lists of information appear in the Job log. To get maximum information in the listing, code MSGLEVEL as MSGLEVEL(1,1)
2. The first parameter controls the statements. (0-Only job statement, 1-JCL, JES statements with expanded procedures, 2-Only JCL and JES statement).
3. The second parameter controls the messages. (0- Only Step execution messages, 1-All JCL, JES, operator and allocation messages).


MSGCLASS (Installation Defined)
Syntax: MSGCLASS=X (X can be A-Z, 0-9).
1. MSGCLASS is coded with single alphanumeric character (A-Z, 0-9).
2. Each MSGCLASS is mapped to a device or location, where the messages are routed.

ADDRSPC
It is used to specify whether the job will run in the Real storage or Virtual storage.
Syntax: ADDRSPC={REAL|VIRT}
REAL – Allocation is done in REAL storage and the program is not page-able.
VIRT – Allocation is done in VIRTUAL storage and the program is page-able.

REGION
Syntax: REGION={xK | yM} (x can be 1-2096128 & y can be 1-2047).
1. It is used to specify the amount of central /virtual storage the job requires.
It can be requested in the units of kilobytes (xK) or megabytes (yM). If requested in terms of kilobytes, then x should be multiple of 4 or the system will round it to nearest 4K allocates for your job.
2. REGION can be coded in EXEC statement also. REGION parameter coded on JOB card overrides the parameter coded on EXEC card.
3. Maximum virtual memory available is 2GB.
4. Region=0M allocate all the available memory in the address space to this job.
5. Region related ABENDS: When the requested region is not available, the JOB will ABEND with S822. When the requested region is not enough for the program to run, you will get ABEND S80A or S804.

RESTART
RESTART parameter allows restarting from any particular step in the job.
Syntax: RESTART = Step-name in the job
RESTART = * means restart from the beginning.
To restart from any procedure steps, code RESTART=PROCSTEP.STEPNAME
Whereas PROCSTEP=name of the JCL step that invoked the PROC &
STEPNAME=name of the proc step where you want execution to start.
RESTART ignores any condition in the step being restarted and it can also be step
that is in the ELSE part of the IF..ELSE..ENDIF.

TYPRUN
It is used to request special job processing.
1. TYPRUN=SCAN
checks the syntax errors without actual execution.
2. TYPRUN=HOLD checks the syntax error and if there is any error, it is notified and if there are no errors, the job is kept in awaiting execution queue and it should be released by user for execution. Release se can be done by typing ‘A’ against the job name in SDSF.
3. TYPRUN=JCLHOLD Function is same as HOLD but the syntax check starts only after the release of the job.


TIME
It defines the maximum allowable CPU time for the JOB. The parameter can be coded at EXEC card also. On EXEC, it defines CPU limit of step.

Syntax: TIME = (MINUTES, SECONDS), MINUTES <= 1440 and SECONDS < 60
TIME=NOLIMIT/1440/MAXIMUM means the job can use CPU for unlimited time
TIME=0 will produce unpredictable results.
If TIME is coded on both JOB as well as EXEC, then EXEC Time limit or the time left out in the job Time limit – whichever is smaller will be the time permitted for the step to complete.
If a JOB runs more than allowed time, then it will ABEND with system ABEND code S322. If there is no TIME parameter, then the CPU time limit pre-defined with CLASS Parameter will be effective.

NOTIFY
TSO User-id to whom the job END / ABEND / ERROR status should be notified. NOTIFY=&SYSUID will send the notification to the user who submitted the job.

COND
1. It is used for conditional execution of JOB based on return code of JOB steps.
2. The return code of every step is checked against the condition coded on JOB card. If the condition is found TRUE, then all the steps following it are bypassed.
3. Maximum eight conditions can be coded in the COND parameter. In case of multiple conditions, if ANY of the condition is found TRUE then the JOB stops proceeding further.
Syntax: COND=(CODE,OPERATOR,STEPNAME)
STEPNAME is optional. If you code it, then that particular step-name return code is checked against the CODE with the OPERATOR. If omitted, then the return codes of all the steps are checked. On comparison, if the condition found to be true, then all the following steps are bypassed.
CODE can be 0-4095
OPERATOR can be GT, LT, GE, LE, EQ
It can be coded on EXEC statement. STEP level control is popular then JOB level control. On EXEC statement, you may find ONLY, EVEN keywords against COND parameter.
COND=ONLY allows the step execution only if any prior step is ABENDED.
COND=EVEN allows the step execution independent of any prior ABENDS.

Consider the COND parameter coded on EXEC statement,
Ex: //STEP2 EXEC PGM=PGM3,COND=((16,GE),(90,LE,STEP1),ONLY)
Step gets executed only if
A preceding step abnormally terminated OR
The return codes from all preceding steps are 17 or greater OR
The return code from STEP1 is 89 or less.

EXEC Statement
It defines the Step and Step level information to the system.
Syntax: //STEPNAME EXEC {PGM=program-name |
PROC=proc-name |
proc-name}

STEPNAME
It is an OPTIONAL field but it is needed if you want to restart a job from this step and for the same reason, it should be unique within the job.

PGM or PROC
Code the Program name or PROC name to be executed. (1-8 characters)

PARM
1. It is used to pass variable information to the processing program, executed by this job step.
2. If there is more than one sub parameter or if there is any special character then enclose them in parentheses/quotes.
3. Maximum 100 characters can be passed in this way. Quotes and brackets are not included in this 100.To pass a quote to the program, indicate that with two quotes one followed by other.
4. The program can receive them using linkage section. Linkage section must be coded with half word binary field as first field. This field is populated with length of the PARM passed from the JCL.
Example:
//STEP3 EXEC PGM=WORK,PARM=(DECK,LIST,'LINECNT=80',
// '12+80',NOMAP)
5. To continue the PARM in the second line, start the second line from 16th position.

DPRTY
PRTY assigns priority to a job and DPRTY assigns dispatching priority to job step. Syntax: DPRTY=(value1, value2). Value1 and value2 can be 0-15. D-Priority is calculated using the formula (value1*16 + value)

IF /THEN/ELSE/END-IF
It is used for conditionally executing one or more steps. Nesting is possible up to 15 levels. The meaning is same as programming IF. If the coded condition is true, the following steps till ELSE will be executed. If the condition is false, then the steps coded on ELSE part will be executed.
Syntax:
//name IF (relational operation) THEN
//…Steps..
// ELSE
//…Steps..
// ENDIF.

PROC PEND INCLUDE ‘/*’ ‘// ‘ ‘//*’ are executed irrespective of their place.
Don’t specify JOBLIB, JCLLIB, JOBCAT, STEPCAT, JOB, SYSCHK within the THEN or ELSE Scope of IF statement.
Relational condition can be also coded as follows:
STEPNAME.ABEND=TRUE, STEPNAME.RUN=TRUE, STEPNAME NOT RUN
STEPNAME.ABENDCC = any-abend-code

jcl_fun

JCL (Job Control Language)

JCL (Job Control Language) is used to DEFINE and CONTROL the JOB to the operating system.

Definition involves definition of the programs need to be executed, the data for the programs and the sequence of programs. CONTROL involves controlling the execution or bypassing of a program in the sequence based on the result of the prior program execution.

JCL statements should have // in column 1 and 2. STAR (‘*‘) in the third column, indicates that the line is a comment line.

Typical OPERATION keywords in JCL are JOB, EXEC and DD.

JCL Statements


JOB. It should be the first statement in the JCL. It indicates accounting information and JOB related information to the system. If the member being submitted contains multiple job cards, then multiple jobs will be submitted. These jobs will run concurrently or one after other based on job name, class and initiator availability.

EXEC. The name of the program or procedure to be executed is coded here. Every EXEC statement in a JOB identifies one step. Maximum of 255 EXEC statements can be coded in a JOB.

DD. Data Descriptor. The dataset details are coded here. Dataset contains the data that need to be processed by the program or data that is produced by the program. Maximum 3273 DD statements can be coded in a step.

Sample JCL

//DEMOJB JOB (ACCOUNTING INFO,,,),
// 'SAMPLEJCL %USERT%',
// CLASS=B,
// MSGCLASS=X,
// REGION=5M,
// NOTIFY=&SYSUID,
// USER=&SYSUID
//STEP1 EXEC IGYWCL,
//PARM.COBOL='LIB,APOST,XREF,MAP,OFFSET'
//COBOL.SYSIN DD DISP=SHR,DSN=ABC.XYZ.COBPRG(FILE004)
//LKED.SYSLMOD DD DISP=SHR,DSN=ABC.XYZ.LOADLIB(FILE004)
//SYSPRINT DD SYSOUT=*


This sample jcl can be used to compile a cobol progam .Here we are compiling progam FILE004 and load would generate in DSN=ABC.XYZ.LOADLIB(FILE004).
IGYWCL utility is used to compile this progam in Step1.
You can check the output of the job in System spool by typing SDSF(system display and spool facility) in TSO/ISPF.
In SDSF you will see the following options
JESMSGLG (JES Message Log)
JESJCL (JES JCL)
JESYSMSG (JES system Message)
SYSPRINT (System Print)

From these 4 options you can have complete information about the job.

jcl_fun

how we use CONDITION name/flag or use 88 level variable in cobol?


CONDITION name is identified with special level ‘88’. A condition name specifies the value that a field can contain and used as abbreviation in condition checking.
01 SEX PIC X.
88 MALE VALUE ‘1’
88 FEMALE VALUE ‘2’ ‘3’.
IF SEX=1 can also be verified as IF MALE in Procedure division.
‘SET FEMALE TO TRUE ‘ moves value 2 to SEX. If multiple values are coded on VALUE clause, the first value will be moved when it is set to true.

whats is RENAMES in cobol and how we use 66 level variabes??


It is used for regrouping of elementary data items in a record. It should be declared at 66 level. It need not immediately follows the data item, which is being renamed. But all RENAMES entries associated with one logical record must immediately follow that record's last data description entry. RENAMES cannot be done for a 01, 77, 88 or another 66 entry. It cannot be done for occurrences of an array.
01 WS-REPSONSE.
05 WS-CHAR143 PIC X(03).
05 WS-CHAR4 PIC X(04).
66 ADD-REPSONSE RENAMES WS-CHAR143.

cob_ques cob_fun

How and why we use REDEFINES in cobol ?


The REDEFINES clause allows you to use different data description entries to describe the same computer storage area. Redefining declaration should immediately follow the redefined item and should be done at the same level. Multiple redefinitions are possible. Size of redefined and redefining need not be the same. It cannot be done at 66 and 88 levels.

Example:

01 WS-DATE PIC 9(06).
01 WS-REDEF-DATE REDEFINES WS-DATE.
05 WS-YEAR PIC 9(02).
05 WS-MON PIC 9(02).
05 WS-DAY PIC 9(02).

cob_fun cob_ques

SYNC Clause and Slack Bytes ??


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 faster address resolution. SYNC clause does this but it may introduce slack bytes (unused bytes) before the binary item.

Consider the following declaration in the WORKING-STORAGE SECTION:
01 WS-MY-DATA.
05 WS-DATA-ONE PIC X(6).
05 WS-DATA-TWO PIC 9(6) COMP SYNC.
05 WS-DATA-THREE PIC S9(4)V99 COMP-3.

The Starting address of Full-word should end with 0,4,8 or C and that of half-word should end with 0,2,4,6,8,A,C,E. If DATA-ONE starts at 0, it will occupy 0-5 bytes in memory. DATA-TWO - a sync item of full word cannot start at 6. So by SYNC rule, it starts at 8th position. 6th & 7th bytes are unused. So MY-DATA occupies 16 bytes.

cob_fun cob_ques

Usage Clause in cobol or How cobol store data ?


DISPLAY Default. Number of bytes required equals to the size of the data item.If we don't mention anything then default Usage is Display.for eg

01 WS-VAR PIC X(10)

then by default it will take usage as Display and occupy 10 bytes in memory


*COMP/COMP3/COMP1/COMP2/COMP4/COMP5/BINARY :-All are called computational variables and only used with decimal datatypes only.

COMP Binary representation of data item.
PIC clause can contain S and 9 only.
S9(01) – S9(04) Half word.(2 byte/16bits)
S9(05) – S9(09) Full word.(4 byte/32bits)
S9(10) - S9(18) Double word.(8byte/64 bits)
Most significant bit is ON if the number is negative.


COMP-1: Single word floating point item. PIC Clause should not be specified.
The sign is contained in the first bit of the of the leftmost byte and the
exponent is contained in the remaining 7 bits of the first byte. The last
3 bytes contain the mantissa.

COMP-2: Double word floating-point item. PIC Clause should not be specified.
7 bytes are used for mantissa and hence used for high precision
calculation.


COMP-3: Packed Decimal representation. One digit takes half byte(Nible/4 bits).
PIC 9 (N) comp-3 data item would require (N + 1)/2 bytes. The sign is stored separately in the rightmost half-byte regardless of whether S is specified in the PICTURE or not.
C – Signed Positive D – Signed Negative F-Unsigned Positive.

comp 3 is most efficiently used when size is defined as a odd number.for eg

01 WS-NUM PIC S9(5) COMP-3.
It will take 3 bytes (half byte for sign)


INDEX It is used for preserve the index value of an array. It takes 4 bytes.
PIC Clause should not be specified. When the clause is specified for a group item, it applies to all elementary items contained in it. However, the group itself is not an index data item.


POINTER
4 Byte elementary item that can be used to accomplish limited base

addressing. It can be used only in – SET statement, Relation condition,
USING phrase of a CALL statement, an ENTRY statement or the
procedure division statement. A value clause for a pointer data item
can contain only NULL or NULLS.

SET identifier-1 TO address of identifier-2
SET ADDRESS OF identifier-2 TO identifier-1.

Identifier-1 is POINTER data item and identifier-2 is linkage section item.

cob_ques cob_fun

Basic Data Types in COBOL

There are five basic data types in COBOL. They are
1. Alphabetic (Made up of only upper and lower case letters),
eg

01 WS-NAME PIC A(10).

2. Numeric (Made up of the digits 0, 1, 2, . . . ,9)

01 WS_ACC_NO PIC 9(6).

3. Alphanumeric data (Made of both letters and digits),

01 WS_ADDRESS PIC X(30).

4. Edited Numeric (Made up of digits and special characters) and
The edited numeric format is typically used to prepare or convert numeric data that is stored in a variety of formats into a format that is easily read by human beings or easily exported to a non-Mainframe or non-COBOL environment such as an excel spreadsheet running on a Windows platform.for eg

WORKING-STORAGE SECTION.
01 BINARY-FIELD PIC S9(5)V(2) USAGE IS COMP.
01 EDIT-DROP-LEAD-ZEROES PIC ZZ,ZZZ.99-.

PROCEDURE DIVISION.
move BINARY-FIELD to EDIT-DROP-LEAD-ZEROES

5. Edited Alphanumeric (Made up of letters, digits and special characters).




cob_fun

Data Division of the cobol progam.

Data division is used to define the data that need to be accessed by the program.
It has three sections.
FILE SECTION describes the record structure of the files.
WORKING-STORAGE SECTION is used to for define intermediate variables.
LINKAGE SECTION is used to access the external data.
Ex: Data passed from other programs or from PARM of JCL.

cob_fun

Friday, August 26, 2011

How we pass data to cobol program using parm in jcl?


JCL can send maximum 100 characters to a program thru PARM. Linkage section MUST be coded with a half word binary field, prior to actual field. If length field is not coded, the first two bytes of the field coded in the linkage section will be filled with length and so there will be last 2 bytes data truncation in the actual field.
LINKAGE SECTION
01 LK-DATA.
05 LK-LENGTH PIC S9(04) COMP.
05 LK-VARIABLE PIC X(08).


cob_ques

Thursday, August 25, 2011

Identification Division.

Identification Division.
This is the first division and the program is identified here. Paragraph PROGRAM-ID followed by user-defined name is mandatory. Though 30 characters can be entered for the program ID, compiler will consider only the first EIGHT characters and the remaining characters will be ignored. All other paragraphs are optional and used for documentation.

IDENTIFICATION DIVISION.
PROGRAM-ID. PROGRAM NAME.
AUTHOR. COMMENT ENTRY.
INSTALLATION. COMMENT ENTRY.
DATE-WRITTEN. COMMENT ENTRY.
DATE-COMPILED. COMMENT ENTRY.
SECURITY. COMMENT ENTRY.

Security does not pertain to the operating system security, but the information that is passed to the user of the program about the security features of the program. cob_fun

Divison of Cobol Progam

There are four divisions in a COBOL program and the data division is an optional one.
1.Identification Division.
2.Environment Division.
3.Data Division.
4.Procedure Division.
cob_fun