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

Two files need to sort& write O/P filewith HDR,Data,TRL


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
babu_hi

New User


Joined: 11 Apr 2006
Posts: 93

PostPosted: Tue Aug 18, 2009 9:49 am
Reply with quote

have 2 files with HEADER and TRAILER,but i want to sort throught COBOL SORT on ACCOUNT NUMBER key and write in to OUTPUT file with the Header record of First file and Data records from both files and Updated count with Trailer Record.



File 1 Records

Code:
=COLS> ----+----1----+----2----+----3-   
****** ***************************** Top
000001   HDRDDA62220921109211001  -------------->HEADER Record     
000002 00001422246 IS083246904U    -------------->DETAILE Record       
000003 00001765444 IS0493418711    -------------->DETAILE Record       
000004   TRLDDA62220921109211001   -------------->TRAILER Record       
****** **************************** Botto

File 2 Records

Code:
=COLS> ----+----1----+----2----+----3-
****** ***************************** T
000001   HDREGCD3220921109211001     -------------->HEADER Record   
000002 00001413546 IS083246904U       -------------->DETAILE Record
000003 00001765523 IS0493418711       -------------->DETAILE Record
000004   TRLEGCD3220921109211001      -------------->TRAILER Record 
****** **************************** Bo


I want Output like this,

Code:
=COLS> ----+----1----+----2----+----3-   
****** ***************************** Top
000001   HDRDDA62220921109211001  -------------->HEADER Record     
000002 00001422246 IS083246904U    -------------->DETAILE Record       
000003 00001765444 IS0493418711    -------------->DETAILE Record       
000002 00001413546 IS083246904U    -------------->DETAILE Record
000003 00001765523 IS0493418711    -------------->DETAILE Record
000004   TTRLDDA6222  04                  -------------->TRAILER Record 
****** **************************** Bo


Edited: Please use BBcode when You post some code/error, that's rather readable, Thanks... Anuj
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Tue Aug 18, 2009 10:40 am
Reply with quote

Why do you want to do it thru "COBOL SORT" and not an external SORT which would be more efficient?
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Tue Aug 18, 2009 3:43 pm
Reply with quote

Quote:
want to sort throught COBOL SORT on ACCOUNT NUMBER key and write in to OUTPUT file with the Header record of First file and Data records from both files and Updated count with Trailer Record.
That's a statement, there is no question. I'd say, fine, just do it -- what's stoping you?
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Aug 18, 2009 7:44 pm
Reply with quote

Hello,

In the SD create a new high-level sort-key that would identify the hdr, data, and trlr as 1, 2, 3. . .

Then (as Anuj suggests) - just do it. . .
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 -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Store the data for fixed length COBOL Programming 1
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Write line by line from two files DFSORT/ICETOOL 7
Search our Forums:

Back to Top