Monday, September 12, 2011

IDCAMS - Repro Command

Copying A Data Set:

Note :
The CFILE utility, which was used to copy sequential and ISAM data sets, is not supported. Neither are ISAM data sets. All users with ISAM data sets should convert them to VSAM.

This article describes how to use IDCAMS/REPRO to copy a data set. It is intended as a replacement for CFILE and is not intended as complete documentation on VSAM data sets or the IDCAMS utility.

IDCAMS is an IBM utility that allows you to create and manipulate VSAM data sets. It has several commands. You can use the REPRO command of IDCAMS to copy VSAM and non-VSAM data sets, VSAM clusters, and alternate indexes.

You cannot use REPRO to copy an entire partitioned data set (PDS) because REPRO does not copy the information in the directories. You can, however, use REPRO to copy individual members.

The IBM IEBCOPY utility should be used to copy an entire PDS.

The REPRO Command
The general form of the REPRO command is as follows:

REPRO parameter parameter -
parameter -
parameter

Parameters may be separated by either commas or blanks. You can continue the REPRO statement by coding a hyphen (-) as the last character of a line. The command and parameters may be typed anywhere betweeen columns 2-72.

JCL for Using IDCAMS and REPRO
The below example shows the JCL for a basic job setup to access IDCAMS. The INFILE parameter names the DD statement for the data set that is to be copied. The OUTFILE parameter names the DD statement describing the output or target data set. You would replace "indd" and "outdd" with DD names of your own choosing.

JCL to Use IDCAMS and the REPRO Command
//COPY JOB ,'your name',CLASS=class,TIME=(mm,ss),LINES=lines
/*ROUTE PRINT node.location
// EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=A
//indd DD DSN= ... (describes the input data set)
//outdd DD DSN= ... (describes the output data set)
//SYSIN DD *
REPRO -
INFILE(indd) -
OUTFILE(outdd)
/*

Using REPRO to Copy a VSAM Data Set to A Sequential Data Set
//COPY JOB ,'your name',CLASS=class,TIME=(mm,ss),LINES=lines
/*ROUTE PRINT node.location
// EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=A
//VSAM DD DSN=UF.userid.VSAM.DATASET,DISP=OLD
//SEQ DD DSN=UF.userid.SEQ.BACKUP,UNIT=SYSDA,
// SPACE=(TRK,(10,10)),
// DISP=(NEW,CATLG),
// DCB=(LRECL=104,BLKSIZE=1004,RECFM=VB)
//SYSIN DD *
REPRO -
INFILE(VSAM) -
OUTFILE(SEQ)
/*

REPRO Examples
The below example shows how to use REPRO to copy a VSAM data set to a sequential data set. You could use this to make a sequential backup copy of your VSAM data set. In this example, assume that your VSAM data set has variable-length records. The maximum record size is 100 bytes and you have embedded keys. When you specify your LRECL and BLKSIZE for your output data set, make sure they are at least 4 bytes longer than the longest record in your VSAM data set.

Using REPRO to Backup a VSAM Data Set
//COPY JOB ,'your name',CLASS=class,TIME=(mm,ss),LINES=lines
/*ROUTE PRINT node.location
// EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=A
//OLD DD DSN=UF.userid.VSAM.DATASET,DISP=OLD
//NEW DD DSN=UF.userid.VSAM.BACKUP,DISP=OLD
//SYSIN DD *
REPRO -
INFILE(OLD) -
OUTFILE(NEW)
/*
This example assumes that you have already created the backup data set (using IDCAMS). The OLD DD name defines your original VSAM data set. The NEW DD name defines the output data set.

Optional Keywords for the REPRO Command
Suppose you want only to make a backup of part of your data set. You can use the SKIP(n) and COUNT(m) keywords on the REPRO command to delimit the records to be copied. The following form of the REPRO command would copy the input data set beginning with the 100th record and copy 500 records.

REPRO -
INFILE(VSAM) -
OUTFILE(SEQ) -
SKIP(99) -
COUNT(500)

Thursday, June 30, 2011

ISPF - TIP #020

Here is another tip on ISPF 3.4 option.
From the ISPF 3.4 option listing, I can directly Edit/Browse/view the member without listing all the members and then select the particular member.
Solution:
To do that, In the Line command issue, E / (member)use for Browse (B) and view (V) Command - Enter "/" to select action Message Volume

ISPF - TIP #019

I have data which is of length 160. For some reasons, I want to wrap the data in each record to 80characters and have the next 80 characters in the next line. So basically what I am looking for is ,“Is there command similar to Wordwrap (as in Notepad or MS WORD) in mainframe?”
Solution:
Yes, with ISPF, one can wrap the data as required.To do that,
1.Open the dataset in ISPF EDIT mode.
2.In the first line, issue the line command: TF80 (as in this case I want to wrap to 80 chars perline)
3.All the subsequent lines will wrap to 80 chars per line.

ISPF - TIP #018

Is there an easy way to search a member in Multiple PDS?


Solution:


Go to 3.4 (where all the datasets will be displayed) .


In the Command line type ==> M memname. For example: M sortpgm


This command will not work for the migrated PDS.


So ensure all the PDS are inDisk.Now the message "MEMBER(S): memname found" will apppear in the right side ofthe panel.

ISPF - TIP #017

I have to compare one input file field with one output file field.
The input file field in is column1 to 10 and the output file field is in column 40 to 50.
How can I do it?
Solution:
1. Use the standard 3.13 ISPF option. In the same screen itself, in the command line issue, E
2. then type,
CMPCOLN 40:50
CMPCOLO 1:10
3. press PF3 and exit
4.In the New dataset , type in the output dataset
5. In the Old dataset , type in the input dataset

ISPF - TIP #016

Here is a one simple one.....



I want to search a string like 'abc' (including quote).In my pgm there may be more abc strings.



But i don't want to retrieve all of them.i need the abc enclosed with quotes.



How to search is in 3.14 option?



Solution:



In the ISPF 3.14 , search with ‘’’abc’’’ string.(i.e. with 3 quotes at both sides of the string)

Tuesday, June 21, 2011

Abend s322!!

Abend is a error that happens while we are running a job. There are so many abends which may come when we are running a job. This article discusses about the Abend code s322.

Abend s322 occurs when the job doesn't end within the given CPU time. CPU time is the time which we specify in the TIME attribute of a job card.

For example, if we give TIME =(5,0) i.e 5 minutes and 0 seconds. If the job doesn't end within 5 minutes, then Abend 322 will occur as a result of it.

Solution:

To avoid this Abend, always specify TIME=NOLIMIT in the job card. This will allow the job to take the maximum CPU time to complete a job.

Friday, June 10, 2011

ISPF - TIP #015

Tired of typing the often-used datasets repeated?
Use NRETRIEV.
1 Enter KEYS in the command line,KEYS window will popup
2 Set any key to NRETRIEV and exit
3 Now when you are in 3.4 or whichever screen you have set the KEYS option, press theassigned PF keys.
4. Pressing them repeated will bring up one-by-one the last 30 accessed datasets from the reflist

ISPF - TIP #014

When I issue CUT , I know that the CUT content are placed in a clipboard.
And when I issue PASTE, the clipboard content are pasted.
But is it possible for me to view/edit the clipboard ?
One can view the clipboard after any valid CUT command was issued.
To view the clipboard, issue : CUT DISPLAY.
Clipboard manager will pop up and gives us options to edit or browse thecontent.

Wednesday, June 1, 2011

ISPF - TIP #013

How can You find the changes you have made lastly (without getting out of the screen) ?
Well, here is one simple command line command to achieve this
Solution: COMP * X

ISPF - TIP #012

Here is a tip by which you can avoid ISPF 3.4 Option.
To Open a PS or PDS member, we usually use ISPF 3.4 to open in EDIT or BROWSE MODE.
Here is one way where one can open PS or PDS member in EDIT/VIEW/BROWSE mode from any command line.
Thus, we can avoid using 3.4 option.
Solution: EPDF ‘MYID.MYPS’ .
The Dataset will be opened in EDIT MODEIf you want to open in VIEW mode:
Solution : EPDF ‘MYID.MYPS’ VIEW
Similarly, for opening in BROWSE mode, type BROWSE at the end.

ISPF - TIP #011

If you want to edit a member, which has TAB as a middle string in the PDS SAMPLE.MYPDS.
One shortcut way is to in the ISPF 3.4 listing of the PDS,issue S *TAB* E in the command line.
If we don’t use E at the end, it will open in browse mode.

Wednesday, May 25, 2011

ISPF - TIP #010

What are all the last 25 COMMAND LINE commands that you have issued from ISPFpanel ?
How to know this?
Solution:
Type RETP on the Command line.

ISPF - TIP #009

While Browsing Internet, we have some cool option called address Autocomplete
we enter some letters in the address bar and the browser auto completes it with the closest guess.
Does MAINFRAME has the same feature??
Solution: Yes! It has “Autocomplete” feature!!!How to use it?
1.Go to ISPF 3.4 ,
2. Enter KEYS in the command line,KEYS window will popup
3. Set any key to AUTOTYPE, save and exit
4. Now type any Dataset partially and press the assigned PFkey!!
Note: It will not retrieve GDGs and VSAM files.

ISPF - TIP #008

Alternate to SuperCE Option(3.13)
Use the macro COMPARE
Use this when you there is less difference between the two files.
1.Open a DSN in EDIT or VIEW Mode
2. On the Command line , issue COMP 'YOUR.SECOND.COMPARISON.DSN'
3. If you want only the changes to be listed, issue COMP'YOUR.SECOND.COMPARISON.DSN' EXC

ISPF - TIP #007

How can I find the last 10 datasets that I have accessed ?


Solution:


1.GO TO ISPF 3.4 option.


2. On the top, there is a MENUBAR. Select REFLIST


3. Select Option 1 in it.


Using this option you can find out the last 30 datasets that you have accessed

ISPF - TIP #006

We usual search for members in a PDS by the first string of the members.
Consider this situation ,I have a PDS and I want to search it for member only by middle string of the members.
for e.g. there are some members like BESTJCL1,RESTJCL2,PESTCBL1, BESTCBL2,WESTCBL3,TESTASM1,BESTASM2...etc.
I want to find members which have CBL in them.How can I search and find these members?

Solution:
1.Use ISPF 4.12 option.
2.Specify the dataset to be searched and the pattern of the string.
3.Specify the LANG type as COB And select the browse option.

Tuesday, May 24, 2011

ISPF - TIP #005

While trying to open any member in a PDS, we sometimes come across "member in use" message.
In that situation, if you want to know who is using the membercurrently, press F1 twice.

ISPF - TIP #004

Any command entered in the COMMAND LINE disappears after the successful execution of itsintended function.If you want to repeat the same command , you got to re-type it or use some PF key to retrieve thelast command entered.
But here is a cool method the make the command entered not to disappear and stay on the screen.Precede commands with '&'
For Example:
COMMAND ===> &C '100-para' '200-PARA' SCROLL ===> CSR****** ************************ TOP OF DATA **************
000001 IDENTIFICATION DIVISION.
000002 PROGRAM-ID. PROGRAM1.
000003 DATE-WRITTEN. MAY 2011.
After the execution of the command, the below command stays on the screen.
This way you can entering the same command or modifying the command a little and using itmultiple times.

ISPF - TIP #003

Suppose you are in a ISPF Screen and want to know in which TSO Region ( Development,Production, or other TSO regions) you are now .

Solution:Issue on the command line : SAREAISPF STATISTICS Pop-up window will show you the region( and other info too)

ISPF - TIP #002

Usually the PDS or PS bears the ID of the creator or the ID of the person who modified itrecently.But is it possible to change these ID values without leaving trace of one’s own ID?

Solution:Yes its possible! In the command area against the member name or PS name, by giving ‘G’.Dialog box will pop up allowing you to change the ID values.

ISPF - TIP #001

Consider that you are editing a file/program and you want to know the changes you have donesince the last SAVE command.
How to find that?

Solution: Give COMPARE SESSION on the command line
Further use of COMPARE commands...
Can be used like 3.13 option

Saturday, May 21, 2011

SORT JCL to copy all the data from the input dataset to the output dataset

COMMON JCL FOR SORT
//SORTJCL JOB (XXXXXXXX,,,,,XXXX),' ',
// CLASS=M,MSGCLASS=T,
// REGION=0M,NOTIFY=&SYSUID
//*
//***************************************************************
//DEL EXEC PGM=IEFBR14
//DD01 DD DSN=Output dataset, *Deleting the Output file
// DISP=(MOD,DELETE),UNIT=SYSDA,SPACE=(TRK,(1))
//***************************************************************
//SETP001 EXEC PGM=SORT
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//REPORT1 DD SYSOUT=*
//SORTIN DD DISP=SHR,DSN=Input dataset, *Input file
//SORTOUT DD DSN=Output dataset, *Creating output file
// DISP=(,CATLG),
// SPACE=(TRK,(30,10),RLSE),
// UNIT=SYSDA,
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=0,DSORG=PS)
//SYSIN DD *
SORT FIELDS=COPY
//*


This JCL is used copy all the data from the input dataset to the output dataset.

In the sort card, we can also give OPTION COPY instead of SORT FIELDS=COPY to do the same task.

Commonly used JCL for SORT

COMMON JCL FOR SORT
//SORTJCL JOB (XXXXXXXX,,,,,XXXX),' ',
// CLASS=M,MSGCLASS=T,
// REGION=0M,NOTIFY=&SYSUID
//*
//***************************************************************
//DEL EXEC PGM=IEFBR14
//DD01 DD DSN=Output dataset, *Deleting the Output file
// DISP=(MOD,DELETE),UNIT=SYSDA,SPACE=(TRK,(1))
//***************************************************************
//SETP001 EXEC PGM=SORT
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//REPORT1 DD SYSOUT=*
//SORTIN DD DISP=SHR,DSN=Input dataset, *Input file
//SORTOUT DD DSN=Output dataset, *Creating output file
// DISP=(,CATLG),
// SPACE=(TRK,(30,10),RLSE),
// UNIT=SYSDA,
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=0,DSORG=PS)
//SYSIN DD *
YOUR SORT CARD WILL COME HERE
//*

How to keep your mainframes session always active?

The question raised by many freshers and new joiners in a organization who work in mainframes. All freshers and new joiners in a organization get the mainframe ID's from their colleagues and start doing their work. When they keep their session idle for sometime, their session get locked and they need to provide password to unlock. You can ask one or two times to the password owner to type his password in your system, but what if its goes beyond that, don't you feel little bad to ask. I got the solution to avoid such a feeling and it is pretty simple.




In the command input in your spool, just type &(seconds). Example: &60 (i.e) Your session will get auto updated for every 60 seconds(1 minute). Hence, your session will not get locked.

Summary:

From the start screen:
i. type s.st
ii. &seconds

But the real use of this option is to update your spool and to know whether the job execution is over or not. But no where it is written that we need to use this option only for this purpose.

Friday, May 20, 2011

IEFBR14 Utility

IEFBR14 is a very popular utility in IBM mainframes. Even though it is very popular, the service provided by this utility is "nothing".(i.e) It is a "do nothing" utility. This utility runs in all the IBM environments derived from OS/360, including z/OS.

In all IBM environments, the programs never specify files(input and output datasets) directly, but instead they were referenced through a JCL(Job Control Language) statements that invoke the program which needs to access these data sets. These datasets are given in the DD(Data Definition) statements which has a DISP(Disposition) Parameter that indicates how the data set is to be managed(i.e) a new file is created or old-file is re-used or the file is deleted upon completion or retained etc...

Even though the DD statements itself does the creation and deletion of datasets, it can't run without a program. Hence, a program that does nothing was required and that's how IEFBR14 utility came to picture. It always a success job. Those DD statements run under this program IEFBR14 to create and delete data sets. We can create PS(Physically Sequential) and PDS(Partioned Data Sets) from JCL.

Naming Convention:

The first three letters of the utilities has specific usage like "IEF" for programs produced by the job management group, "IEB" for data set utility programs, "IEF" for system utility programs, and "IEW" for program-linkage and -loading.

And the next portion of the program name, for example "BR14" means "branch to register 14", IEBUPDTE was the dataset utility (IEB) that applied updates (UPDTE) to source code files, and IEHINITT was the system utility (IEH) that initialized (INT) magnetic tape labels (T).

Example of IEFBR14 utility usage:

//jobname JOB account information .....
//stepname EXEC PGM=IEFBR14
//ddname DD DSN=dataset name,
// DISP=(MOD,DELETE,DELETE)


*DISP : Deletes the given dataset in the DSN parameter