MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

SYNCSORT Help

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
vijay
Beginner


Joined: 09 May 2003
Posts: 131
Topics: 64

PostPosted: Tue Jul 29, 2003 1:46 pm    Post subject: SYNCSORT Help Reply with quote

Hi ,

I'VE A DATE FIELD WITH PIC S9(9) COMP-3.FORMAT IS CCYYMMDD .
CAN I USE SYNCSORT TO EXTRACT RECORDS FROM THE FILE WITH THE CONDITION
DATE(IN THE FILE IN COMP-3 FORMAT) > CURRENT DATE - 2 YEARS

THX..
VIJAY
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Tue Jul 29, 2003 3:44 pm    Post subject: Reply with quote

Vijay,

Even though sort products are capable of performing arthmetic functions, they still cannot be used in date calculations.so if you are looking for a pure sort solution then the answer is 'NO'

However you can generate dynamic control card using db2 unload utility which will create calculate the date subtracting 2 years from current date.

check the following example. I am assuming that your packed decimal field starts in position 1 for 5 bytes.

Code:

//STEP0100 EXEC PGM=IKJEFT01                                   
//*                                                             
//SYSTSPRT DD  SYSOUT=*,DCB=BLKSIZE=121                         
//SYSPRINT DD  SYSOUT=*                                         
//SYSTSIN  DD  *                                               
 DSN SYSTEM(XXXX)                                               
 RUN  PROGRAM(DSNTIAUL) -                                       
      PLAN(DSNTIAUL)    -                                       
      PARMS('SQL')      -                                       
      LIB('XXXX.RUNLIB.LOAD')                                   
//SYSREC00 DD DSN=&T1,DISP=(,PASS),SPACE=(TRK,(1,1),RLSE)                       
//SYSPUNCH DD SYSOUT=*                                         
//SYSIN    DD  *                                               
SELECT CHAR(' INCLUDE COND=(1,5,PD,GT,')                       
      ,SUBSTR(CHAR(CURRENT DATE - 2 YEARS),1,4)                 
      ,SUBSTR(CHAR(CURRENT DATE - 2 YEARS),6,2)                 
      ,SUBSTR(CHAR(CURRENT DATE - 2 YEARS),9,2)                 
      ,CHAR(')') 
      ,CHAR('                                         ')         
       FROM SYSIBM.SYSDUMMY1                                   
        ;
//*


The output from the above step is :
Code:

  INCLUDE COND=(1,5,PD,GT,20010729)


Now this dataset is taken as control card for the sort step and copies the records which have date greater than 20010729.

Code:

//STEP0200 EXEC PGM=SORT   
//SYSOUT   DD SYSOUT=*     
//SORTIN   DD DSN=YOUR INPUT FILE,
//            DISP=SHR
//SORTOUT  DD DSN=YOUR OUTPUT DATASET,
//            DISP=(NEW,CATLG,DELETE),
//            UNIT=SYSDA,
//            SPACE=(CYL,(X,Y),RLSE)           
//SYSIN    DD *                   
 SORT FIELDS=COPY                 
//         DD DSN=&T1,DISP=OLD                 
//*



Hope this helps...

cheers

kolusu

PS: please post in small letters as posting caps means as if you are yelling.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
vijay
Beginner


Joined: 09 May 2003
Posts: 131
Topics: 64

PostPosted: Tue Jul 29, 2003 10:26 pm    Post subject: Reply with quote

Sorry for the CAPS .Thx. a lot for the reply.It's working fine .

Vijay
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group