Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
You can use a DFSORT/ICETOOL job like this to write the first and last record of each input file to the MOD output file. I assumed that your input files have RECFM=FB and LRECL=80, but the job can be changed appropriately for other attributes.
I can't test it now, but I would test something to make it in 1 pass this way :
- inrec seqnum all the records
- outfil with trailer3 + sections
- extract the 1st record with MIN= on seqnum
- extract the last record with MAX= on seqnum
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Alain,
Not sure how that would work. There's nothing in the three separate files to identify which files a record came from. So how would you identify the first and last record from each file? Also, if you're trying to use three different OUTFILs, then you'd need to write them to three separate files and then copy them back together. OUTFIL output files are written in parallel so you can't MOD them to one file.
Well, I didn?t tell you I thought to code 1 pass for each input file as follow :
Code:
//STEP0001 EXEC PGM=ICETOOL
//DFSMSG DD SYSOUT=*
//TOOLMSG DD SYSOUT=*
//TOOLIN DD *
COPY FROM(IN1) USING(ICE0)
COPY FROM(IN2) USING(ICE0)
COPY FROM(IN3) USING(ICE0)
/*
//IN1 DD *
A
B
/*
//IN2 DD *
A
B
C
/*
//IN3 DD *
A
B
C
D
/*
//OUTX DD SYSOUT=*
//ICE0CNTL DD *
OUTREC IFTHEN=(WHEN=INIT,BUILD=(1,10,X,SEQNUM,5,ZD)),IFOUTLEN=10
OUTFIL FNAMES=OUTX,
TRAILER1=(1,10,MIN=(12,5,ZD),/,
1,10,MAX=(12,5,ZD)),
NODETAIL,
REMOVECC
/*
I confused 2 ideas that coding MIN= will not select the first record, MAX the last one. TRAILERx always select the last record. Even if HEADERx supported MIN=,MAX= & others, even if it worked, I think there is no way to remove the seqnum after TRAILERx as I tested it with IFOUTLEN. The error msg I received was :
Code:
ICE027A 9 END OF OUTX FIELD BEYOND MAXIMUM RECORD LENGTH
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
You can now do this kind of thing more easily using the new SUBSET operator of DFSORT's ICETOOL available with z/OS DFSORT V1R5 PTF UK90013 (July, 2008) like this:
Code:
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD DSN=... input file1 (FB/80)
//IN2 DD DSN=... input file2 (FB/80)
//IN3 DD DSN=... input file3 (FB/80)
//OUT DD DISP=MOD,DSN=... output file (FB/80)
//TOOLIN DD *
SUBSET FROM(IN1) TO(OUT) INPUT KEEP FIRST LAST
SUBSET FROM(IN2) TO(OUT) INPUT KEEP FIRST LAST
SUBSET FROM(IN3) TO(OUT) INPUT KEEP FIRST LAST
/*
For complete details on the new SUBSET function and the other new functions available with PTF UK90013, see: