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

Sort with varying inputs


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Vidya Bhama

New User


Joined: 17 Sep 2008
Posts: 41
Location: Chennai

PostPosted: Thu Jul 07, 2011 1:26 pm
Reply with quote

Hi,

I have the below scenario, Can anyone please help me with this,
I have 2 input files (with no duplicates) in the below format,

Code:

$$TEST      01 C AAAAAAAA
              03 00001000   
$$TEST      01 C ABBBBBBB
              03 00000000   
$$TEST      01 C ACCCCCCC
              03 00000000   
$$TEST      01 C AFFFFFFF
              03 00101000   
              04 11111111
$$TEST      01 C VVVVVVVV
              03 00101000   
              04 11111111
$$TEST      01 C XXXXXXXX
              03 00000000   


The number of records under the $$TEST record can vary.
Now, I have to compare both the files for $$TEST and the records below it with the 2nd file. Please note both the files are not in sorted order.

Kindly suggest.

Thanks
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Thu Jul 07, 2011 3:12 pm
Reply with quote

Quote:

Now, I have to compare both the files for $$TEST and the records below it with the 2nd file. Please note both the files are not in sorted order

Your requirement is rather vague...

What to do you mean by compare? Compare can be of many type\level..
Does order of internal records under $$TEST matters?
explain more..
show sample input files(BOTH)... and corresponding output you want... or do you want just specific return code if files dont match etc...You have to be bang on with your requirement to get good answer...

Also What is the DFSORT PTF level at your shop...
Back to top
View user's profile Send private message
Vidya Bhama

New User


Joined: 17 Sep 2008
Posts: 41
Location: Chennai

PostPosted: Thu Jul 07, 2011 3:42 pm
Reply with quote

Hi Sambhaji,

Both my files are of same format i mentioned as sample. i wanted to write all the matching records in File1 with File2 to a new file.

Both the files do not have any duplicates and are not in sorted order.

For eg:


Code:
 File 1

$$TEST      01 C  AAAA$AAA
                 03 00001000 
$$TEST      01 C VVVVVVVV
                 03 00101000   
                 04 11111111
$$TEST      01 C ASFGJHRSB
                 03 10001000   


File 2
$$TEST      01 C ABBBBBBB
                 03 00000000   
$$TEST      01 C AAAA$AAA
                 03 00001000   
$$TEST      01 C AFFFFFFF
                 03 00101000   
                 04 11111111
$$TEST      01 C XXXXXXXX
                 03 00000000
$$TEST      01 C ACCCCCCC
                 03 00000000   
$$TEST      01 C VVVVVVVV
                 03 00101000   
                 04 11111111

The Output File
$$TEST      01 C AAAA$AAA
                 03 00001000 
$$TEST      01 C VVVVVVVV
                 03 00101000   
                 04 11111111
 


Please let me know if the above is not clear.

Thanks
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Thu Jul 07, 2011 3:49 pm
Reply with quote

Code:

File 1

$$TEST      01 C VVVVVVVV
                 03 00101000   
                 04 11111111
$$TEST      01 C VVVVVXXX
                 03 00101000   

File 2
$$TEST      01 C VVVVVVVV
                 04 11111111
                 03 00101000   
$$TEST      01 C VVVVVXXX
                 04 00101000   


What should be output in this case? Is these case possible first of all?
Back to top
View user's profile Send private message
Vidya Bhama

New User


Joined: 17 Sep 2008
Posts: 41
Location: Chennai

PostPosted: Thu Jul 07, 2011 4:04 pm
Reply with quote

The case mentioned above is not possible, (i.e) 03 and 04 wil always be in order in both the files.

Output should be empty file.
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Thu Jul 07, 2011 5:40 pm
Reply with quote

What about second case? even that is not possible?
Code:
File 1

$$TEST      01 C VVVVVXXX
                 03 00101000   

File 2
 
$$TEST      01 C VVVVVXXX
                 04 00101000   
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: Thu Jul 07, 2011 10:34 pm
Reply with quote

Vidya,

You need a better example of input and expected output. Show us different variations of groups that are possible but DO NOT MATCH (Sambhaji has asked about one such example, but there are probably others).

Give the RECFM and LRECL of each input file. Give the starting position, length and format of each relevant field.

Are you comparing on the entire record, or on some part of the record (which part)?
Back to top
View user's profile Send private message
Vidya Bhama

New User


Joined: 17 Sep 2008
Posts: 41
Location: Chennai

PostPosted: Tue Jul 12, 2011 1:17 pm
Reply with quote

Hi,
Sorry for the delayed reply.

Sambhaji,
Yes the second case might be possible.
Frank,
The original requirement is as below,
The entries in the File1 (displayed below)
Code:

$$TEST      01 C VVVVVXXX

should be first checked in the File2. If present then the records below it must be checked if same in both files.
Code:

                 03 00101000

If yes then you have to write the above 2 lines from File1 onto a new file.
I hope its clearer now.

Thanks
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 577
Location: USA

PostPosted: Tue Jul 12, 2011 6:36 pm
Reply with quote

Vidya Bhama,
What is the LRECL and RECFM? Are you comparing only key fields or entire record?

Thanks,
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: Tue Jul 12, 2011 11:20 pm
Reply with quote

Quote:
I hope its clearer now


Why would it be? You didn't actually answer any of my questions or show the example I asked for.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Jul 13, 2011 4:57 am
Reply with quote

Vidya,

You have a dataset containing groups of records defined as starting with record $$TEST and including all the records before the next $$TEST (or end-of-file).

You have a second dataset grouped in a similar manner to the first.

For each group on the first dataset you need to search the second dataset for a full match, including the order and number of records, of the entire group. For each full match encountered, write the entire group to the output file.

Any and all other groupings fail the match test.

Is that about it?

Also, you will need to review the previous replies and ensure that you answer all the questions. No-one is going to go counting characters for you.
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
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 JCL sort card - get first day and las... JCL & VSAM 9
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
Search our Forums:

Back to Top