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
 

 

Compare Dates from a VSAM file with a non-VSAM file.

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

New User


Joined: 08 Oct 2007
Posts: 27
Location: Dallas, TX

PostPosted: Mon Oct 08, 2007 10:23 am    Post subject: Compare Dates from a VSAM file with a non-VSAM file.
Reply with quote

Hi,

I have a requirement to compare dates from 2 Input files and write the matching records to a output file. Please find the description of files below:

Input files:
-------------
1. VSAM file with date field defined as S9(08) COMP-3. For example the date will look like X'020070912F'.

2. a Non-VSAM file with date field as X(8). For example the date will look like 09/12/07. THIS FILE HAS ONLY ONE RECORD WHICH HAS THE DATES.

Output file:
-------------
1. A Non-VSAM file having the records with dates matching from Input 1 and input 2.

Currently I have a written a COBOL program to get this done. Is there a way to do the same using SORT or ICETOOL?. If so please let me know.

Thanks in Advance,
Bharath
Back to top
View user's profile Send private message

bharath_gct2002

New User


Joined: 08 Oct 2007
Posts: 27
Location: Dallas, TX

PostPosted: Mon Oct 08, 2007 2:48 pm    Post subject: Reply to: Compare Dates from a VSAM file with a non-VSAM fil
Reply with quote

I also have another requirement with this.

In the above requirement I said I will be using a VSAM file (RECL of 304) and a Non VSAM input files (RECL of 80) to create a non VSAM output file (RECL of 160). If the input criteria matches I take a part of input VSAM file (a length of 160) and put it in the Output file.

The output file will be of the format like:
1-----....-----80 81----..........----160
------------------------------------------
1111.....11111 aaaa..........aaaaaa
2222.....22222 cccc............cccccc
2222.....22222 bbbb..........bbbbbb
1111.....11111 dddd..........dddddd


I should Sort this output file with the first 80 bytes and then with the next 80 bytes.

So after sorting I will get a sorted file like this:
1-----....-----80 81----..........----160
-----------------------------------------
1111.....11111 aaaa..........aaaaaa
1111.....11111 dddd..........dddddd
2222.....22222 bbbb..........bbbbbb
2222.....22222 ccccc...........cccccc

From this sorted file I should create a Master Output file (RECL of 80) which has no repetitions in the first 80 bytes. For example the Master output will look like:

1-----....----80
-----------------
1111.....11111
aaaa.....aaaaa
dddd.....ddddd
2222.....22222
bbbb.....bbbbb
ccccc....cccccc

Is it possible to do all the things in the same SORT or I should I have seperate sorts for each step i.e.

1. Creating a 160 byte file.
2. Sorting the 160 byte file.
3. Creating a Master output file (80 byte).

Thanks in Advance,
Bharath
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: Mon Oct 08, 2007 10:54 pm    Post subject:
Reply with quote

Here's a DFSORT job that will do what I think you asked for. I assumed your 5-byte PD date field in the VSAM file starts at position 161. If not change the INCLUDE statement appropriately.

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file2 (non-VSAM, FB/80)
//SORTOUT DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN    DD    *
  OPTION COPY
  INREC BUILD=(C'Target,20',7,2,1,2,4,2,80:X)
/*
//S2    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SORTIN DD DSN=...  input file1 (VSAM, F/304)
//SORTOUT DD DSN=...  output file (non-VSAM, FB/80)
//SYSIN    DD    *
  RECORD TYPE=F
  INCLUDE COND=(161,5,PD,EQ,Target)
  INREC BUILD=(1,160)
  SORT FIELDS=(1,160,CH,A)
  OUTFIL IFTHEN=(WHEN=INIT,
          OVERLAY=(161:SEQNUM,8,ZD,RESTART=(1,80))),
         IFTHEN=(WHEN=(161,8,ZD,EQ,+1),
          BUILD=(1,80,/,81,80)),
         IFTHEN=(WHEN=NONE,BUILD=(81,80))
/*
Back to top
View user's profile Send private message
bharath_gct2002

New User


Joined: 08 Oct 2007
Posts: 27
Location: Dallas, TX

PostPosted: Tue Oct 09, 2007 10:50 am    Post subject:
Reply with quote

Thanks Frank.
It was absolutely what I required.

I have a small doubt here!.
In my previous post , I said:

I should Sort this output file with the first 80 bytes and then with the next 80 bytes.

So after sorting I will get a sorted file like this:
1-----....-----80 81----..........----160
-----------------------------------------
1111.....11111 aaaa..........aaaaaa
1111.....11111 dddd..........dddddd
2222.....22222 bbbb..........bbbbbb
2222.....22222 ccccc...........cccccc


But I could see
SORT FIELDS=(1,160,CH,A)
in the above code you gave.

Should I have to change it to
SORT FIELDS=(1,80,CH,A,81,80,CH,A)

Please advise.

Also is there anyway for me to find what is happening during the SORT, like what is the content of the intermediate file and what is the flow of the SORT?. Are there any tools like XPEDITOR to see this. Please let me know.

Thanks once again Frank.
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 Oct 09, 2007 8:18 pm    Post subject:
Reply with quote

Since the first 80 bytes and next 80 bytes are contiguous

Code:

   SORT FIELDS=(1,160,CH,A)


and

Code:

   SORT FIELDS=(1,80,CH,A,81,80,CH,A)


are equivalent. You can specify it either way and get the same results.

Quote:
Also is there anyway for me to find what is happening during the SORT, like what is the content of the intermediate file and what is the flow of the SORT?. Are there any tools like XPEDITOR to see this. Please let me know.


I don't know what you're looking for here or why you need it. DFSORT's internal algorithms are proprietary. The actual contents of the work files would not be meaningful to you.
Back to top
View user's profile Send private message
bharath_gct2002

New User


Joined: 08 Oct 2007
Posts: 27
Location: Dallas, TX

PostPosted: Wed Oct 10, 2007 8:27 am    Post subject:
Reply with quote

Thanka again Frank
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 Storing huge volume of data, compare ... Pradeep K M All Other Mainframe Topics 3 Mon Jan 16, 2017 5:08 pm
No new posts how to recover an uncataloged VSAM da... archanamuthukrishnan All Other Mainframe Topics 3 Wed Jan 11, 2017 6:18 pm
No new posts Underlying DB2 VSAM LDS - SMF recording vasanthz All Other Mainframe Topics 6 Thu Jan 05, 2017 4:20 am
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm


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