IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Need help in appending date in each record in file


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
vineetjoshi01

New User


Joined: 06 Nov 2009
Posts: 14
Location: Singapore

PostPosted: Mon Jun 04, 2012 8:03 pm
Reply with quote

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
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 577
Location: USA

PostPosted: Mon Jun 04, 2012 8:26 pm
Reply with quote

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
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Mon Jun 04, 2012 8:47 pm
Reply with quote

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 icon_biggrin.gif not sure how much better this could be
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 577
Location: USA

PostPosted: Mon Jun 04, 2012 8:57 pm
Reply with quote

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
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Mon Jun 04, 2012 9:08 pm
Reply with quote

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
Code:
2012-05-04

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
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Mon Jun 04, 2012 9:58 pm
Reply with quote

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
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Mon Jun 04, 2012 10:07 pm
Reply with quote

Thanks Kolusu icon_smile.gif
Back to top
View user's profile Send private message
vineetjoshi01

New User


Joined: 06 Nov 2009
Posts: 14
Location: Singapore

PostPosted: Tue Jun 12, 2012 11:05 am
Reply with quote

Hi All,

Thanks for all the suggestions. It was really very helpful, I have coded using SYMNAMES.
Regards,
Vineet
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
Search our Forums:

Back to Top