Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Need help in appending date in each record in file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Need help in appending date in each record in file
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: 578
Location: USA

PostPosted: Mon Jun 04, 2012 8:26 pm    Post subject:
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

Moderator


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

PostPosted: Mon Jun 04, 2012 8:47 pm    Post subject:
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: 578
Location: USA

PostPosted: Mon Jun 04, 2012 8:57 pm    Post subject:
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

Moderator


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

PostPosted: Mon Jun 04, 2012 9:08 pm    Post subject:
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    Post subject: Reply to: Need help in appending date in each record in file
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

Moderator


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

PostPosted: Mon Jun 04, 2012 10:07 pm    Post subject:
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    Post subject: Reply to: Need help in appending date in each record in file
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm
No new posts Problem in writing Output file vickey_dw COBOL Programming 5 Mon Nov 14, 2016 11:14 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us