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
 

 

how to split a file into two files based on a date

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

New User


Joined: 21 Dec 2005
Posts: 7

PostPosted: Tue Feb 14, 2006 3:40 pm    Post subject: how to split a file into two files based on a date
Reply with quote

hi ,

i have a file which has to be split into two files based on a date which is in the format 'mm-dd-yyyy' .. how can i do it??

sree
Back to top
View user's profile Send private message

rajandhla

Active User


Joined: 18 Oct 2005
Posts: 182
Location: Luton UK

PostPosted: Tue Feb 14, 2006 5:36 pm    Post subject: Re: how to split a file into two files based on a date
Reply with quote

can you pls give the details like ,
one file contains the records which matches the given date (date is current date/?) and
the other file contains the records that doesn't match the date.

please let know the exact details


regards,
jai
Back to top
View user's profile Send private message
sreenatha

New User


Joined: 21 Dec 2005
Posts: 7

PostPosted: Tue Feb 14, 2006 8:48 pm    Post subject: Re: how to split a file into two files based on a date
Reply with quote

suppose the contents are as follows in the input file

details date

detail 1 02-12-2006
detail 2 02-01-2006
detail 3 12-10-2005
detail 4 01-04-2006
detail 5 05-02-2005

my requirement is as follows;

all the records which are having date greater than (current date - 3 months) must be seperated from other records


the output will be as fllows ;

detail date

detail 1 02-12-2006
detail 2 02-01-2006
detail 4 01-04-2006

other file should have the remaining records
Back to top
View user's profile Send private message
superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4648
Location: Raleigh, NC, USA

PostPosted: Tue Feb 14, 2006 8:57 pm    Post subject: Re: how to split a file into two files based on a date
Reply with quote

I do know enough about DFSORT to know that you will have to provide the value for (current date - 3 months) as a symbolic to DFSORT program via the SYMNAMES DD statement. Will that be possible?
Back to top
View user's profile Send private message
rajandhla

Active User


Joined: 18 Oct 2005
Posts: 182
Location: Luton UK

PostPosted: Tue Feb 14, 2006 8:58 pm    Post subject:
Reply with quote

Hope this link helps.(in this post trying to include the records between the date ranges but your requirement requires omit and include).

http://ibmmainframes.com/viewtopic.php?t=7537

regards,
jai
Back to top
View user's profile Send private message
pzmohanty

New User


Joined: 17 Feb 2006
Posts: 1
Location: Hyderabad

PostPosted: Fri Feb 17, 2006 1:35 am    Post subject:
Reply with quote

Hi,

Hope this code will solve ur problem


Code:
//*******************************************************
//STEP0010 EXEC PGM=IKJEFT01,DYNAMNBR=20,COND=(4,LT)     
//*******************************************************       
//STEPLIB  DD  DSN=XXX.YYY.ZZZ,DISP=SHR       
//SYSTSIN  DD  *                                         
  DSN SYSTEM(XXX)                                       
  RUN PROGRAM(DSNTIAUL) PLAN(DSNTIAUL) PARMS('SQL') -   
      LIB ('AAA.BBB.CCC')                 
  END                                                   
/*                                                       
//SYSIN    DD  *                                         
 SELECT CHAR('CUTOFFDATE'),                             
        CHAR(','''),                                     
        SUBSTR(CHAR(CURRENT DATE - 3 MONTHS),7,4) ,     
        SUBSTR(CHAR(CURRENT DATE - 3 MONTHS),1,2) ,           
        SUBSTR(CHAR(CURRENT DATE - 3 MONTHS),4,2) ,           
        CHAR('''') ,                                         
        CHAR(' ',59)                                         
   FROM SYSIBM.SYSDUMMY1;                                     
/*                                                           
//SYSREC00 DD  DSN=&T1,         
//             DISP=(,PASS),                         
//             UNIT=SYSDA,                                   
//             SPACE=(CYL,(250,250),RLSE)                     
//SYSPUNCH DD  DUMMY                                         
//SYSTSPRT DD SYSOUT=*                                       
//SYSPRINT DD SYSOUT=*                                       
//SYSUDUMP DD SYSOUT=*                                       
//*******************************************************
//STEP0200 EXEC PGM=SORT                                     
//*******************************************************
//SYMNAMES DD DSN=&T1,DISP=SHR 
//SYSOUT   DD SYSOUT=*                                       
//SORTIN   DD DSN=DATASET.NAME.INPUT,         
//            DISP=SHR                                       
//SORTOF1  DD DSN=OUTPUT.DATASET.NAME1,               
//         DISP=(NEW,CATLG,DELETE),                               
//         UNIT=SYSDA,SPACE=(CYL,(10,10),RLSE),                   
//         DCB=(LRECL=600,RECFM=FB,BLKSIZE=0)                     
//SORTOF2  DD DSN=OUTPUT.DATASET.NAME2,   
//         DISP=(NEW,CATLG,DELETE),                               
//         UNIT=SYSDA,SPACE=(CYL,(10,10),RLSE),                   
//         DCB=(LRECL=600,RECFM=FB,BLKSIZE=0)                     
//SYSIN    DD *                                                   
  SORT FIELDS=COPY                                                 
  INREC FIELDS=(1,600,210,4,204,2,207,2)                           
  OUTFIL FILES=1,INCLUDE=(601,08,CH,GE,CUTOFFDATE),OUTREC=(1,600) 
  OUTFIL FILES=2,SAVE,OUTREC=(1,600)                               
/*                                                                 
//*   


This JCL has 2 steps ,
in Step 1 , we are creating a dataset containg 1 record with following data :
CUTOFFDATE,'CCYYMMDD'

The step 2 is a sort step which uses the dataset created in step 1 as SYMNAMES DD & in SORT card , CUTOFFDATE is replaced by value in the dataset created in STEP 1.
Back to top
View user's profile Send private message
rajandhla

Active User


Joined: 18 Oct 2005
Posts: 182
Location: Luton UK

PostPosted: Fri Feb 17, 2006 4:01 pm    Post subject:
Reply with quote

Hi Mohanthy,

Thanks it helps alot, but before i would like to clarify a question

Suppose in the temp file the record looks as
Cutoffdate , '20051105' that temp file is used in the step0200 with the dd name sysnames.

My question is when i use cutoffdate in the sort control card, will it treat as symbol name or will it take what ever the value that come after cutoffdate that start and end with codes(replaced) in the record in the temp file available at dd name sysnames.
is the sysnames is the predefined dd name.

please clarify

jai
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: Fri Feb 17, 2006 9:34 pm    Post subject:
Reply with quote

SYMNAMES (not sysnames) is the ddname used for DFSORT Symbol statements. The Symbol statement:

CUTOFFDATE,'20051105'

tells DFSORT to substitute C'20051105' for CUTOFFDATE wherever CUTOFFDATE is found in DFSORT or ICETOOL control statements.

DFSORT changes:

INCLUDE=(601,08,CH,GE,CUTOFFDATE)

to

INCLUDE=(601,08,CH,GE,C'20051105')

Since the job creates the CUTOFFDATE statement dynamically using the current date, the constant in the CUTOFFDATE statement will change each day.

For complete information on DFSORT Symbols, see Chapter 7 in "z/OS DFSORT Application Programming Guide":

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CA10/7.0?DT=20050222160456

If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

www.ibm.com/servers/storage/support/software/sort/mvs/srtmpub.html
Back to top
View user's profile Send private message
rajandhla

Active User


Joined: 18 Oct 2005
Posts: 182
Location: Luton UK

PostPosted: Fri Feb 17, 2006 11:01 pm    Post subject:
Reply with quote

Thanks Frank for the clarification.
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 Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts Validate date and numeric fields and ... Rick Silvers DFSORT/ICETOOL 6 Thu May 11, 2017 6:51 pm
No new posts Unable to create multiple files using... mbattu COBOL Programming 3 Fri May 05, 2017 5:35 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm


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