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

REAL TIME DATA MANIPULATION


IBM Mainframe Forums -> SYNCSORT
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
techslam

New User


Joined: 03 Dec 2010
Posts: 87
Location: India

PostPosted: Mon Dec 01, 2014 6:51 pm
Reply with quote

Hi,
I have below SQL in my sort input file -

Code:

SELECT *
FROM XYZ.TABLE1
WHERE EFFECTIVE_DATE = 'DD.MM.YYYY'
AND END_DATE = 'DD.MM.YYYY'


I want to run a SYNCSORT job and get an output file with date changed to previous months day 1 as shown below

Code:

SELECT *
FROM XYZ.TABLE1
WHERE EFFECTIVE_DATE = '01.11.2014'
AND END_DATE = '30.11.2014'


Can someone pleae help me with this.

Thanks for all the help.
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


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

PostPosted: Tue Dec 02, 2014 11:44 am
Reply with quote

Check on SYMNAMES
Back to top
View user's profile Send private message
JAYACHANDRAN THAMPY

New User


Joined: 06 Jun 2006
Posts: 8

PostPosted: Thu Dec 04, 2014 7:51 pm
Reply with quote

Which version of Syncsort you are using?. If you are using Syncsort v1.4, you can try the below JCL. Apart from sort, you can use simple Rexx,Filemanager etc to achieve the same.

Code:
//STEP010  EXEC PGM=SORT                                         
//SYSOUT   DD SYSOUT=*                                           
//SORTIN   DD *                                                 
SELECT *                                                         
FROM XYZ.TABLE1                                                 
WHERE EFFECTIVE_DATE = 'DD.MM.YYYY'                             
AND END_DATE = 'DD.MM.YYYY'                                     
//SORTOUT  DD SYSOUT=*                                           
//SYSIN    DD *                                                 
 SORT FIELDS=COPY                                               
 INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:DATE(DM4.),81:C'01',       
                81:DATEADD=(81,10,DT=(DM4.),-1,DAY),             
                91:C'01',93:83,8,101:SEQNUM,1,ZD)),             
       IFTHEN=(WHEN=(101,1,ZD,EQ,3),OVERLAY=(25:91,10)),         
       IFTHEN=(WHEN=(101,1,ZD,EQ,4),OVERLAY=(17:81,10))         
OUTFIL BUILD=(1,80)   


Output:

Code:
SELECT *                                           
FROM XYZ.TABLE1                                     
WHERE EFFECTIVE_DATE = '01.11.2014'                 
AND END_DATE = '30.11.2014'                         
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Fri Dec 12, 2014 1:54 pm
Reply with quote

Alternatively, you can use the LASTDAYM subparameter to achieve the same:
Code:
//STEP01  EXEC PGM=SORT                                             
//SYSOUT  DD SYSOUT=*                                               
//SORTOUT DD SYSOUT=*                                               
//SORTIN  DD *                                                     
SELECT *                                                           
FROM XYZ.TABLE1                                                     
WHERE EFFECTIVE_DATE = 'DD.MM.YYYY'                                 
AND END_DATE = 'DD.MM.YYYY'                                         
//SYSIN   DD *                                                     
 OPTION COPY                                                       
 INREC IFTHEN=(WHEN=INIT,                                           
       OVERLAY=(81:DATE2-1,C'01',91:81,8,Y4T,LASTDAYM,TOGREG=Y4W(.),
                81:91,10,84:C'01')),                               
       IFTHEN=(WHEN=(1,1,CH,EQ,C'W'),OVERLAY=(25:81,10)),           
       IFTHEN=(WHEN=(1,1,CH,EQ,C'A'),OVERLAY=(17:91,10))
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 -> SYNCSORT

 


Similar Topics
Topic Forum Replies
No new posts UUID4 - extracting time element COBOL Programming 1
No new posts Cobol-db2 : SQL query is running for ... DB2 4
No new posts View GDG data which is copied from a ... JCL & VSAM 2
No new posts JCL (SET) variables in input stream data JCL & VSAM 0
No new posts Issues with outrec overlay while extr... SYNCSORT 7
Search our Forums:

Back to Top