ISPF Editor Commands

 Interactive System Productivity Facility (ISPF) is a screen editor that runs on IBM mainframes.The editor screen contains a command line where commands are issued.

The following are some basic Line commands in ISPF Editor:-

Line Commands


    • I                Insert a new line
    • In              Insert n number of new lines
    • R               Repeat this line
    • RR             Repeat block of lines
    • Rn             Repeat next n lines
    • D              Delete this line
    • DD            Delete a block of lines
    • Dn             Delete the next n lines
    • C               Copy this line
    • CC             Copy a block of lines
    • M              Move this line
    • MM           Move a block of lines
    • A              Place move/copy after this line
    • B              Place move/copy before this line
    • O              Overlay this line with moved/copied Lines
    • )n             Shift data to the right n spaces
    • ))n            Shift block of lines to the right
    • (n             Shift data to the left n spaces
    • ((n            Shift block of lines to the left
    • X               Exclude this line from display
    • XX            Exclude block of lines from display
    • COL          Display column ruler
    • MD           Changes message line to data line
    • TS            Test split
    • TFnn         Text flow to column nn


    Command Line Commands:-


    • Find "string"  - Find a string
    • CHANGE str1 str2 - Changes a string from one value to another
    • CUT - Cuts the lines to clipboard
    • CUT abc - Cuts the lines to clipboard name abc, you can specify your own clipboard
    • PASTE - Paste the line at destination
    • LOCATE linenum - Locate a line number
    • HEX ON/OFF - Toggles Hexadecimal display




Difference between Static and Dynamic Call in IBM Mainframes


Static Call                                                                     Dynamic Call

1. Call to the sub program is                         1. Call to the subprogram is                                  
    done at the time of compilation                   done at the time of execution
2.  It uses more CPU time                            2. It uses less CPU time
3. Requires more memory                            3. Requires less memory
4. Submodules are link edited with the        4. If the sub program undergoes
    main module, if the subprogram                  any changes it is sufficient to 
    undergoes anychanges both the                   recompile the sub program 
    main and sub program                                 alone
    needs to be re-compiled
5. Static Call improves performance            5. Dynamic Call degrades performance           
    of the module                                                of the module
6. If the modules is being called                 6. If the module is called dynamically it will be 
    statically  it will be seen in the                 seen in the main module
     load module
7. The program is compiled with                   7. The program is compiled with 
    NODYNAM option                                       DYNAM option

Generation Data Group in Mainframe Environment

What is GENERATION DATA GROUP  (GDG)?

Generation Data Group is a method used on the mainframe to allow a group of related files to be created which can be referenced individually or as a group. It is group of datasets that are related to each other chronologically or functionally
1) Adding a new generation.
2) Retaining the previous generation.
3) Discarding the oldest generation
Using GDG, JCL can remain unchanged while the data set names change with every execution.

How to Create GDG?
//GDG01 EXEC PGM=IEFBR14
//GDG DD DSN=MVS.SAMPLEGDG.BASE(+1),DISP=(NEW,CATLG)
//SPACE=(TRK,(....)),VOL=SER=....,
//UNIT=SYSDA,DCB= MVS.SMPLMODEL

How to Allocate GDG?
DEFGDG EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=A
//SYSIN DD *
DEFINE GDG -
(NAME(MVS.SAMPLEGDG.BASE)-
SCRATCH
NOEMPTY
LIMIT(10))
/*


How to Delete a GDG Entry?
//INFENR EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
DELETE MVS.SAMPLEGDG.BASE PURGE FORCE
/*

How to Create a VSAM file in Mainframe environment

In this blogpost I am going to explain about
1> How to Create VSAM file using IDCAMS Utility
2> How to load the flat file to VSAM file.


The following is a sample of the mainframe JCL needed to run on an IBM mainframe as an MVS batch job.
The Source code below works for how to create VSAM file and how to load it.


The JOB and DD statements will require modification prior to execution in different mainframe environments. Replace XXXX with your mainframe user id and give the correct program name.


//XXXX JOB (CS),'AIX  ',CLASS=A,MSGCLASS=X,MSGLEVEL=(1,1),
//          NOTIFY=XXXX
//
//STEP001  EXEC PGM=IDCAMS,COND=(0,NE)
//SYSPRINT DD SYSOUT=*
//SYSIN    DD *
         DEF CL (NAME(XXXX.K030.YYYY) -
                 VOL(TST232)            -
                 UNIQUE                 -
                 KEYS(21 1)   -
                 RECORDS(100  100)-
                 SHR(2 3)        -
                 FREESPACE(2 1)     -
                 RECSZ(50 50)         -
                 INDEXED                -
                 CISZ(4096)) -
       DATA                             -
           (NAME(XXXX.K030.YYYY.DATA)-
                 KEYS (21 1)            -
                 RECSZ(50 50)         -
                 CISZ(7096)) -
       INDEX                            -
           (NAME(XXXX.K030.YYYY.INDEX))
         IF LASTCC = 0 THEN             -
         REPRO IDS(XXXX.F030.YYYY)   -
               ODS(XXXX.K030.YYYY)
         IF LASTCC = 0 THEN              -
           DEF AIX (NAME(XXXX.K999.YYYY.ALTX)-
               REL(XXXX.K030.YYYY)-
               KEYS(47 2) -
               RECSZ(100 100)           -
               SHR(2 3))                -
            DATA                        -
                 (NAME(XXXX.K999.YYYY.ALTX.DATA) -
               CYL(1   1)         -
               CISZ(4096)               -
               RECSZ(50 50))
         IF LASTCC = 0 THEN             -
           DEF PATH(NAME(XXXX.K999.YYYY.ALTX.PATH)-
               PENT(XXXX.K030.YYYY.ALTX))
         IF LASTCC = 0 THEN               -
           BIX IDS(XXXX.K030.YYYY)-
               ODS(XXXX.K999.YYYY.ALTX)
//*
/*
//STEP002  EXEC PGM=IDCAMS
//INFILE    DD DSN=XXXX.K030.YYYY,DISP=SHR
//OUFILE    DD DSN=XXXX.F030.YYYY,DISP=OLD
//SYSPRINT  DD SYSOUT=*
//SYSIN     DD *
  REPRO INFILE(INFILE) OUTFILE(OUFILE) COUNT(10)
/*
//

VSAM Basic Concepts

What is VSAM?
VSAM (Virtual Storage Access Method) is a data access method used with IBM Mainframe running in MVS operating System. VSAM provides data security and data integrity. Whenever we require fast access to data set, VSAM is needed

What are Control Interval and Control Area?
They are VSAM Dataset Storage Formats. The records in a VSAM Dataset are stored in the form of Control Intervals. A Control Interval is similar to a block in that it contains several records, but it contains free space as well. When you create a dataset you can specify free space in two ways, as a percentage of each control interval to leave free and as a percentage of the total control intervals to leave free.
Set of control Intervals is known as Control Area.

What are the types of VSAM Data Set?
1) KSDS (KEY-SEQUENCED DATASET) – Each Record in a KSDS data file is embedded with a unique key
2) ESDS (ENTRY-SEQUENCED DATASET) – The records are accessed in the order they were written to the file i.e. based on their sequential order
3) RRDS (RELATIVE RECORD DATA SET) – Records are in relative to the relative record number
4) LDS (LINEAR DATA SET) – LDS contains data that can be accessed as byte addressable strings in virtual storage. LINEAR DATA SET is one big data object, which do not have Control Information

What are the benefits of VSAM?
1)      VSAM is quick and efficient in retrieving data
2)      Records are accessed via a key, relative address or sequentially
3)      By the use of embedded free space insertions of records is made easier
4)      Deleting the records physically is easier
5)      They are portable across systems
6)      Data Security is enforceable at different levels.

What are the drawbacks of VSAM?
1)      User must control the integrity of VSAM datasets in a cross system
2)      The biggest disadvantage of VSAM is the use of free space

What are some common VSAM error conditions and code?

1)     End of file (10)
2)     Duplicate key (22)
3)     Record not found  (23)
4)     VSAM logic error (90)
5)     Open Problem (92)
6)     Space Problem (93)

JCL Sorting Program – IBM Mainframe


In this blog post I am going to present a simple sort program in JCL in IBM Mainframe. This is batch program in JCL.Your JCL would look like this for SORT.


//*---------------------------------------------------------------------
//* STEP1  : This program is for Sorting, Replace XXXX with the mainframe     
//*          user id and AAAA with the program name
//*---------------------------------------------------------------------
//XXXX JOB (YY),'SORT',CLASS=F,MSGCLASS=N,MSGLEVEL=(1,1),         
//      NOTIFY=XXXX
//*---------------------------------------------------------------------
//* STEP2  : SORT  AAAA  TO AAAA.SORTOUT
//*---------------------------------------------------------------------
//STEP2    EXEC SORT,COND=(0,NE)                                    
//SORTIN   DD DSN=XXXX.AAAA.YYYY,DISP=SHR
//SORTOUT  DD  DSN=XXXX.AAAA.YYYY.SORTOUT,DISP=(NEW,CATLG),
//         DCB=(RECFM=FB,LRECL=800,BLKSIZE=0),
//         SPACE=(TRK,3)
//SYSIN    DD *
       SORT FIELDS=(1,21,A,47,2,D),FORMAT=CH
       INCLUDE COND=(12,8,CH,EQ,C'20090210')        
                  
  END
/*




The explanation of the above program is as follows:-

1>The first statement is the job statement which identifies the beginning of  job with positional and keyword parameters.

Positional Parameter are components that are needed to code the job statement that apply to the entire job. 
They are Job Accounting information( YY in our example) and  Programmer name(SORT here).

Keyword parameter also applies for the entire job, We have used CLASS(F), MSGCLASS(N),   MSGLEVEL(1,1) and NOTIFY(XXXX) Parameters in our Sort Example.


2> The second step in the procedure is the EXEC statement named STEP2, which identifies the program SORT as the program to be run.

3> The SORTIN DD statement identifies the input data set containing data to be sorted         (XXXX.AAAA.YYYY)                   

4> The SORTOUT DD statement identifies the output data set where SORT is to place the sorted input (XXXX.AAAA.YYYY.SORTOUT)                   

5> The SYSIN DD statement provides instream instructions for the SORT program to use on the input data set