JCL Session 6
AMS -- Access Method
Services – A program that performs miscellaneous tasks
JCL to invoke AMS
//stepname EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=* <--prints SYSIN input plus results
of AMS processing
//SYSIN DD * <--points to dataset
containing AMS input commands
(AMS COMMANDS)
AMS Command Format
verb parameters - anywhere in columns 2 through
72
- use hyphens to continue a command to next line
- comments begin with /* and end with */
Sample list of some AMS Command Verbs
DELETE - Remove a catalog entry for cluster, alternate index or
path.
PRINT - Print the contents of a VSAM or non-VSAM file.
REPRO - Copy records from one file to another.
ALTER - File alterations
Details on the PRINT command
PRINT
(Choose one) specify source name as:
INFILE(DD name)
INDATASET(VSAM file name)
(Optional -- Choose one) Output format as:
(Optional -- Choose one) First Record to print
SKIP(count)
count = nbr of records to skip
FROMKEY(key)
key = key where printing should begin
FROMNUMBER(nbr) RRDS only - relative number of
record
(Optional -- Choose one)
Details on the REPRO command
REPRO
(Choose one) specify source name that supplies data as:
INFILE(DD name)
INDATASET(VSAM filename)
(Required -- Choose one) specify target name that receives data as:
(Optional -- Choose one) First Record to print
SKIP(count)
count = nbr of records to skip
FROMKEY(key)
key = key where printing should begin
FROMNUMBER(nbr) RRDS only - relative number
of record
COUNT(count) Count = nbr of records to print
TOKEY(key)
TONUMBER(nbr)
(Optional -- Choose one)
REPLACE
Replaces duplicate records
NOREPLACE Duplicate records are errors
Example DELETE command. Other examples are in Supplementary Materials.
//JPETLICK JOB XX,'PETLICKI',MSGCLASS=X,MSGLEVEL=(1,1)
//DELEMEM EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
DELETE JPETLIC.CSC.CNTL(GRADES4)
/*
Example ALTER command. Other examples are in Supplementary Materials.
//JPETLICK JOB XX,'PETLICKI',MSGCLASS=X,MSGLEVEL=(1,1)
//DELEMEM EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
ALTER JPETLIC.CSC.CNTL(GRADES5) –
NEWNAME (JPETLIC.CSC.CNTL(SAMPLE))
/*
EXERCISE – Use IDCAMS (Value 15 points)
In one job, use IDCAMS in multiple steps to do the following:
-
Print the first 5 records (and 5 records only) of JPETLIC.CSC.CNTL(GRADES)
-
REPRO a copy of the 10th thru 20th records of JPETLIC.CSC.CNTL(GRADES)
in your CCP#nn.CCP.PDS as member GRADES11.
-
Print all of GRADES11 using IDCAM.
-
Rename GRADES11 to MYGRADES.
Correct assignments will only have return codes of 0000.
Avoid NOT CATLG 2 problems