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

Comparing two files of variable length


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

New User


Joined: 16 Aug 2005
Posts: 4

PostPosted: Fri Apr 16, 2010 6:11 pm
Reply with quote

Hi,

I have two files.
Ist file has record length as 512
2nd file has record length as 323

The first file has START DATE and END DATE ,starting at pos (33,16)
The second file also has DATE starting at pos (16,8).

I need all the records from the second file ,if its DATE is falling between
START DATE and END DATE of first file.
i.e START DATE<= DATE in second file<=END DATE.
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 577
Location: USA

PostPosted: Fri Apr 16, 2010 7:58 pm
Reply with quote

What is your current DFSort PTF level.

If you are unsure, please submit below job and give us informational message.

Code:
//SORTSTEP EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SORTIN   DD *
ABC
//SORTOUT  DD SYSOUT=*
//SYSIN    DD *
  SORT     FIELDS=COPY


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: Fri Apr 16, 2010 10:04 pm
Reply with quote

manjulaa,

What is the RECFM and LRECL of each input file?

Show an example of the records in each input file and what you expect for output. If there can be duplicates within file1, show that in the example. If there can be duplicates within file2, show that in the example.
Back to top
View user's profile Send private message
manjulaa

New User


Joined: 16 Aug 2005
Posts: 4

PostPosted: Tue Apr 20, 2010 6:13 pm
Reply with quote

Hi Frank,

Thank you very much for your reply..please see the details of the requirement below,

Both the files are of FB format and LRECL of first file is 512 and that of second file is 323

In the first file the dates are in the form of 9's compliment form.

i.e The date in first file is = 99999999-(date in yyyy-mm-dd format).

eq:if the date is 20070707 ,then in the file it is written as 79929292.

In the first file, there will be only one record and the START DATE and END DATE is

starting at POS 33-48(16 lengthand both are of 9's compliment form).Layout is as shown below.

----+----1----+----2----+----3----+----4----+----5---

xxxxxxxxxxxxxxx yyyyyyy G 7989978279899685
In the second file the date is present as COMP-3 format of 9's compliment of the date,and it can have duplicates w.r.t

dates also.It is starting at Pos 24.( PIC 9(08) COMP-3).

The layout is shown below,

----+----1----+----2----+----3----+----4----+----5--------
mmm nnnnnnnn qrÇ| ssssss15-MAR-201008z
mmm nnnnnnnn qrÇ| ssssss15-MAR-201008z
mmm nnnnnnnn qrÇ| ssssss15-MAR-201008z

The condition needs to be checked is(since the dates are in 9's compliment form)

START DATE in first file > DATE in second file is >END DATE in first file.


then I need all the records from the second file ,which satisfies this criteria(duplicates also if presents.)

Also the files layout is attached here with.

Once again thanks a lot for your help.....


The attachment was deleted (again), please read your mail and post the screen shot using cut and paste.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue Apr 20, 2010 6:54 pm
Reply with quote

Quote:
the dates are in the form of 9's compliment form.


what is the benefit of this?
This is a serious question and will implement if good reasoning exists.
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 577
Location: USA

PostPosted: Tue Apr 20, 2010 6:58 pm
Reply with quote

manjulaa


I would leave final decision on Admin but I think you should remove the attachment from your post. You forgot to remove your company's name at the left bottom corner and also by forum rules, I don't think you are allowed to attach documents in the post.


Copyright
You should not use our forums to post/attach/link any material which is knowingly false and/or defamatory, inaccurate, sexually oriented, abusive, harassing or threatening, contains viruses or other contaminating or destructive features, violates the rights of others, such as Content which infringes any copyright, trademark, patent, trade secret or violates any right of privacy or publicity, or otherwise violates any applicable law.. Feel free to ask the moderators before posting the downloaded materials from other sites.

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 Apr 20, 2010 11:17 pm
Reply with quote

manjulaa,

Here's a DFSORT job that will do what I think you want.

Code:

//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=...  input file1 (FB/512)
//SORTOUT DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN DD *
  OPTION COPY
  OUTFIL BUILD=(C'STARTDATE,+',33,8,80:X,/,
                C'ENDDATE,+',41,8)
/*
//S2 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SORTIN DD DSN=...  input file2 (FB/323)
//SORTOUT DD DSN=...  output file (FB/323)
//SYSIN DD *
  OPTION COPY
  INCLUDE COND=(24,5,PD,LE,STARTDATE,AND,
                24,5,PD,GE,ENDDATE)
/*


For example if your input file2 had the following PD values starting in 24:

78888888
80000000
79899782
79899685
79899700

The 3rd, 4th and 5th records would be kept since they are between 79899782 and 79899685. I assumed equal to was included in "between" but you can change the INCLUDE statement to whatever you need.
Back to top
View user's profile Send private message
manjulaa

New User


Joined: 16 Aug 2005
Posts: 4

PostPosted: Wed Apr 21, 2010 12:59 pm
Reply with quote

Hi Frank, Thanks a lot for ur help :-)
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 Compare 2 files and retrive records f... DFSORT/ICETOOL 3
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 How to split large record length file... DFSORT/ICETOOL 10
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
Search our Forums:

Back to Top