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

Process data prior to current day


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

New User


Joined: 26 Apr 2010
Posts: 9
Location: chennai

PostPosted: Wed Jun 01, 2011 5:49 pm
Reply with quote

Hi,
I need to process the data in input file which is prior to current day to output file.

My requirements are:
If the day is "MON", I need to process the data from friday to saturday.
If the day is other than "MON",I need to process the data prior to the current day.

The input file has the below fields having the LRECL of 30
Name(10)
Entry date(10)
Exit date(10)

Now I need to process the previous day data by comparing with the entry date. If it is "MON" and current date is 06-6-2011, then records which have the entry date 06-3-2011, 06-4-2011 and 06-5-2011 are to be processed.

If it is not equal "MON" and current date is 06-7-2011,then records which have the entry date 06-6-2011 are to be processed.

Input file should get filtered with the above conditions and written to output file having an LRECL of 30.

Thanks,
Haritha.
Back to top
View user's profile Send private message
Phrzby Phil

Senior Member


Joined: 31 Oct 2006
Posts: 1042
Location: Richmond, Virginia

PostPosted: Wed Jun 01, 2011 6:12 pm
Reply with quote

Very interesting. Thanks for letting us know what you are currently working on.

To whom should we send the invoice?
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 577
Location: USA

PostPosted: Wed Jun 01, 2011 7:25 pm
Reply with quote

sreeharithagm
Please provide sample input and expected output. Do you want to write rejected/omitted records to different file or just skip them?

Quote:
If it is "MON" and current date is 06-6-2011, then records which have the entry date 06-3-2011, 06-4-2011 and 06-5-2011 are to be processed.
In this case do you always want to go back 3 days and filter records? Just to clarify, in the case above, you do want to omit records with entry date of 06-6-2011. Please confirm.

Also, is this post related to ibmmainframes.com/viewtopic.php?t=54742?

Thanks,
Back to top
View user's profile Send private message
sreeharithag

New User


Joined: 26 Apr 2010
Posts: 9
Location: chennai

PostPosted: Thu Jun 02, 2011 6:21 pm
Reply with quote

Hi,
I have tried using this below sort card but it is getting failed with
NO KEYWORDS FOUND ON CONTROL STATEMENT.

Code:

//STEP010 EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SYMNAMES DD *
CUR_DAY,S'&WDAY'
/*
//SORTIN   DD DSN=INPUT,DISP=SHR
//SORTOUT  DD DSN=OUTPUT,
//            DISP=(,CATLG,CATLG),
//            UNIT=SYSTA,
//            SPACE=(CYL,(50,25),RLSE)
//SYSIN    DD *
    SORT FIELDS=COPY
    INREC FIELDS=(01:001,08,
                   09:09,26,
                   35:35,3,
                   40:CUR_DAY)
  OUTREC IFTHEN=(WHEN(40,3,CH,EQ,C'MON',AND,09,26,CH,GE,DATE4-3,
                   AND,09,26,CH,LE,DATE4),BUILD=(01:01,37))
           IFTHEN=(WHEN=(40,3,CH,NE,C'MON',AND,09,26,CH,LE,DATE4,
                   AND,09,26,CH,GE,DATE4-1),BUILD=(01:01,37))
/*
Please suggest how to resolve this.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Thu Jun 02, 2011 6:29 pm
Reply with quote

Quote:
Please suggest how to resolve this.
First, you need to repost your JCL using the Code button to preserve the exact spacing of your JCL. Since you did not do so, it appears that your SORT control statements start in column 1, which is not allowed. Hence, based on what you've posted it does not appear your syntax for the SORT control statements is correct.

Also, you need to post a few lines of SORT output so we can know which SORT product you are using.
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 577
Location: USA

PostPosted: Thu Jun 02, 2011 7:28 pm
Reply with quote

sreeharithag,
Please provide sample input and expected output.

The INREC definition doesn't match with original layout you had provided. In the sort card, you are using 26 byte timestamp but in the original post you mentioned its a 10 byte date field (Entry date).

Thanks,
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Jun 02, 2011 10:26 pm
Reply with quote

sreeharithag,

If I understand your requirement correctly, all you want to do is process friday thru monday records if the day of the week is monday and if it any other day you want to process the prior day records. If that is the case then you can use the following DFSORT JCL which will give you the desired results.

If you want to compare 26 byte timestamp field then you need to use DATE5 keyword instead of DATE4

Code:

//STEP0100 EXEC PGM=SORT                                         
//SYSOUT   DD SYSOUT=*                                           
//SYMNAMES DD *                                                   
WKDAY,S'&WDAY'                                                   
//SORTIN   DD *                                                   
TUE     2011-05-31-11.35.31.697219AAA                             
WED     2011-06-01-11.35.31.697219BBB                             
THU     2011-06-02-11.35.31.697219CCC                             
FRI     2011-06-03-11.35.31.697219DDD                             
SAT     2011-06-04-11.35.31.697219EEE                             
SUN     2011-06-05-11.35.31.697219FFF                             
MON     2011-06-06-11.35.31.697219GGG                             
//SORTOUT  DD SYSOUT=*                                           
//SYSIN    DD *                                                   
  SORT FIELDS=COPY                                               
  OUTREC IFTHEN=(WHEN=INIT,OVERLAY=(38:WKDAY,DATE5,DATE5)),       
  IFTHEN=(WHEN=(38,3,CH,EQ,C'MON'),OVERLAY=(41:DATE1(-)-3)),     
  IFTHEN=(WHEN=NONE,OVERLAY=(41:DATE1(-)-1))                     

  OUTFIL BUILD=(1,37),                                           
  INCLUDE=((9,26,CH,GE,41,26,CH),AND,(9,26,CH,LE,67,26,CH))       
//*
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 Data set Rec-Cnt and Byte-Cnt Testing & Performance 2
No new posts SCOPE PENDING option -check data DB2 2
No new posts To get the the current time DFSORT/ICETOOL 13
No new posts Check data with Exception Table DB2 0
No new posts JCL EXEC PARM data in C Java & MQSeries 2
Search our Forums:

Back to Top