View previous topic :: View next topic
|
Author |
Message |
Nitin Bhargava
New User
Joined: 22 May 2012 Posts: 32 Location: india
|
|
|
|
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)
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 |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
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 |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
If you did this one, you can manage this in the same way. |
|
Back to top |
|
|
Nitin Bhargava
New User
Joined: 22 May 2012 Posts: 32 Location: india
|
|
|
|
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 |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
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)
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 |
|
|
|