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

How to add description while merging using sort card


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
balakrishna reddy

Active User


Joined: 13 Jul 2007
Posts: 128
Location: Guntur

PostPosted: Mon Dec 24, 2007 3:46 pm
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10886
Location: italy

PostPosted: Mon Dec 24, 2007 4:58 pm
Reply with quote

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
View user's profile Send private message
balakrishna reddy

Active User


Joined: 13 Jul 2007
Posts: 128
Location: Guntur

PostPosted: Mon Dec 24, 2007 5:06 pm
Reply with quote

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
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Mon Dec 24, 2007 5:52 pm
Reply with quote

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
Code:
                    monthly file

File2 contains
Code:
dddddddddddddddddddddddd
ssssssssssssssssssssssssssss
ssssssffffffffffffffffffffffffffffffffffff
rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr

File3 contains
Code:
                    half-yearly file

File4 contains
Code:
ttttttttttttttttttttttttttttttttttttttt
yyyyyyyyyyyyyyyyyyyyyyy

File5 contains
Code:
                   yearly file

File6 contains
Code:
wwwwwwwwwwwwwwwwwwww
eeeeeeeeeeeeeeeeeeeeeee
dddddddddddddddffffffffffffffffff
Back to top
View user's profile Send private message
balakrishna reddy

Active User


Joined: 13 Jul 2007
Posts: 128
Location: Guntur

PostPosted: Mon Dec 24, 2007 5:57 pm
Reply with quote

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
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Mon Dec 24, 2007 6:00 pm
Reply with quote

Ok.. then do you have a way to identify the records as different files..?
Hope your are getting my question!
Back to top
View user's profile Send private message
balakrishna reddy

Active User


Joined: 13 Jul 2007
Posts: 128
Location: Guntur

PostPosted: Mon Dec 24, 2007 6:24 pm
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10886
Location: italy

PostPosted: Mon Dec 24, 2007 6:28 pm
Reply with quote

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
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Mon Dec 24, 2007 6:35 pm
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Mon Dec 24, 2007 8:54 pm
Reply with quote

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
View user's profile Send private message
balakrishna reddy

Active User


Joined: 13 Jul 2007
Posts: 128
Location: Guntur

PostPosted: Wed Dec 26, 2007 11:54 am
Reply with quote

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
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Wed Dec 26, 2007 4:24 pm
Reply with quote

look at No Data or Carriage Control Characters
Back to top
View user's profile Send private message
balakrishna reddy

Active User


Joined: 13 Jul 2007
Posts: 128
Location: Guntur

PostPosted: Wed Dec 26, 2007 6:25 pm
Reply with quote

thank you krisprem for your information.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Wed Dec 26, 2007 9:35 pm
Reply with quote

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
View user's profile Send private message
balakrishna reddy

Active User


Joined: 13 Jul 2007
Posts: 128
Location: Guntur

PostPosted: Fri Dec 28, 2007 1:23 pm
Reply with quote

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
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Fri Dec 28, 2007 1:33 pm
Reply with quote

Try this balakrishna
Code:
OUTFIL FNAMES=OUT,REMOVECC,             
   HEADER1=(21:'MONTHLY FILE',/,         
            5:'THIS IS FOR MONTH OF JAN')
Back to top
View user's profile Send private message
balakrishna reddy

Active User


Joined: 13 Jul 2007
Posts: 128
Location: Guntur

PostPosted: Fri Dec 28, 2007 3:30 pm
Reply with quote

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
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts JCL sort to compare dates in two file... DFSORT/ICETOOL 2
No new posts Is this possible via sort (in one pass)? SYNCSORT 4
No new posts GDG generation name to GDG Base name ... DFSORT/ICETOOL 3
No new posts SORT on detail record, then repeat he... DFSORT/ICETOOL 3
No new posts FB to .CSV conversion using sort DFSORT/ICETOOL 7
Search our Forums:

Back to Top