How To Insert A Record In Vsam File Using Jcl
VSAM REPRO command is used to re-create data from one file(Input file) to another file(Output file). Input & Output files can exist VSAM datasets (like KSDS, ESDS, RRDS, etc.) or a non-VSAM dataset (like PS file or a member of PDS).
A few critical functionalities of REPRO are
- Information technology is used to copy information from one dataset (input VSAM/NON-VSAM file) to another dataset (output VSAM/Non-VSAM file).
- Information technology is used to load empty VSAM clusters along with edifice the data and index components for KSDS.
- It is used to create a backup of a VSAM dataset in PS dataset.
- It can be used to merge information from 2 VSAM datasets
VSAM REPRO Important consideration
- While loading KSDS, brand certain all records in the input file are sorted in ascending gild of field which will be represented as the primary key field in the output dataset.
- While loading ESDS, record sorting is not mandatory.
- While loading RRDS, records tin be sorted on the field that correlates to the relative record number. During RRDS load, the records are loaded in relative tape sequence starting with 1.
Syntax
REPRO {INFILE(ip-ddname[/password] OR INDATASET(ip-entryname[/password] {OUTFILE(op-ddname[/password])] OR OUTDATASET(op-entryname[/countersign])} ******[optional-paramters] ************ [FROMKEY(key)]FROMADDRESS(address)] FROMNUMBER(number)]SKIP(count)] [REPLACE]NOREPLACE] [REUSE]NOREUSE] [TOKEY(key)]TOADDRESS(accost)] TONUMBER(number)]COUNT(count)]
ip/op-ddname – It points to the logical name of the input and output dataset respectively as mentioned in the DD statement of the same step.
Example: //VSAMFL DD DSN=XXXXXXX.YYYYYYYY.CUSTOMER.KSDS.CLUSTER,DISP=SHR
In the in a higher place statement, VSAMFL indicates DDNAME (i.e. logical name of Dataset)
ip/op-entryname – Information technology points to the physical name of the input and output dataset respectively. Ex. XXXXXXX.YYYYYYYY.Customer.KSDS.CLUSTER
There are multiple optional parameters that tin exist coded under the REPRO command, beneath are the nearly frequently used parameters beneath
Parameter | Description |
FROMKEY (value-1) TOKEY (value-ii) | It may be included to specify either the full or generic key value that defines the starting and ending point of the re-create operation. Copies all records whose key field value is between value-one specified in FROMKEY and value-ii specified in TOKEY. The input file must be KSDS |
FROMADDRESS (add-value-i) TOADDRESS (add-value-two) | Information technology may be included to specify the RBA value that defines the starting and ending point of the copy operation. Copies all records whose address is between add-value-i specified in FROMADDRESS and add together-value-2 specified in TOADDRESS. The input file must be KSDS or ESDS |
FROMNUMBER (RRN-1) TONUMBER (RRN-2) | Information technology may be included to specify the relative record number that defines the starting and ending point of the re-create operation. Copies all records whose relative record number(RRN) value is betwixt RRN-ane specified in FROMNUMBER and RRN-2 specified in TONUMBER. The input file must exist RRDS |
SKIP(n) | It may be included to featherbed the specified number of records from the input dataset before starting the re-create operation. When the SKIP parameter is used, REPRO skips copying then number of records from the start of the file. |
COUNT(due north) | COUNT parameter is used to specify that onlyn number of records are to exist copied from the input file to the output file When the SKIP parameter is coded earlier the COUNT parameter, the count of the number of records to copy starts right after the number of records skipped i.eastward. if " SKIP(five) COUNT(10) " is coded, and then simply records at position 6 to 15 volition be copied from the input file to the output file |
Supplant | NOREPLACE | When REPLACE is coded, It specifies records with duplicate main keys(for KSDS) and indistinguishable relative record numbers (for RRDS) volition exist replaced NOREPLACE is default and causes job failure when trying to copy records with a duplicate key |
REPLACE may be specified to cause existing records in the output cluster to be replaced when a indistinguishable record is read from the input dataset. Supplant is applicative for KSDS and RRDS clusters.
REPLACE may also be used to merge input from subsequent REPRO operations with different input datasets to the aforementioned target dataset, where the possibility of duplicate records.
If an attempt is made to add a indistinguishable record and REPLACE is not specified, an fault bulletin and the input record is discarded; on the fourth occurrence of a duplicate tape, the REPRO operation is terminated and the remainder of the input file is not candy.
Resetting the Output Cluster to Empty:
The REUSE parameter may be specified to crusade the output cluster to be reset to the empty status earlier loading commences. In order for the REUSE parameter to exist commanded, the output cluster must have been divers with the REUSE aspect.
Example: Use of REPRO to copy PS file to GDG dataset.
//PSTOGDG Job (1234),'INDUS',Course=A,MSGCLASS=A,MSGLEVEL=(1,1), // NOTIFY=&SYSUID,REGION=6M //****************************************************** //*SAMPLE JCL REPRO/COPY Data FROM PS TO GDG USING REPRO //****************************************************** //STEPOZA EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=* //PSFILE DD DSN=XXXXXXX.YYYYYYYY.CUSTOMER.INPUT, // DISP=SHR //GDGFILE DD DSN=XXXXXXX.YYYYYYYY.Customer.BKUP(+ane), // DISP=(NEW,CATLG,DELETE), // UNIT=Examination,Infinite=(CYL,(10,10),RLSE), // DCB=(MODEL.GDG,RECFM=FB,LRECL=80) //SYSIN DD * REPRO INFILE(PSFILE) OUTFILE(GDGFILE) /*
Instance: Use of REPRO to re-create KSDS VSAM to GDG dataset.
//KSTOGDG JOB (1234),'INDUS',CLASS=A,MSGCLASS=A,MSGLEVEL=(1,1), // NOTIFY=&SYSUID,REGION=6M //********************************************************* //*SAMPLE JCL REPRO/COPY DATA FROM KSDS TO GDG USING REPRO //********************************************************* //KSDSGDG EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=* //KSDSFILE DD DSN=XXXXXXX.YYYYYYYY.CUSTOMER.KEYFILE, // DISP=SHR //GDGFILE DD DSN=XXXXXXX.YYYYYYYY.CUSTOMER.KEYFILE.BKUP(+1), // DISP=(NEW,CATLG,DELETE), // UNIT=SYSDA,SPACE=(CYL,(10,ten),RLSE), // DCB=(MODEL.GDG,RECFM=FB,LRECL=80) //SYSIN DD * REPRO INFILE(KSDSFILE) OUTFILE(GDGFILE) /*
Instance: Use of REPRO to copy KSDS file records at row positions 6 to 15 to the output GDG dataset.
//KSDSGDG EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=* //KSDSFILE DD DSN=PAYT.PAYROLL.Process.KEYFILE, // DISP=SHR //GDGFILE DD DSN=PAYT.PAYROLL.PROCESS.KEYFILE.BKUP(+one), // DISP=(NEW,CATLG), // UNIT=SYSDA,SPACE=(CYL,(10,10),RLSE), // DCB=(MODEL.GDG,RECFM=FB,LRECL=325) //SYSIN DD * REPRO INFILE(KSDSFILE) OUTFILE(GDGFILE) - SKIP(5) COUNT(x) /*
Instance: Use of REPRO to copy PS file to VSAM dataset.
//PSTOVSAM JOB (1234),'INDUS',CLASS=A,MSGCLASS=A,MSGLEVEL=(ane,1), // NOTIFY=&SYSUID,REGION=6M //************************************************************* //*SAMPLE JCL REPRO/COPY Data FROM PS TO VSAM KSDS USING REPRO //************************************************************* //STEPOZA EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=* //SYSOUT DD SYSOUT=* //SYSIN DD * REPRO - INDATASET(XXXXXXX.YYYYYYYY.Customer.INPUT) - OUTDATASET(XXXXXXX.YYYYYYYY.CUSTOMER.KSDS.CLUSTER) - SKIP(3) - COUNT(3) /*
Example: Use of REPRO to re-create VSAM to PS file.
//KSDSTOPS JOB (1234),'INDUS',CLASS=A,MSGCLASS=A,MSGLEVEL=(1,i), // NOTIFY=&SYSUID,REGION=6M //************************************************************* //* SAMPLE JCL REPRO/COPY DATA FROM VSAM KSDS TO PS USING REPRO //************************************************************* //STEPOZA EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=* //SYSOUT DD SYSOUT=* //DD1 DD DSN=XXXXXXX.YYYYYYYY.CUSTOMER.KSDS.CLUSTER,DISP=SHR //DD2 DD DSN=XXXXXXX.YYYYYYYY.CUSTOMER.OUTPUT, // DISP=(NEW,CATLG,DELETE), // SPACE=(TRK,(1,one),RLSE), // Unit of measurement=SYSDA, // DCB=(DSORG=PS,RECFM=FB,LRECL=80,BLKSIZE=0) //SYSIN DD * REPRO - INFILE(DD1) - OUTFILE(DD2) - FROMKEY(4444) - TOKEY(5555) /*
VSAM Tutorials
- VSAM DEFINE CLUSTER using IDCAMS with Examples
- VSAM Alternating Index using IDCAMS with Examples
- VSAM REPRO using IDCAMS with Examples
- VSAM PRINT using IDCAMS with Examples
- VSAM VERIFY EXAMINE using IDCAMS with Examples
- VSAM DELETE using IDCAMS with Examples
- VSAM Consign-IMPORT using IDCAMS with Examples
VSAM Define Cluster: Click Here IBM Reference : Click Here
How To Insert A Record In Vsam File Using Jcl,
Source: https://www.techagilist.com/mainframe/jcl/vsam-repro-using-idcams-with-examples/
Posted by: singerdard1949.blogspot.com
0 Response to "How To Insert A Record In Vsam File Using Jcl"
Post a Comment