Wednesday, March 16, 2011

Macros in Mainframe

There are a lot of things which can reduce our day to day manual effort and this is one of them -

We can record the keystrokes for any manual effort that we do in a mainframes session like-
(i) Opening a PDS
(ii) Logging into CA7 etc

When you are in the start screen -
Go to Tools -> Record Keystrokes
Give a name for the Keystroke (for ex: opening a PDS) and then save
Do the task that is to be stored:
For ex : Start 3.4
Enter the PDS Name - MYID.MYPDS.LIBRARY

Go to Tools -> Stop Recording

Tools -> Convert Keystroke to Script
Select the Keystroke file and save the script name

To run the script ->
Go to Tools -> Run script

Lot of manual effort can be saved by having these scripts :)



Tuesday, March 15, 2011

CUT DISPLAY

To check the lines that are cut or to edit the same

Type CUT DISPLAY after using the CUT Command

Compare Session

To check for the changes made since the last save command -

Type COMPARE SESSION in the command window

Search members in multiple PDS

To search for members which are present in multiple PDS -

M MEMNAME
where MEMNAME - member name

Autotype

To have Autotype option in mainframes -
Type Start 3.4 in the command window
Type Keys in the command window and press enter
Set any PF key to AUTOTYPE and press F3 to save the options

Type any dataset name partially and press the PF key assigned :)
press the PF key again to check for other dataset names that can exist

This option will not work for GDG's and VSAM's

Line Command

We know many line commands like
A - After
B - Before
C - Copy
M - Move etc

But got to know a new one
X - This excludes the current line from display

Screenname

To have a unique name for each screen -

Suppose we have a file open in a screen and we want to name the screen as FILE1

Command -
SCRNAME FILE1

Swapbar display

At command line - SWAPBAR ON displays the list of all open screens at the bottom.

To swap to another screen - double click at the required screen

To remove SWAPBAR display - SWAPBAR OFF

Sunday, March 13, 2011

Check only particular lines in a program

Suppose the requirement is to check only few verbs for indentation etc - For ex: we want to check all the lines in the program which have the PIC clause so as to align it at a particular position -

Issue the command -
X ALL; F 'PIC' ALL

This command shows only those lines of code which have the PIC Clause

File-Aid - is it possible to use relational operators??

For requirements like - Find records which are greater than a particular value at a particular position - Fileaid comes to our help :)

We can use relational operators like EQ, NE, LT, GT, LE, GE

Command -
FIND GT '1900' 25

This command searches for the record which has a value greater than 1900 at position 25

Avoid 3.4 option to view/edit a PDS or PS file

The usual way that all of us open a file is using ISPF 3.4 option and then give the name of the PDS or PS file

To avoid this we can use the option -
EPDF 'MYID.MYPS' - Dataset will open in edit mode

Similarly for view mode -
EPDF 'MYID.MYPS' VIEW
Or browse -
EPDF 'MYID.MYPS' BROWSE

Above commands are applicable for PDS as well
The only disadvantage with this option is - we have to type the full name of the PS/PDS file and something like MYID.MYPDS.* will not work

Sunday, March 6, 2011

Copybook structure using FILA

This tip is helpful for beginners, everyone else might know it :)

When we create a copybook in cobol, we have the PIC clauses for declaring the variables. Hence the starting position of each variable is difficult to find out.

For this, we can view the copybook using FILE AID option 8 - which gives the detailed structure of the copybook like starting position, ending position, length and type of field.

Saturday, March 5, 2011

SKIPREC and STOPAFT in Sort Cards

These are quite easy, but even then i went wrong a few days back so thought of putting it here

SORT FIELDS=COPY,
SKIPREC=1000
Now here in the output file the initial 1000 records are skipped.

SORT FIELDS=COPY,
STOPAFT=5000
This copies the first 5000 records in the output file and then the processing is stopped

Now, when we club both-
SORT FIELDS=COPY,
SKIPREC=1000,
STOPAFT=5000
Here first 1000 records are skipped, then from 1001 - 6000th records are written to output file.
But I was under the impression that only 4000 records will be written and hence i went wrong..

Search for a string using Sort Card

There are many scenarios where in we want to search for a particular string in a record but we are not sure at what position that string is. The sort card below solves the problem :)

SORT FIELDS=COPY
INCLUDE COND= (1, 80, SS, EQ, C'FIND STRING')

1 - Starting position to search the string

80 - Length of the record/till the position where search has to take place

SS - Search string

FIND STRING - This is the string to be searched in every record of the file