View previous topic :: View next topic
|
Author |
Message |
balakrishna reddy
Active User
Joined: 13 Jul 2007 Posts: 128 Location: Guntur
|
|
|
|
Hi All,
I have requirement like i need to add one line description about the file that is merged like given below.
*****cluster***
11111111111111
222222222222222
2344445555555
****1cluster*****
555555555555555
6666666666666
3333333333333333
****2cluster*****
666666666666666666
77777777777777777
55555555557666677
i want the output file after merging the three files like above mentioned
only using sort card
Please help me for this. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10886 Location: italy
|
|
|
|
From Your signature ... You certainly confused us...
the requirement might be clear for You, but for us is not easy to understand |
|
Back to top |
|
|
balakrishna reddy
Active User
Joined: 13 Jul 2007 Posts: 128 Location: Guntur
|
|
|
|
Hi enrico-sorichetti,
I have three description's for three files like below
file1 - "monthly file"
file2 - "half-yearly file"
file3 - "yearly file"
i have some records in each of the file. Now i want to merge these three files so i am expecting the output file as given below
Code: |
monthly file
dddddddddddddddddddddddd
ssssssssssssssssssssssssssss
ssssssffffffffffffffffffffffffffffffffffff
rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
half-yearly file
ttttttttttttttttttttttttttttttttttttttt
yyyyyyyyyyyyyyyyyyyyyyy
yearly file
wwwwwwwwwwwwwwwwwwww
eeeeeeeeeeeeeeeeeeeeeee
dddddddddddddddffffffffffffffffff
|
i have to add one line above each and every file while merging so that in the output file it should be clear like these records are monthly and these records are yearly.
You need any more information please let me know. |
|
Back to top |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
Code: |
//*********************************************
//STEP1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=FILE1,DISP=SHR
// DD DSN=FILE2,DISP=SHR
// DD DSN=FILE3,DISP=SHR
// DD DSN=FILE4,DISP=SHR
// DD DSN=FILE5,DISP=SHR
// DD DSN=FILE6,DISP=SHR
//SORTOUT DD dsn=o/p file
//SYSIN DD *
SORT FIELDS=COPY
/*
|
I am suggesting this JCL assuming that you are not merging based on any key.
Here File1 contains
File2 contains
Code: |
dddddddddddddddddddddddd
ssssssssssssssssssssssssssss
ssssssffffffffffffffffffffffffffffffffffff
rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
|
File3 contains
File4 contains
Code: |
ttttttttttttttttttttttttttttttttttttttt
yyyyyyyyyyyyyyyyyyyyyyy
|
File5 contains
File6 contains
Code: |
wwwwwwwwwwwwwwwwwwww
eeeeeeeeeeeeeeeeeeeeeee
dddddddddddddddffffffffffffffffff |
|
|
Back to top |
|
|
balakrishna reddy
Active User
Joined: 13 Jul 2007 Posts: 128 Location: Guntur
|
|
|
|
Hi kRISPREM,
Thanks for your response, But if i have around 100 files like that ,It will become 200 input files.Is there any other way to add like header to the input file while merging. |
|
Back to top |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
Ok.. then do you have a way to identify the records as different files..?
Hope your are getting my question! |
|
Back to top |
|
|
balakrishna reddy
Active User
Joined: 13 Jul 2007 Posts: 128 Location: Guntur
|
|
|
|
No, Once the records are merged i can't identify which record belongs to which file.
Is there a way like count the no. of records and after copying those many records add the description record for the next record like wise for all. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10886 Location: italy
|
|
|
|
Quote: |
No, Once the records are merged i can't identify which record belongs to which file. |
if You cannot identify which belong to which
what' s the advantage of piling up everything together ???
or... the business reason ??? |
|
Back to top |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
Quote: |
Is there a way like count the no. of records and after copying those many records add the description record for the next record like wise for all.
|
If there are 100 files, you need to find the count of each file and do the processing is it...?
is it not tedious? |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Balakrishna Reddy,
You're not merging the files, you're copying them (copying is different from merging).
You can use a DFSORT/ICETOOL job like the following to add a header line for each file to one MOD output file:
Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD DSN=... input file1
//IN2 DD DSN=... input file2
//IN3 DD DSN=... input file3
//* USE MOD FOR OUTPUT FILE
//OUT DD DISP=MOD,DSN=... output file
//TOOLIN DD *
COPY FROM(IN1) USING(CTL1)
COPY FROM(IN2) USING(CTL2)
COPY FROM(IN3) USING(CTL3)
/*
//CTL1CNTL DD *
OUTFIL FNAMES=OUT,REMOVECC,
HEADER1=(21:'Monthly file')
/*
//CTL2CNTL DD *
OUTFIL FNAMES=OUT,REMOVECC,
HEADER1=(21:'half-yearly file')
/*
//CTL3CNTL DD *
OUTFIL FNAMES=OUT,REMOVECC,
HEADER1=(21:'yearly file')
/*
|
|
|
Back to top |
|
|
balakrishna reddy
Active User
Joined: 13 Jul 2007 Posts: 128 Location: Guntur
|
|
|
|
Hi Frank,
Thanks a lot for your jcl, Its working,But i couldn't understand what is the use of REMOVECC can you please explain me if you have time.
I once again thank all of you for your valuable responses. |
|
Back to top |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
Back to top |
|
|
balakrishna reddy
Active User
Joined: 13 Jul 2007 Posts: 128 Location: Guntur
|
|
|
|
thank you krisprem for your information. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Balakrishna,
If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:
Use [URL] BBCode for External Links |
|
Back to top |
|
|
balakrishna reddy
Active User
Joined: 13 Jul 2007 Posts: 128 Location: Guntur
|
|
|
|
Hi Frank,
Slight modification in the above requirement, Now i need to add one more header for the first file.I tried to add it below the first one but it is giving RC 16 for that.Can you suggest me any alternative.
Code: |
//CTL1CNTL DD *
OUTFIL FNAMES=OUT,REMOVECC,
HEADER1=(21:'MONTHLY FILE')
HEADER0=(5:'THIS IS FOR MONTH OF JAN')
/*
|
|
|
Back to top |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
Try this balakrishna
Code: |
OUTFIL FNAMES=OUT,REMOVECC,
HEADER1=(21:'MONTHLY FILE',/,
5:'THIS IS FOR MONTH OF JAN')
|
|
|
Back to top |
|
|
balakrishna reddy
Active User
Joined: 13 Jul 2007 Posts: 128 Location: Guntur
|
|
|
|
kRISPREM,
Before searching in the document given by frank i have posted this, Its there in the document, Anyway thanks krisprem.
From now onwards before posting i will search all the documents |
|
Back to top |
|
|
|