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
 

 

Sort with varying inputs

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Sort with varying inputs
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    Post subject:
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    Post subject: Reply to: Sort with varying inputs
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    Post subject:
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    Post subject:
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    Post subject:
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 Moderator


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

PostPosted: Thu Jul 07, 2011 10:34 pm    Post subject:
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    Post subject:
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: 578
Location: USA

PostPosted: Tue Jul 12, 2011 6:36 pm    Post subject:
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 Moderator


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

PostPosted: Tue Jul 12, 2011 11:20 pm    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7225

PostPosted: Wed Jul 13, 2011 4:57 am    Post subject: Reply to: Sort with varying inputs
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    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 Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts SQZ pipe delimited file with 1 column... Rick Silvers DFSORT/ICETOOL 2 Sun Nov 06, 2016 8:11 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts How to delete second instance from Fl... Gunapala CN DFSORT/ICETOOL 6 Tue Oct 18, 2016 11:42 pm


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