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

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


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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
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 Developer


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

PostPosted: Mon Oct 08, 2007 10:54 pm
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
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 Developer


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

PostPosted: Tue Oct 09, 2007 8:18 pm
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top