Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Merge and copy files based on Conditions

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
srivatsantk

New User


Joined: 04 Sep 2007
Posts: 4
Location: USA

PostPosted: Tue Sep 04, 2007 10:18 pm    Post subject: Merge and copy files based on Conditions
Reply with quote

I have a file with Header Records (type 1C) followed by the Detail Records (Type 7C) and then the Trailer records (Type 8C). Within the Header and Trailer records, there is no limitation to the number of detail records.
The Header, Detail and Trailer records are linked to each other with a key. They location of the key is as follows:
Header: 187-200
Detail: 184-197
Trailer: 165-178

My requirement is to get an output record, in which each record is combination of a header and detail records.

For example,
INPUT:
Header1 - HC11 HC12 HC13 HC14 HC15
Detail11 - DC111 DC112 DC113 DC114 DC115 DC116
Detail12 - DC121 DC122 DC123 DC124 DC125 DC126
Detail13 - DC131 DC132 DC133 DC134 DC135 DC136
Detail14 - DC141 DC142 DC143 DC144 DC145 DC146
Trailer1- TC11 TC12 TC13 TC14
Header2 - HC21 HC22 HC23 HC24 HC25
Detail21 - DC211 DC212 DC213 DC214 DC215 DC216
Detail22 - DC221 DC222 DC223 DC224 DC225 DC226
Detail23 - DC231 DC232 DC233 DC234 DC235 DC236
Detail24 - DC241 DC242 DC243 DC244 DC245 DC246
Detail25 - DC251 DC252 DC253 DC254 DC255 DC256
Trailer2 - TC21 TC22 TC23 TC24
OUTPUT:
HC12 DC112 DC113 DC115
HC12 DC122 DC123 DC125
HC12 DC132 DC133 DC135
HC12 DC142 DC143 DC145
HC21 DC212 DC213 DC215
HC21 DC222 DC223 DC225
HC21 DC232 DC233 DC235
HC21 DC242 DC243 DC245
HC21 DC252 DC253 DC255

Please let me know how to accomplish this only using the SORT program.
Back to top
View user's profile Send private message

dick scherrer

Site Director


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

PostPosted: Tue Sep 04, 2007 10:34 pm    Post subject:
Reply with quote

Hello,

You need to elaborate on your "rules" that cause your posted input to become your posted output.

The requirement is completely clear to you, but it is not to others.

Also, please post the recfm and lrecl of your input and output files.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


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

PostPosted: Tue Sep 04, 2007 11:58 pm    Post subject:
Reply with quote

As Dick says, your requirement is completely unclear. We can't read your mind, so you have to explain what you want in detail.

You say
Quote:
The Header, Detail and Trailer records are linked to each other with a key.


But it's not clear which value in each example input record represents the key if any of them do. Please clarify that as well.

Are the HCxx and DCyyy values actual values in the record or do they represent something else (what?).

Also, give the starting position, length and format of the other relevant fields such as the Type field.
Back to top
View user's profile Send private message
srivatsantk

New User


Joined: 04 Sep 2007
Posts: 4
Location: USA

PostPosted: Wed Sep 05, 2007 1:00 am    Post subject:
Reply with quote

Sorry for the confusion.

The files used are PS files with LRECL 80

Let me explain my requirement with this example:

Header1 - H1C1 H1C2 H1C3 H1C4 H1C5
Detail11 - D11C1 D11C2 D11C3 D11C4 D11C5 D11C6
Detail12 - D12C1 D12C2 D12C3 D12C4 D12C5 D12C6
Detail13 - D13C1 D13C2 D13C3 D13C4 D13C5 D13C6
Detail14 - D14C1 D14C2 D14C3 D14C4 D14C5 D14C6
Trailer1- T1C1 T1C2 T1C3 T1C4
Header2 - H2C1 H2C2 H2C3 H2C4 H2C5
Detail21 - D21C1 D21C2 D21C3 D21C4 D21C5 D21C6
Detail22 - D22C1 D22C2 D22C3 D22C4 D22C5 D22C6
Detail23 - D23C1 D23C2 D23C3 D23C4 D23C5 D23C6
Detail24 - D24C1 D24C2 D24C3 D24C4 D24C5 D24C6
Detail25 - D25C1 D25C2 D25C3 D25C4 D25C5 D25C6
Trailer2 - T2C1 T2C2 T2C3 T2C4
OUTPUT:
H1C2 D11C2 D11C3 D11C5
H1C2 D12C2 D12C3 D12C5
H1C2 D13C2 D13C3 D13C5
H1C2 D14C2 D14C3 D14C5
H2C2 D21C2 D21C3 D21C5
H2C2 D22C2 D22C3 D22C5
H2C2 D23C2 D23C3 D23C5
H2C2 D24C2 D24C3 D24C5
H2C2 D25C2 D25C3 D25C5


As you can see from the above examples, I am considering 2 groups of records in the input file:
a: First Group starts from Header1 and ends at Trailer1 with 4 Detail Records
b: Second Group starts from Header2 and ends at trailer2 with 5 Detail records.

Please interpret H1C2 as follows:
H - Header Record
1 - First Header Record
C - Column in Header
2 - Second Column
So H1C2 points to the second column in the First Header Record.

Similarly D25C3 points to the third column in the Fifth Detail Record under the Second Header record.

The output file should be a combination of selective Header and Detail columns and the total number of rows in the output file should be equal to the number of Detail Rows. I have highlighted the colums in Dark Blue that need to be written to the output file. The starting positions and size of the hightlighted colums in the input file are as follows:

a. H*C2 --> 20 (Column Start Position)-->8 (Size in Bytes)
b. D**C2 --> 15 (Column Start Position)-->10 (Size in Bytes)
c. D**C3 --> 25 (Column Start Position)--> 5 (Size in Bytes)
d. D**C5 --> 36 (Column Start Position)--> 14 (Size in Bytes)

Please ignore the key values as I mentioned in my initial requirement.
Back to top
View user's profile Send private message
dick scherrer

Site Director


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

PostPosted: Wed Sep 05, 2007 1:21 am    Post subject:
Reply with quote

Hello,

What identifies a header record, a detail record, or a trailer record? (My guess is that the records do not contain "Header" or "Detail" or "Trailer".

It may help if you use values like the "real" data will contain rather than just the rec/col reference.
Back to top
View user's profile Send private message
srivatsantk

New User


Joined: 04 Sep 2007
Posts: 4
Location: USA

PostPosted: Wed Sep 05, 2007 1:48 am    Post subject:
Reply with quote

The H*C5 column identifies the header and its value is "1C"
The D**C6 column identifies the detail records and its value is "7C".
The T*C4 column identifies the trailer record and its value is "8C"

The Header and Detail records are connected by the Keys present in:
1. H*C3 --> 28 (Column Start Position)-->6 (Size in Bytes)
2. D**C4 --> 30 (Column Start Position)--> 6 (Size in Bytes)
3. T*C2 --> 10 (Column Start Position)-->6 (Size in Bytes)
Back to top
View user's profile Send private message
dick scherrer

Site Director


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

PostPosted: Wed Sep 05, 2007 2:17 am    Post subject:
Reply with quote

Ok.

Now, might you show some "real-like" data rather than the alphabet soup?
Back to top
View user's profile Send private message
srivatsantk

New User


Joined: 04 Sep 2007
Posts: 4
Location: USA

PostPosted: Wed Sep 05, 2007 2:44 am    Post subject:
Reply with quote

Hi, We are in the design phase and I dont have the actual data as of now..We wanted to see if it is feasible to accomplish the requirement just by using the sort pgm rather than writing a cobol program.
Back to top
View user's profile Send private message
dick scherrer

Site Director


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

PostPosted: Wed Sep 05, 2007 2:55 am    Post subject:
Reply with quote

Hello,

It probably is possible, but not until the requirement is completely defined and understood.

Quote:
I dont have the actual data as of now
Might some just be "contrived"? At this late stage, i would hope that the layouts are nearly finalized.

Until the actual format/content is known, it will be difficult (if even possible) implement in any manner (i.e. sort, cobol, etc.).
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


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

PostPosted: Wed Sep 05, 2007 5:30 am    Post subject:
Reply with quote

Quote:
The output file should be a combination of selective Header and Detail columns and the total number of rows in the output file should be equal to the number of Detail Rows. I have highlighted the colums in Dark Blue that need to be written to the output file.


How are the header and detail columns to be used selected? Are there rules you'll follow to select them? If so, what are they? Or are the columns to be selected indicated by another file or by parameters of some kind or what?

Quote:
Hi, We are in the design phase and I dont have the actual data as of now..We wanted to see if it is feasible to accomplish the requirement just by using the sort pgm rather than writing a cobol program.


Your description so far is too abstract and unclear for me to determine that.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts HALDB data refresh/copy from producti... vineetanand2007 IMS DB/DC 1 Mon Jan 02, 2017 11:16 am
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 am
No new posts syncsort: copy lines after the keyword shreya19 SYNCSORT 7 Fri Dec 02, 2016 9:47 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us