When two files(sorted files) are merged it will get appended in the thirdfile, but i dont think we can do it in ur way. Else u should read the first data of one file and first data of another file and put it in third file using application program(COBOL). before that u can sort the ps file using JCL's.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
rinkubhat,
Here's a DFSORT/ICETOOL job that will do what I think you're asking for which is to interleave the records from file1 and file2. I assumed your input files have RECFM=FB and LRECL=80, but the job can be changed appropriately for other attributes.
Code:
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD *
abcde
ghijkl
/*
//IN2 DD *
12345
67893
/*
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//T2 DD DSN=&&T2,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//TOOLIN DD *
* Add sequence number 1, 3, 5, ... to file1 records.
COPY FROM(IN1) TO(T1) USING(CTL1)
* Add sequence number 2, 4, 6, ... to file2 records.
COPY FROM(IN2) TO(T2) USING(CTL2)
/*
//CTL1CNTL DD *
INREC OVERLAY=(81:SEQNUM,8,ZD,START=1,INCR=2)
/*
//CTL2CNTL DD *
INREC OVERLAY=(81:SEQNUM,8,ZD,START=2,INCR=2)
/*
//S2 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN01 DD DSN=&&T1,DISP=(OLD,PASS)
//SORTIN02 DD DSN=&&T2,DISP=(OLD,PASS)
//SORTOUT DD SYSOUT=*
//SYSIN DD *
* Merge on sequence number to interleave records from
* file1 and file2.
MERGE FIELDS=(81,8,ZD,A)
* Remove sequence number.
OUTREC BUILD=(1,80)
/*
CTL1CNTL supplies DFSORT control statements for the first COPY operator. The INREC statement adds an 8-byte ZD sequence number at the end of the record. The sequence number starts at 1 and is incremented by 2 for each record giving 1, 3, 5, ...
CTL2CNTL supplies DFSORT control statements for the second COPY operator. The INREC statement adds an 8-byte ZD sequence number at the end of the record. The sequence number starts at 2 and is incremented by 2 for each record giving 2, 4, 6, ...
If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:
Thanks the code u gave worked fine
But when i replaced SORTOUT WITH DSN NAME IT GIVES ME AN ABEND
Code:
//SORTOUT DD SYSOUT=*
//SYSIN DD *
* Merge on sequence number to interleave records from
* file1 and file2.
MERGE FIELDS=(81,8,ZD,A)
* Remove sequence number.
OUTREC BUILD=(1,80)
ABEND IS RELATED TO SOME DCB PARAMETER RELATED WITH EROPT
Code:
IEF403I KARBHAT5 - STARTED - TIME=01.00.44
+IEC020I 001-4,KARBHAT5,S2 ,SYSOUT ,JES
+IEC020I EROPT IS 'ABE' OR NOT SPECIFIED
IEA995I SYMPTOM DUMP OUTPUT 357
SYSTEM COMPLETION CODE=001
TIME=01.00.45 SEQ=14175 CPU=0000 ASID=0072
PSW AT TIME OF ERROR 078D1000 00EC3A6E ILC 2 INTC 0D
NO ACTIVE MODULE FOUND
NAME=UNKNOWN
DATA AT PSW 00EC3A68 - 00181610 0A0D0000 00238000
AR/GR 0: 80D3FB3E/80000000 1: 00000000/80001000
2: 00000000/008C0FE8 3: 00000000/00006EA0