|
View previous topic :: View next topic
|
| Author |
Message |
vineetjoshi01
New User
Joined: 06 Nov 2009 Posts: 14 Location: Singapore
|
|
|
|
Hi All,
I have not used icetool earlier. I have to append date from inputfile-1 to all the records present in inputfile-2. Please find below a sample.
Inputfile-1:
2012-05-04
Inputfile-2:
AAAAAA
BBBBBB
CCCCCC
Output should be:
AAAAAA2012-05-04
BBBBBB2012-05-04
CCCCCC2012-05-04
I have to do it using icetool. Can someone kindly let me know how to do it.
Thanks in advance to all...
Regards,
Vineet |
|
| Back to top |
|
 |
sqlcode1
Active Member
Joined: 08 Apr 2010 Posts: 577 Location: USA
|
|
|
|
vineetjoshi01
See if below helps...
| Code: |
//STEP0001 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
2012-05-04
/*
//DATEFL DD DSN=&&DT,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN DD *
OPTION COPY
OUTFIL FNAMES=DATEFL,REMOVECC,NODETAIL,
TRAILER1=('DT,C''',01,10,C'''')
/*
//STEP0002 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SYMNAMES DD DSN=&&DT,DISP=(OLD,PASS)
//SORTIN DD *
AAAAAA
BBBBBB
CCCCCC
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC OVERLAY=(7:DT)
/* |
Thanks, |
|
| Back to top |
|
 |
Pandora-Box
Global Moderator
.jpg)
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
Hi Vineet,
If you are able to create both of your input files with an extra space you can avoid an extra step
| Code: |
//SRTJK EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//INA DD *
AAAAAA
BBBBBB
CCCCCC
//INB DD *
2012-05-04
//SORTOUT DD SYSOUT=*
//SYSIN DD *
JOINKEYS F1=INA,FIELDS=(7,1,A)
JOINKEYS F2=INB,FIELDS=(11,1,A)
REFORMAT FIELDS=(F1:1,6,F2:1,10)
SORT FIELDS=COPY |
Output
| Code: |
AAAAAA2012-05-04
BBBBBB2012-05-04
CCCCCC2012-05-04 |
Sqlcode ,
I am just improving with your guidance not sure how much better this could be |
|
| Back to top |
|
 |
sqlcode1
Active Member
Joined: 08 Apr 2010 Posts: 577 Location: USA
|
|
|
|
Pandora-Box,
Your above solution using joinkeys only worked because you are providing instream data. Wait until someone from DFSort team corrects you.
You don't need my guidance but DFSort team's.
Thanks, |
|
| Back to top |
|
 |
Pandora-Box
Global Moderator
.jpg)
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
| sqlcode1 wrote: |
Pandora-Box,
You don't need my guidance but DFSort team's.
Thanks, |
Nah Until then I would have used ICETOOL if you have not corrected me
Also I created a input files and ran them
| Code: |
//SRTJK EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//INA DD DSN=PANDORA.TEST.JCL(TEST2),DISP=SHR
//INB DD DSN=PANDORA.TEST.JCL(TEST1),DISP=SHR
//SORTOUT DD SYSOUT=*
//SYSIN DD *
JOINKEYS F1=INA,FIELDS=(7,1,A)
JOINKEYS F2=INB,FIELDS=(11,1,A)
REFORMAT FIELDS=(F1:1,6,F2:1,10)
SORT FIELDS=COPY |
TEST1 contains
TEST2 CONTAINING
| Code: |
AAAAAA
AAAAAA
AAAAAA
AAAAAA
BBBBBB
CCCCCC |
Output
| Code: |
AAAAAA2012-05-04
AAAAAA2012-05-04
AAAAAA2012-05-04
AAAAAA2012-05-04
BBBBBB2012-05-04
CCCCCC2012-05-04 |
|
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
Pandora-Box,
Your joinkeys job is performing a SORT on both files which you really don't need to. Imagine if the master file had millions of records and a sort operation on it is a mere waste of resources. Also you are assuming that the input files are created with a space in their respective positions in their files which may or may not be true. On the other hand the symbol generation job is using a COPY operation which is much more efficient. The symbol generation job is just reading 1 record and writting out a symbol statement which will be later used in copying the Master file. It is NOT about how many steps you code , it is about efficiency. In this case 2 step symbol generation method is much more efficient than a Joinkeys with SORT operation.
If you do insist using joinkeys, I would make sure you use SORTED,NOSEQCK parameters to force a COPY operation instead of SORT.
| Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//INA DD *
AAAAAA
BBBBBB
----+----1----+----2----+----3----+----4----+----5
CCCCCC
//INB DD *
2012-05-04
//SORTOUT DD SYSOUT=*
//SYSIN DD *
JOINKEYS F1=INA,FIELDS=(81,1,A),SORTED,NOSEQCK
JOINKEYS F2=INB,FIELDS=(11,1,A),SORTED,NOSEQCK
REFORMAT FIELDS=(F1:1,6,F2:1,10,F1:17,64)
SORT FIELDS=COPY
//*
//JNF1CNTL DD *
INREC OVERLAY=(81:X)
//*
//JNF2CNTL DD *
OPTION STOPAFT=1
INREC OVERLAY=(11:X)
//* |
I also slightly modified Sqlcode's symbol generation method.
| Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
2012-05-04
//SORTOUT DD DSN=&&DT,DISP=(,PASS),SPACE=(TRK,(1,0),RLSE)
//SYSIN DD *
OPTION COPY,STOPAFT=1
OUTFIL REMOVECC,NODETAIL,BUILD=(80X),
HEADER1=('DT,C''',01,10,C'''')
//*
//STEP0200 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SYMNAMES DD DSN=&&DT,DISP=(OLD,PASS)
//SORTIN DD *
AAAAAA
BBBBBB
CCCCCC
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC OVERLAY=(7:DT)
//* |
|
|
| Back to top |
|
 |
Pandora-Box
Global Moderator
.jpg)
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
Thanks Kolusu  |
|
| Back to top |
|
 |
vineetjoshi01
New User
Joined: 06 Nov 2009 Posts: 14 Location: Singapore
|
|
|
|
Hi All,
Thanks for all the suggestions. It was really very helpful, I have coded using SYMNAMES.
Regards,
Vineet |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|