Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to merge two differents files with ICETOOL

2,937 views
Skip to first unread message

Hilario G.

unread,
Jul 18, 2011, 8:30:10 AM7/18/11
to
Hello folks,

I need to obtain an output file of 300 bytes from two differents files:

- FILE1 with a lenght of 80
- FILE2 with a lenght of 300

I need to merge both files, first FILE1 and after FILE2.

I have several tested but I don't find the correct solution.

The last one JCL that I used, I only obtain FILE2:

//STEP0001 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD DSN=FILE1,DISP=SHR
//IN2 DD DSN=FILE2,DISP=SHR
//OUT DD DSN=FILE3,SPACE=(CYL,(10,1),RLSE),
// DISP=(NEW,CATLG,DELETE),UNIT=SYSDA,
// DCB=(LRECL=300,RECFM=FB)
//TOOLIN DD *
COPY FROM(IN1) TO(OUT) USING(CTL1)
COPY FROM(IN2) TO(OUT) USING(CTL2)
//CTL1CNTL DD *
INREC FIELDS=(1,80)
//CTL2CNTL DD *
INREC FIELDS=(1,300)
/*

Where is the error or how to obtain FILE3 with the combination of two different files ?

Kind Regards

Hilario Garcia

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to list...@bama.ua.edu with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

Elardus Engelbrecht

unread,
Jul 18, 2011, 9:13:00 AM7/18/11
to
Hilario G. wrote:

>I need to obtain an output file of 300 bytes from two differents files:

>- FILE1 with a lenght of 80
>- FILE2 with a lenght of 300

>I need to merge both files, first FILE1 and after FILE2.

>I have several tested but I don't find the correct solution.

Did you supplied to Frank Yaeger what he asked in thread:
'How to obtain a file bigger than 80 chars from two inputs file'

Groete / Greetings
Elardus Engelbrecht

John McKown

unread,
Jul 18, 2011, 9:54:34 AM7/18/11
to
Do you truly mean "merge"? That implies that the records have some sort
of key field(s) and you want to interleave the records in the two files
together based on the key(s). Or do you mean "concatenate" as in create
a new file will all the records of the first file, in their current
order, followed by all the records of the second file, in their current
order? It seems, to me based on your example JCL, you want to
concatenate with an output of 300 bytes. Do you want to pad the 80 byte
records with blanks or x'00's or some other character?

You're very close! In the CTL1CNTL use the OUTREC command to make the 80
byte records 300 bytes by padding. Something like:

//CTL1CNTL DD *
OUTREC FIELDS=(1,80,220X)
/*

--
John McKown
Maranatha! <><

Frank Yaeger

unread,
Jul 18, 2011, 12:51:14 PM7/18/11
to

From: Frank Yaeger/San Jose/IBM

To: IBM Mainframe Discussion List <IBM-...@bama.ua.edu>

Date: 07/18/2011 08:09 AM

Subject: Re: How to merge two differents files with ICETOOL

>>Sent this morning but hasn't made it to the list, so resending (please
ignore if already posted).

Hilario G. at IBM Mainframe Discussion List <IBM-...@bama.ua.edu> wrote on
07/18/2011 05:18:02 AM:


> I need to obtain an output file of 300 bytes from two differents files:
>
> - FILE1 with a lenght of 80
> - FILE2 with a lenght of 300
>
> I need to merge both files, first FILE1 and after FILE2.
>
> I have several tested but I don't find the correct solution.
>
> The last one JCL that I used, I only obtain FILE2:
>
> //STEP0001 EXEC PGM=ICETOOL
> //TOOLMSG DD SYSOUT=*
> //DFSMSG DD SYSOUT=*
> //IN1 DD DSN=FILE1,DISP=SHR
> //IN2 DD DSN=FILE2,DISP=SHR
> //OUT DD DSN=FILE3,SPACE=(CYL,(10,1),RLSE),
> // DISP=(NEW,CATLG,DELETE),UNIT=SYSDA,
> // DCB=(LRECL=300,RECFM=FB)
> //TOOLIN DD *
> COPY FROM(IN1) TO(OUT) USING(CTL1)
> COPY FROM(IN2) TO(OUT) USING(CTL2)
> //CTL1CNTL DD *
> INREC FIELDS=(1,80)
> //CTL2CNTL DD *
> INREC FIELDS=(1,300)
> /*
>
> Where is the error or how to obtain FILE3 with the combination of
> two different files ?

The correct DFSORT JCL would be:

//STEP0001 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD DSN=FILE1,DISP=SHR
//IN2 DD DSN=FILE2,DISP=SHR
//OUT DD DSN=FILE3,SPACE=(CYL,(10,1),RLSE),

// DISP=(MOD,CATLG,DELETE),UNIT=SYSDA


//TOOLIN DD *
COPY FROM(IN1) TO(OUT) USING(CTL1)
COPY FROM(IN2) TO(OUT)

//CTL1CNTL DD *
INREC OVERLAY=(300:X)
/*

Note the use of MOD for // OUT. Note also that this is not a "merge" - it
is a "copy".
"Merge" implies that the input files are already in sorted order and the
output
file should be in sorted order.

Frank Yaeger - DFSORT Development Team (IBM) - yae...@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration

=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort

Frank Yaeger

unread,
Jul 20, 2011, 9:58:16 AM7/20/11
to
Hilario G. at IBM Mainframe Discussion List <IBM-...@bama.ua.edu> wrote on
07/18/2011 05:18:02 AM:
> I need to obtain an output file of 300 bytes from two differents files:
>
> - FILE1 with a lenght of 80
> - FILE2 with a lenght of 300
>
> I need to merge both files, first FILE1 and after FILE2.
>
> I have several tested but I don't find the correct solution.
>
> The last one JCL that I used, I only obtain FILE2:
>
> //STEP0001 EXEC PGM=ICETOOL
> //TOOLMSG DD SYSOUT=*
> //DFSMSG DD SYSOUT=*
> //IN1 DD DSN=FILE1,DISP=SHR
> //IN2 DD DSN=FILE2,DISP=SHR
> //OUT DD DSN=FILE3,SPACE=(CYL,(10,1),RLSE),
> // DISP=(NEW,CATLG,DELETE),UNIT=SYSDA,
> // DCB=(LRECL=300,RECFM=FB)
> //TOOLIN DD *
> COPY FROM(IN1) TO(OUT) USING(CTL1)
> COPY FROM(IN2) TO(OUT) USING(CTL2)
> //CTL1CNTL DD *
> INREC FIELDS=(1,80)
> //CTL2CNTL DD *
> INREC FIELDS=(1,300)
> /*
>
> Where is the error or how to obtain FILE3 with the combination of
> two different files ?

The correct DFSORT JCL would be:

//STEP0001 EXEC PGM=ICETOOL


//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD DSN=FILE1,DISP=SHR
//IN2 DD DSN=FILE2,DISP=SHR
//OUT DD DSN=FILE3,SPACE=(CYL,(10,1),RLSE),

// DISP=(MOD,CATLG,DELETE),UNIT=SYSDA


//TOOLIN DD *
COPY FROM(IN1) TO(OUT) USING(CTL1)
COPY FROM(IN2) TO(OUT)

//CTL1CNTL DD *
INREC OVERLAY=(300:X)
/*

Note the use of MOD for // OUT. Note also that this is not a "merge" - it
is a "copy".
"Merge" implies that the input files are already in sorted order and the
output
file should be in sorted order.

Frank Yaeger - DFSORT Development Team (IBM) - yae...@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration

=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort

----------------------------------------------------------------------

0 new messages