Page 1 of 1

JCL sort to compare 2 files and updated field in a file.

PostPosted: Sat Feb 20, 2010 2:01 pm
by Sumithdcosta
Hello All,

I have 2 files,
File1 is the JCL program with LRECL 80
Eg:-

//JOBCARD XXXXXXXXXXXXXXXXXX
//SYSERROR DD SYSOUT=*
//INPUTDD DD DISP=SHR,DSN=DB2PROD.TXXX.DSTP00AC.P001.G0680V00
//$ORTPARM DD DISP=SHR,DSN=XXXXXXX.TTTTTT.EEE
//SYSIN DD *
XYZ
QWET
/*

File 2 is the PS file with LRECL = 80 with GDG file names inside it.

Eg:-
DB2PROD.TXXX.DSTP01AC.P000.G0692V00
DB2PROD.TXXX.DSTP01AD.P000.G2009V00

OUTPUT should be some what like below.

//JOBCARD XXXXXXXXXXXXXXXXXX
//SYSERROR DD SYSOUT=*
//INPUTDD DD DISP=SHR,DSN=DB2PROD.TXXX.DSTP01AC.P000.G0692V00
//$ORTPARM DD DISP=SHR,DSN=XXXXXXX.TTTTTT.EEE
//SYSIN DD *
XYZ
QWET
/*

Note:-
With GDG Name of file 1 is change with new GDG name from file 2 without changing the rest fields in file 1.

Regards,
Sumith

Re: JCL sort to compare 2 files and updated field in a file.

PostPosted: Sat Feb 20, 2010 2:13 pm
by Sumithdcosta
sorry typo... below is corrected question.

I have 2 files,
File1 is the JCL program with LRECL 80
Eg:-

//JOBCARD XXXXXXXXXXXXXXXXXX
//SYSERROR DD SYSOUT=*
//INPUTDD DD DISP=SHR,DSN=DB2PROD.TXXX.DSTP01AC.P002.G0777V00
//$ORTPARM DD DISP=SHR,DSN=XXXXXXX.TTTTTT.EEE
//SYSIN DD *
XYZ
QWET
/*

File 2 is the PS file with LRECL = 80 with GDG file names inside it.

Eg:-
DB2PROD.TXXX.DSTP01AC.P000.G0692V00
DB2PROD.TXXX.DSTP01AD.P000.G2009V00

OUTPUT should be some what like below.

//JOBCARD XXXXXXXXXXXXXXXXXX
//SYSERROR DD SYSOUT=*
//INPUTDD DD DISP=SHR,DSN=DB2PROD.TXXX.DSTP01AC.P000.G0692V00
//$ORTPARM DD DISP=SHR,DSN=XXXXXXX.TTTTTT.EEE
//SYSIN DD *
XYZ
QWET
/*

Note:-
With GDG Name of file 1 is change with new GDG name from file 2 without changing the rest fields in file 1.

Re: JCL sort to compare 2 files and updated field in a file.

PostPosted: Sat Feb 20, 2010 2:37 pm
by Sumithdcosta
please provide a SYNCSORT solution?

Re: JCL sort to compare 2 files and updated field in a file.

PostPosted: Sat Feb 20, 2010 3:04 pm
by Sumithdcosta
update

Conditions:-
The search for file1 starts from 28 position ,length=21 and should match with the file2 records starting from 1, length 21. If it matches, the record of file1 should be replaced by the records of file 2 starting position 1 to 35.

Re: JCL sort to compare 2 files and updated field in a file.

PostPosted: Tue Feb 23, 2010 1:04 pm
by Sumithdcosta
Solution:-

Step1:- convert PDS to PS with LRECL 160
Step2:- add sequence number to original JCL
Step3:- use join keys to compare (File1 and file2) and copy paired and unpaired entries of F1. Overlay the required fields.
Step4:-sort the output with sequence number to get back the original format.
Step5:- move back PS to PDS with LRECL 80.