Thursday 2 May 2019

How to check the limit of GDG file

Goto 3.4 and type in the GDG name. Press Enter.
Then where u give B for Browse , E for Edit

type in LISTCAT ENT(/) ALL and press ENTER.

Or

The ISPF Dataset Utility (=3.2) can generate the LISTCAT command for you and then execute it.

Take option 3.2
Enter the name of the GDG base and take option V (VSAM Utilities).
Under "Process Request" take option 3. Under "Data Type" you can leave it blank or take option 4 and hit enter.
On the next screen make sure there is a (/) slash next to "Edit IDCAMS command". Under "Name, History, Volume, ALLOcation, All" put ALL and hit enter.
This will generate a LISTCAT command essentially the same as used above:
/* IDCAMS COMMAND */
LISTCAT ENTRIES(ZZJR001.TEMP.GDG) -
GENERATIONDATAGROUP -


Then enter the EXEC command to execute it.

Or

Go to command prompt and type 
TSO LISTC ENT('GDG-BASE-NAME') ALL

Alter GDG file

The maximum limit of a GDG file is 255 generations.

Say, you have created a GDG base with the limit of 50 generations and later you want to increase its limit to maximum (255 generations), then you need to Alter GDG base like below.

//STEP01 EXEC PGM=IDCAMS      
//SYSPRINT DD SYSOUT=*        
//SYSIN    DD *               
  ALTER GDG.BASE.NAME LIMIT(255)
/*

Once the above job is successful, the limit of GDG file GDG.BASE.NAME will be increased from 50 to 255.

Friday 15 February 2019

Removing duplicates from VB file


Consider I have a VB file of length 321 bytes (4 for RDW + 317 actual length) and wanted to remove duplicate records from a file.

Here is the sample JCL: 

//REMODUPL   EXEC PGM=SORT                                     
//SORTIN   DD DSN=INPFILE1,DISP=SHR                 
//SYSIN    DD *                                                
  OPTION VLSHRT                                                
  SORT FIELDS=(5,317,CH,A)                                     
  SUM FIELDS=NONE                                              
/*                                                             
//SORTOUT  DD DSN=OUTFILE1,DISP=(NEW,CATLG,DELETE),           
//         RECFM=VB,LRECL=321,AVGREC=K
//SYSOUT   DD SYSOUT=* 

VLSHRT tells DFSORT to temporarily replace any missing control field bytes with binary zeros.

For eg.       

As you are aware that VB file will have records of different lengths and the maximum length of the record in the VB file will be treated as LRECL of that VB file.

During the sort say i have two records one with length 300 and another with 317, then the record with 300 bytes will be temporarily replaced with extra 17 binary zeros (300+17 binary zeros) to run the sort smoothly.  These binary zeros are temporary and will NOT be copied to output dataset. 

The default OPTION is NOVLSHRT (reverse of VLSHRT) which terminates the sort if it finds shorter record than the one specified in SORT FIELDS.          

Sunday 13 January 2019

SDSF

SDSF means System Display and Search Facility

It is a utility that allows user to monitor, control or view the output of jobs in the system.

It is a component of IBM's mainframe operating system, z/OS.

Once the job is submitted, it is common to use SDSF to check the status of the job like completed/running/failed...

To start using SDSF, 

type SDSF;ST or S;ST on the start window/command line

ST :Displays current status of all the jobs

Following are the most commonly used SDSF options:

DA : Displays Active/currently running jobs

I : Input Queue - Shows jobs waiting for execution 

H : Jobs on HOLD - either waiting to be released into input or output.

PR : Displays printers

INIT : Displays initiators (areas where jobs execute or run)

On the ST panel, SDSF supports following options for each batch Job. The user should type the desired option against the job and press enter to see the result

C : Cancel the job

S : Select the job (view only)

SJ : Show Job (View the original JCL of the job) - In this mode, you can edit the JCL as you required and SUBmit it in case of failures.

P : Purge job (Remove the job)

SE : Select Edit job (view in edit mode) 

XDC : Writes the spool content of the job into a data set. The data set name should be provided in the dialog window that gets popped up after pressing enter.

Following operations can be performed on SDSF panel. The desired command should be provided in "COMMAND INPUT" and press enter 

OWNER * - Displays all the jobs submitted by the owner if any.

OWNER ABC* - Filter jobs with owner name starting with ABC

PRE XYZ* - Filter jobs starting with XYZ.
PRE represents PREFIX

PRE AB%%PQ - Filter jobs starting with AB and ends with PQ

WHO - Provides basic information about SDSF user

SET CONFIRMATION ON/OFF - This command will enable/disable the confirmation for any action like P(Purge), C(Cancel)….

In SDSF, we can purge multiple jobs at a time using Block //. The jobs to purge should be in sequence to perform the same.
How - Say I have jobs JOB1, JOB2, JOB3, JOB4, JOB5 in SDSF. To purge JOB3, JOB4 and JOB5 at a time, Type //p against JOB3 and // against JOB5 and press enter.


Friday 4 January 2019

IEBEDIT(Edit Job stream) Utility:

1. It is used to run selected job step(s) in particular JCL.

Ex. I have a JCL with 10 steps and wanted to run only STEP10, 


//IEBEDITX JOB (MVSQuest),'IEBEDIT TEST',
//            CLASS=N,MSGCLASS=H,NOTIFY=7SYSUID
//*
//SUBMIT   EXEC PGM=IEBEDIT
//SYSUT1   DD DSN=USERID.TEST.JCL(JCLINP),DISP=SHR
//SYSUT2   DD SYSOUT=(*,INTRDR)
//SYSPRINT DD SYSOUT=*
//SYSIN    DD *
 EDIT START=JOBA,TYPE=INCLUDE,STEPNAME=(STEP10)
//*

JCLINP contains 10 steps

START => specifies job name of JCLINP

TYPE=INCLUDE => runs only those steps specified in STEPNAME

If TYPE=EXCLUDE, it runs all the steps except for the one specified in STEPNAME

If i want to run step09 and step10, then

EDIT START=JOBA,TYPE=INCLUDE,STEPNAME=(STEP09,STEP10)

2. Copies the complete job including all its steps to the output data set
    
    EDIT START=JOBA

3. Copies different steps from different jobs to output data set
    
    Example: If i have 3 jobs (JOBA, JOBB,JOBC)  in input dataset and wanted to copy different steps from all the 3 jobs

EDIT START=JOBA,TYPE=INCLUDE,STEPNAME=(STEPC,STEPD)
EDIT START=JOBB,TYPE=INCLUDE,STEPNAME=STEPE
EDIT START=JOBC,TYPE=INCLUDE,STEPNAME=STEPJ   

Points to remember:


Instream procedure should be defined before EXEC statement.

Example:

//INSTPROC  PROC
//    statements
//    ----
//    ----
//          PEND
//STEP01 EXEC PGM=pgm1
//FILE1  DD DSN=file-name
//STEP02 DD INSTPROC
//STEP03 DD INSTPROC

Cataloged Procedure:

Cataloged procedures will be stored in separate PDS. This PDS name should be specified in JCLLIB ORDER. If the procedure is not found in the specified library, then SYS1.PROCLIB will be checked.

We can add/modify the parmeters in steps of Cataloged procedure without even changing it. 

Ex. I have a cataloged proc name MYPROC and wanted to add Region parameter to STEP02 in that
proc, i can code like below in corresponding JCL

//MYSTEP EXEC MYPROC, REGION.STEP10=56K

To apply region parameter for all the steps in MYPROC

//MYSTEP EXEC MYPROC, REGION=56K

To nullify a parameter of a particular step in MYPROC, override the same through JCL and just don't give any value like below

//MYSTEP EXEC MYPROC, TIME.STEP10=

- The DSN and UNIT parameters must be coded for new generation data sets.





Thursday 3 January 2019

VSAM Intro

VSAM - Virtual Storage Access Method

A VSAM cluster is a logical definition for a VSAM data set and has one or two components. viz.,
Index component - Contains pointers to all data records to access them
Data component - Contains actual records


VSAM commands:

All the following operations (including CREATE and DELETE) should be done through IDCAMS utility.

ALTER - To modify the attributes of VSAM file.
REPRO - To load the data into VSAM data set (from sequential file to VSAM file), to copy the data from one VSAM file to another VSAM file.
LISTCAT - To get the catalog information of a VSAM dataset like dataset attributes, allocation information, volume information...  
EXAMINE - Checks the structural integrity of a given KSDS cluster. It checks index and data components and reports if there are any issues.
VERIFY - Checks and fix VSAM files which are not closed properly after an error

An Alternate Index provides access to records using more than one key. The key of an alternate Index can be a unique/non-unique key. We define alternate index for a given VSAM cluster.