Page 1 of 1

Need to copy VSAM file using SORT

PostPosted: Sun Jul 06, 2008 6:48 pm
by b.praveen
I have a requirement like, I need to Copy data from VSAM file to seq file for the data Current date - 60 days. and sort that seq file based on item number.
Item number and current date are fields in the vsam file. I need to write this in JCL(No COBOL, no DB2 Query). The JCL runs weekly.

How can I write this condition using sort? Please help me

Re: Need to copy VSAM file using SORT

PostPosted: Sun Jul 06, 2008 10:04 pm
by dick scherrer
Hellp b.praveen and welcome to the forums,

Which sort product/release is used on your system? If you do not know, run any sort and post the spooled output from the sort - this will show which sort and which release of that sort product that you are using.

What have you tried so far? You should post some sample input, desired sample output from that input and the "processing rules" as well as what you have coded to accomplish this. You should also mention the lrecls of the files.

Scheduling should be dealt with your scheduling people.

Re: Need to copy VSAM file using SORT

PostPosted: Mon Jul 07, 2008 5:20 am
by b.praveen
Sample input
item# Retail Date
10004 20080401
10005 20080501
10006 20080601
10007 20080701

Output should be retail date = current date - 60 days

item# Retail Date
10006 20080601
10007 20080701

This is the sample code I used for retail date = current date
//SRT1 EXEC PGM=SORT
//SORTOUT DD DISP=(,CATLG,DELETE),DSN=TEST.DIST.SOURCED.D1009,
// UNIT=(3390,3),SPACE=(TRK,(10,100),RLSE),
// RECFM=FB,LRECL=157
//SORTIN DD DISP=SHR,DSN=DC.DIST.SOURCED.DALYBKUP.G2346V00
//SYSOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INCLUDE COND=(66,4,PD,EQ,'20080706')
/*

Re: Need to copy VSAM file using SORT

PostPosted: Mon Jul 07, 2008 6:39 am
by dick scherrer
Hello,

So Far , so good :)

Now, from earlier, please provide:
Which sort product/release is used on your system? If you do not know, run any sort and post the spooled output from the sort - this will show which sort and which release of that sort product that you are using.
This matters because DFSORT topics and Syncsort topics are handled in different parts of the forum.

Re: Need to copy VSAM file using SORT

PostPosted: Thu Jul 10, 2008 9:05 pm
by b.praveen
Sorry for the late reply, I was out of office, Today I ran SORT step to find the version number.
This is the version of SORT utility we are using in our company 'SYNCSORT FOR Z/OS 1.2.2.1R'

Re: Need to copy VSAM file using SORT

PostPosted: Mon Jul 21, 2008 8:51 pm
by Alissa Margulies
b.praveen wrote:Copy data from VSAM file to seq file for the data Current date - 60 days. and sort that seq file based on item number.

Based solely on your sample input data, if you have access to SyncSort for z/OS 1.3, you can code the following:

//SYSIN DD *                       
    SORT FIELDS=(1,5,CH,A)             
    INCLUDE COND=(7,8,CH,GE,&DATE1-60)
/*   

This will obviously need to be modified to correspond to your actual data fields.