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
 

 

Appending date after every record using DFSORT or ICETOOL

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Appending date after every record using DFSORT or ICETOOL
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

Moderator


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

PostPosted: Thu Aug 23, 2012 1:07 am    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7228

PostPosted: Thu Aug 23, 2012 1:23 am    Post subject: Reply to: Appending date after every record using DFSORT or
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    Post subject: Reply to: Appending date after every record using DFSORT or
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7228

PostPosted: Thu Aug 23, 2012 1:34 pm    Post subject: Reply to: Appending date after every record using DFSORT or
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

Moderator


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

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

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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7228

PostPosted: Fri Aug 24, 2012 4:48 am    Post subject: Reply to: Appending date after every record using DFSORT or
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    Post subject: Re: Appending date after every record using DFSORT or ICETOO
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    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 TOT & DATE parameter in ICEMAN hemanthj642 DFSORT/ICETOOL 4 Mon Nov 14, 2016 5:19 am
No new posts How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
This topic is locked: you cannot edit posts or make replies. How to pass the previous month date i... Suganya87 DFSORT/ICETOOL 5 Mon Oct 31, 2016 4:13 pm
No new posts How to get the remainder and quotient... vnktrrd DFSORT/ICETOOL 2 Mon Oct 31, 2016 10:59 am
No new posts How to delete second instance from Fl... Gunapala CN DFSORT/ICETOOL 6 Tue Oct 18, 2016 11:42 pm


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