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

Check if header date is eq current date (MM/DD/YYYY)


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
srajendran2

New User


Joined: 13 May 2008
Posts: 56
Location: Chennai

PostPosted: Tue Jun 18, 2013 8:28 pm
Reply with quote

Hi,

I have a requirement to check if the header date is equivalent to current date. if it is not the rest of the processing should be skipped. The header date format is MM/DD/YYYY. I tried to use the format MD4/ in INCLUDE COND, but it did not work.
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1787
Location: Bloomington, IL

PostPosted: Tue Jun 18, 2013 8:35 pm
Reply with quote

How did it not work?
Back to top
View user's profile Send private message
srajendran2

New User


Joined: 13 May 2008
Posts: 56
Location: Chennai

PostPosted: Tue Jun 18, 2013 8:46 pm
Reply with quote

There is an error in the syntax. I think i have wrongly used the MD4 condition in the INCLUDE COND. PLease find below the code and error.

Code:

   SORT FIELDS=COPY                     
   INCLUDE COND=(1,10,CH,EQ,DT=(MD4/)) 


Code:

SYSIN :                                             
  SORT FIELDS=COPY                                   
  INCLUDE COND=(1,10,CH,EQ,DT=(MD4/))               
                           *                         
WER268A  INCLUDE STATEMENT : SYNTAX ERROR           
WER211B  SYNCSMF  CALLED BY SYNCSORT; RC=0000       
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Tue Jun 18, 2013 8:47 pm
Reply with quote

Please paste your code and input and also let us know your sort product
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Tue Jun 18, 2013 8:54 pm
Reply with quote

1.DT should be DATE
2.Please check if SYNCSORT supports DATE=(MD4/)
3.Syncosrt queries should be asked in JCL forum
4.Even if syncsort support ,to make it work you first need to overlay then try to filter that using include
Back to top
View user's profile Send private message
srajendran2

New User


Joined: 13 May 2008
Posts: 56
Location: Chennai

PostPosted: Tue Jun 18, 2013 9:05 pm
Reply with quote

The product is

SYNCSORT FOR Z/OS 1.3.2.1R

jcl is

Code:
                 
//*                                                         
//SORT     EXEC PGM=SORT                                   
//SORTIN   DD DISP=SHR,DSN=TSTH.AAAAAA.REXX.INPUT           
//SYSOUT   DD SYSOUT=*                                     
//SORTOUT  DD DSN=TSTH.DFSORT.OUTP,                         
//             DISP=(NEW,CATLG),                           
//             UNIT=SYSDA,                                 
//             SPACE=(CYL,(400,400),RLSE)                   
//SYSIN DD *                                               
  SORT FIELDS=COPY                                         
  INCLUDE COND=(1,10,CH,EQ,DATE=(MD4/))                     
/*                                                         


Input is
05/31/2013
05/31/2013,BBBB,1,0.000000000,
05/31/2013,CCCC,3,0.000000000,
05/31/2013,DDDD,1,0.000000000,
05/31/2013,AAAA,4,0.000000000,
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Tue Jun 18, 2013 9:16 pm
Reply with quote

and the expected output is?
Back to top
View user's profile Send private message
srajendran2

New User


Joined: 13 May 2008
Posts: 56
Location: Chennai

PostPosted: Tue Jun 18, 2013 9:18 pm
Reply with quote

i expect the header record to be copied to the output file if the current date is equal to header date (MM/DD/YYYY)
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Tue Jun 18, 2013 9:22 pm
Reply with quote

You expect to copy only the header record or even the detail records when the header record date is equal to current date?
Back to top
View user's profile Send private message
srajendran2

New User


Joined: 13 May 2008
Posts: 56
Location: Chennai

PostPosted: Tue Jun 18, 2013 9:28 pm
Reply with quote

Just the header
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Tue Jun 18, 2013 9:49 pm
Reply with quote

Quote:
4.Even if syncsort support ,to make it work you first need to overlay then try to filter that using include
Back to top
View user's profile Send private message
bodatrinadh

Active User


Joined: 05 Jan 2007
Posts: 101
Location: chennai (India)

PostPosted: Wed Jun 19, 2013 12:57 pm
Reply with quote

Hi Rajendran,

Try this code...

Assuming LRECL=80 and RECFM=FB.

Code:

//STEP1    EXEC  PGM=SORT                                         
//SORTIN   DD  *                                                 
06/19/2013                                                       
06/19/2013,BBBB,1,0.000000000,                                   
06/19/2013,CCCC,3,0.000000000,                                   
06/19/2013,DDDD,1,0.000000000,                                   
06/19/2013,AAAA,4,0.000000000                                     
//SORTOUT  DD  SYSOUT=*                                           
//SYSPRINT DD  SYSOUT=*                                           
//SYSOUT   DD  SYSOUT=*                                           
//SYSIN     DD *                                                 
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,4,ZD)),             
        IFTHEN=(WHEN=(81,04,ZD,EQ,+1),OVERLAY=(51:7,4,1,2,4,2))   
  SORT FIELDS=COPY                                               
  OUTFIL OUTREC=(1,10,72X),INCLUDE=(51,08,CH,EQ,&DATE1)           


Output -

Code:

06/19/2013


Thanks
-3nadh
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Wed Jun 19, 2013 4:42 pm
Reply with quote

srajendran2,

Since you just need to validate just the first record alone, you may skip the rest of the records and check the first record as below.
Code:
//SYSIN    DD  *                                     
 OPTION COPY,STOPAFT=1                               
 INREC OVERLAY=(81:1,2,4,2,9,2)                     
 OUTFIL INCLUDE=(81,6,Y2W,EQ,Y'DATE1'),BUILD=(1,80) 
/*     
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Thu Jun 20, 2013 5:42 am
Reply with quote

Hi,

you may also want to set a different return code if there are no matches

Code:
//FILEOUT  DD SYSOUT=*                                         
//SYSIN    DD  *                                               
  OPTION COPY,STOPAFT=1                                         
  INREC OVERLAY=(81:1,2,4,2,9,2)                               
  OUTFIL FNAMES=FILEOUT,INCLUDE=(81,6,Y2W,EQ,Y'DATE1'),         
         BUILD=(1,80),NULLOFL=RC4                               



Gerry
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts SORT on detail record, then repeat he... DFSORT/ICETOOL 3
No new posts Date format correction using dfsort DFSORT/ICETOOL 3
No new posts Sorting Date Field DFSORT/ICETOOL 4
No new posts CONVERT a given date from UTC TO BST CICS 0
No new posts Pull data using date difference betwe... DB2 6
Search our Forums:

Back to Top