View previous topic :: View next topic
|
Author |
Message |
job1919
New User
Joined: 19 Jul 2010 Posts: 21 Location: Chennai
|
|
|
|
Hi ,
I have 2 VSAM files or rec len 200 / 240 each
file 1 - 200
File 2 - 240
Code: |
01 File 1
03 field1 - x20
03 filler - x
03 field2 - x4
03 field 3- 175
01 file 2
03 col1 - x20
03 filler - x
03 col2 - x4
03 filler - x
03 col3- 224
Output file
01 File 3
03 filler1s9(4) usage comp
03 filler x20
03 filler x10
03 field1 x20
03 filler x
03 col2 x4
03 filler rest of the space
|
I want the 2 i/p files to be sorted based on codition that
field2 = col1 then it needs to be sorted to output file . Also the file needs to have a header and trailer and in trailer the file must contain the rec-count.
Job1919 |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
field2 compared to col1 you typed but field2 is 4 bytes and col1 is 20 bytes. Suggest you check your posting.
What is the header to look like? What is the trailer to look like? Can there be duplicates.
If you have not already done so - review some of the other sort topics to make sure you have supplied all the required details including sample data.
Have you checked other postings for headers and trailers?
Have you done ANYTHING to answer the question yourself? |
|
Back to top |
|
|
job1919
New User
Joined: 19 Jul 2010 Posts: 21 Location: Chennai
|
|
|
|
Dear Nic,
Like I said , I have already done it in COBOL , I am only looking for any sort card.
And to answer your queries. Felied2 = Col2 Its a typo of X(20) . Here is the format
01 File 1
03 field1 - x20
03 filler - x
03 field2 - x4
03 field 3- 175
01 file 2
03 col1 - x4
03 filler - x
03 col2 - x4
03 filler - x
03 col3- 240
Output file
01 File 3
03 filler1s9(4) usage comp
03 filler x20
03 filler x10
03 field1 x20
03 filler x
03 col2 x4
03 filler rest of the space
I am sure you know the Col3 is left for the future use.
And about the header & Trailers.
here is the format that the utput is to look like
--------------------
File _Id: HDR
Date : Current date
Time : Current Time
--------------------
Records
--------------------
Trl_Id: TRL
Rec Count :
______________
Hope this informative
Thanks
job1919 |
|
Back to top |
|
|
sqlcode1
Active Member
Joined: 08 Apr 2010 Posts: 577 Location: USA
|
|
|
|
job1919,
Could you post sample input and expected output along header and trailer?
Thanks, |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
Quote: |
Like I said , I have already done it in COBOL , I am only looking for any sort card. |
Yes, I know you have done it in COBOL but tht is not what I was referring to when I asked about what you have done to resolve it yourself. Perhaps I should have been clearer and asked 'what have you tried with DFSORT?'. |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
Job1919,
Here is a job which will give you the desired results based on my assumptions.
Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//INA DD DSN=Your input vsam file lrecl of 200,DISP=SHR
//INB DD DSN=Your input vsam file lrecl of 240,DISP=SHR
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
JOINKEYS F1=INA,FIELDS=(1,20,A),TYPE=F
JOINKEYS F2=INB,FIELDS=(1,20,A),TYPE=F
REFORMAT FIELDS=(F1:1,20,F2:22,4)
OUTFIL REMOVECC,
BUILD=(2Z,30X,1,20,X,21,4,250:X),
HEADER1=(DATE=(4MD/),X,TIME),
TRAILER1=('REC COUNT : ',COUNT=(M11,LENGTH=8))
//*
//JNF1CNTL DD *
INREC BUILD=(1,20)
//*
//JNF2CNTL DD *
INREC BUILD=(1,25)
//* |
The output will be something like this (lrecl=250)
Code: |
2011/05/11 10:38:23
BBBBB 0001
DDDDD 0003
REC COUNT : 00000002
|
|
|
Back to top |
|
|
|