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

Appending date after every record using DFSORT or ICETOOL


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

New User


Joined: 22 May 2012
Posts: 32
Location: india

PostPosted: Thu Aug 23, 2012 12:25 am
Reply with quote

Hi all,

I am having 2 files both FB and length 80.
File 1 Data
Code:
AAAABBBBCCCCDDD
SSSKKKCCCJJJUUUU
DDDOOOJJFFFFKKKK


FIle 2 (0nly one record havig date in MMDDYYYY format, the second is current date)
Code:
01212012  08232012


I want the output in following way
Code:
AAAABBBBCCCCDDD           20120823
SSSKKKCCCJJJUUUU           20120823
DDDOOOJJFFFFKKKK           20120823


In short i have to append the date in YYYYMMDD format after every record of file 1 (from position 60 to next 8 bytes).

Regards
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


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

PostPosted: Thu Aug 23, 2012 1:07 am
Reply with quote

Use SYMNAMES and format your file2 input have that as step 1

Use the data from SYMNAMES and use INREC or OUTREC that will be your step2

Lot of examples in forum
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Aug 23, 2012 1:23 am
Reply with quote

If you did this one, you can manage this in the same way.
Back to top
View user's profile Send private message
Nitin Bhargava

New User


Joined: 22 May 2012
Posts: 32
Location: india

PostPosted: Thu Aug 23, 2012 10:34 am
Reply with quote

hi bill not able to manage that one thats why thinking to do in this way...i am thinking to add a counter in both the files and then with the help of joinkeys will append the record and then check my condition....whats your say on this...
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Aug 23, 2012 1:34 pm
Reply with quote

Did you search in this forum for SYMNAMES.

You have a step to generate a SYMNAME from your date record.

You have a second step which uses the SYMNAME (which has defined a constant with your date value) so that you can attach it to your record.
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


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

PostPosted: Thu Aug 23, 2012 2:06 pm
Reply with quote

Check here
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Aug 24, 2012 4:48 am
Reply with quote

This is the most relevant from Pandora-Box's link.

It will be easiest if you use the generated SYMNAMES approach. Step 1, read your single-record date file. and format any information you want as a name and a constant

Code:
DATE-OF-A-WEEK-LAST-TUESDAY-OR-WHATEVER,C'20120815'


Writing that to an 80-byte output record (FB).

Then, take that file,

Code:
//SYMNAMES DD yourdsn,disp=(old...)


Include

Code:
//SYMNOUT DD SYSOUT=*


And use DATE-OF-A-WEEK-LAST-TUESDAY-OR-WHATEVER in the appropriate sort control card:
Code:

  INCLUDED COND=(1581,8,CH,EQ,DATE-OF-A-WEEK-LAST-TUESDAY-OR-WHATEVER)


Note, I'm not giving you sample code for your requirement, but an explanation of what is going on. You can get it easily from Kolusu's code, but if you have problems or require explanations, after consulting the manuals and researching similar solutions, tell us what has gone wrong and someone will help.
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Fri Aug 24, 2012 5:02 am
Reply with quote

Nitin Bhargava wrote:
Hi all,

I am having 2 files both FB and length 80.
File 1 Data
Code:
AAAABBBBCCCCDDD
SSSKKKCCCJJJUUUU
DDDOOOJJFFFFKKKK


FIle 2 (0nly one record havig date in MMDDYYYY format, the second is current date)
Code:
01212012  08232012

In short i have to append the date in YYYYMMDD format after every record of file 1 (from position 60 to next 8 bytes).

Regards


If the second file is always having the current date , why bother to even read it? You can use DATE1 to write the current date in CCYYMMDD format.
Code:

//STEP0100 EXEC PGM=SORT       
//SYSOUT   DD SYSOUT=*         
//SORTIN   DD *                 
AAAABBBBCCCCDDD                 
SSSKKKCCCJJJUUUU               
DDDOOOJJFFFFKKKK               
//SORTOUT  DD SYSOUT=*         
//SYSIN    DD *                 
  OPTION COPY                   
  INREC OVERLAY=(60:DATE1)     
//*


This will produce
Code:

AAAABBBBCCCCDDD                                            20120823 
SSSKKKCCCJJJUUUU                                           20120823 
DDDOOOJJFFFFKKKK                                           20120823 
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 Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
Search our Forums:

Back to Top