Thursday, November 15, 2012

MVS Utilities Reviewer Part 1

1) What is IDCAMS and when will it be used?
•    IDCAMS is an access method services utility used for creating, deleting, altering VSAM files and copying sequential file to a VSAM file, etc.

•    The different IDCAMS commands are as follows:
o    ALTER modifies information for a catalog, alternate index, cluster or path.
o    BLDINDEX builds the alternate index, of course.
o    DEFINE is used for ALTERNATEINDEX, CLUSTER or PATH.
o    DELETE removes the catalog entry for a catalog, cluster, alternate index or path.
o    LISTCAT lists information about the dataset.
o    PRINT prints the dataset contents.
o    REPRO copies records from one file to another.

2) What is IEBGENER and when will it be used?
•    IEBGENER copies records from a sequential dataset, or creates a partitioned dataset.

•    Some of the tasks that IEBGENER can perform include the following:
o    Creating a backup of a sequential data set or a member of a PDS.
o    Changing the physical block size or logical record length of a sequential data set.
o    Creating an edited data set.
o    Printing a sequential data set or a member of a PDS.
o    Creating partitioned output data set from sequential input data set.

•    An example of an IEBGENER program to copy one dataset to another:
//IEBGENER JOB  ACCT,'DATA COPY',MSGCLASS=J,CLASS=A
//STEP010  EXEC PGM=IEBGENER                      
//SYSUT1   DD DSN=xxxxx.yyyyy.zzzzz,DISP=SHR
//SYSUT2   DD DSN=aaaaa.bbbbb.ccccc,DISP=(,CATLG),
//            UNIT=SYSDA,SPACE=(TRK,(5,5),RLSE),
//            DCB=(RECFM=FB,LRECL=1440)
//SYSPRINT DD SYSOUT=*                            
//SYSIN    DD DUMMY                               
 
For straight copy tasks, the sort program can often do these faster than IEBGENER.

•    On some systems it is possible to send email from a batch job by directing the output to the "SMTP" external writer. On such systems, the technique is as follows:
//IEBGENER JOB  ACCT,'DATA COPY',MSGCLASS=J,CLASS=A
//NORMRC   EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSUT1   DD *,LRECL=80
HELO <SYSTEMID>
MAIL FROM:<USERID@SYSTEMID>
RCPT TO:<USERID@SYSTEMID>
DATA
From: <USERID@SYSTEMID>
To: <USERID@SYSTEMID>
Subject: Test Mail

TEST MAIL FROM MAINFRAME
.
QUIT
/*
//SYSUT2   DD SYSOUT=(B,SMTP),LRECL=80
//SYSIN    DD DUMMY


3) What is the SORT utility and how is it being used?
•    The SORT/MERGE utility is program to sort records in a file into a specified order, or merge pre-sorted files.

•    It is very frequently used; often the most commonly used application program in a mainframe shop.

•    Modern sort/merge programs also can select or omit certain records, summarize records, remove duplicates, reformat records, and produce simple reports.

4) Using SORT utility, how do you convert VB files to FB?
•    Sample JCL for converting Variable-Blocked files to Fixed-Blocked.

Note: this JCL is used to transform an input file with VB 4000 to an output file with FB 80.
//SORT EXEC PGM=ICEMAN,REGION=4096K
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SORTWK01 DD SPACE=(CYL,(3,3)),UNIT=SYSTS
//SORTWK02 DD SPACE=(CYL,(3,3)),UNIT=SYSTS
//SORTWK03 DD SPACE=(CYL,(3,3)),UNIT=SYSTS
//SORTIN DD DSN=P525328.SPUFI.OUT,DISP=SHR
//FBFILE DD DSN=P525328.SPUFI.FB80,
// SPACE=(CYL,(1,1),RLSE),UNIT=SYSTS,
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=8000),
// DISP=(NEW,CATLG,CATLG)
//SYSIN DD *
OPTION COPY,VLSHRT
OUTFIL FNAMES=FBFILE,OUTREC=(1:5,80),CONVERT
//*


EXPLANATION
o    OPTION COPY indicates that records will be copied to output file.
o    OPTION VLSHRT indicates that missing control filed bytes will be replace with binary zeroes.
o    FBFILE is the ddname of the output file
o    OUTREC params are as follows:
    1 = start position of input file
    5 = relative start position for the output file (i.e. : here we skip the length bytes of the VB format)
    80 = length of data transferred to the output file. It must match the LRECL of the output file.

5) What is VLSHRT option in SORT?
•    Because VB records have a fixed part and a variable part, it is possible for part of a control field to be missing. Consider this SORT statement:
SORT FIELDS=(21,12,CH,A)

•    The control field is in positions 21-32. If your VB records have 25 fixed data bytes and LRECL=45, the records can vary in length from 29 bytes (4-byte RDW, 25 bytes of fixed data, and 0 bytes of variable data) to 45 bytes (4-byte RDW, 25 bytes of fixed data, and 16 bytes of variable data). Records 32 bytes or longer include the entire control field. But records less than 32 bytes have "short" control fields, that is, they are missing some of the bytes at the end of the control field. You cannot validly sort or merge on control fields with missing bytes because missing bytes have no values.

•    If you know you have VB records with short control fields, you can specify the VLSHRT option, if appropriate, to prevent DFSORT from terminating. For example:
OPTION VLSHRT
SORT FIELDS=(21,12,CH,A)


•    VLSHRT tells DFSORT that you want to temporarily replace any missing control field bytes with binary zeros (the zeros are not kept for the output record), thus allowing DFSORT to validly sort or merge on the short control fields.

•    Attention: If NOVLSHRT is in effect, DFSORT terminates if it finds a short control field in any VB record.

Mainframe Utilities Reviewer Part 2 can be viewed here.

No comments:

Post a Comment