Page 1 of 2

Date Manipulation through Syncsort

PostPosted: Mon May 05, 2008 3:29 pm
by puspojit
Hi,

I have a file which has a field containing values ranging from (1-7).
Depending on these values I have to Overlay(Overwrite) that field in the O/P file with (SYSDATE-n) where n is the value of that field in the I/P file.
Please let me know whether this can be achieved through Synsort and if yes,do let me know the sort card.

Syncsort version used is
SYNCSORT FOR Z/OS  1.2.2.2R


Thanks and Regards,
Puspojit

Re: Date Manipulation through Syncsort

PostPosted: Mon May 05, 2008 7:18 pm
by arunprasad.k
Puspojit,

Some sample I/P records and the corresponding expected O/P will help those who likes to help you.

Also what is SYSDATE? Is it a constant or it refers system date?

Arun.

Re: Date Manipulation through Syncsort

PostPosted: Mon May 05, 2008 7:49 pm
by arunprasad.k
Okay I got the requirement.

I do not have syncsort in my shop. May be you can try this JCL which works with DFSORT. :(

The O/P will have the date in the format CCYY-MM-DD.

//S01   EXEC PGM=SORT                                                   
//SYSOUT  DD SYSOUT=*                                                   
//SORTIN  DD *                                                         
1                                                                       
2                                                                       
3                                                                       
/*                                                                     
//SORTOUT DD SYSOUT=*                                                   
//SYSIN   DD *                                                         
  SORT FIELDS=COPY                                                     
  OUTREC IFTHEN=(WHEN=(1,1,CH,EQ,C'1'),                                 
            OVERLAY=(1:DATE1(-)-1)),                                   
         IFTHEN=(WHEN=(1,1,CH,EQ,C'2'),                                 
            OVERLAY=(1:DATE1(-)-2)),                                   
         IFTHEN=(WHEN=(1,1,CH,EQ,C'3'),                                 
            OVERLAY=(1:DATE1(-)-3))                                     
/*                                                                     


Continue for all the values of n. I just gave 1 to 3.

Arun.

Re: Date Manipulation through Syncsort

PostPosted: Mon May 05, 2008 9:15 pm
by puspojit
Hi Arun,

Sysdate is system date.
Anyways, I do not have DFSORT over here...so posted my query in Syncsort forum.
Your sort card wont work over here for Obviuos reasons. Anyways, does date functions which you have mentioned over
here work with sync sort....Any one having any ideas?

Regards,
Puspojit

Re: Date Manipulation through Syncsort

PostPosted: Mon May 12, 2008 9:10 pm
by Alissa Margulies
Puspojit,

Arun's job should work in your shop as well with SyncSort for z/OS. If it does not, then please post the error message that you get.

Good Luck,

Re: Date Manipulation through Syncsort

PostPosted: Thu Oct 23, 2008 9:41 pm
by ranga_subham
Alissa, I was going through the old posts and thought to give this a try.... :)

The job failed at our site.

SYSIN :                                       
  SORT FIELDS=COPY                           
  OUTREC IFTHEN=(WHEN=(1,1,CH,EQ,C'1'),       
            OVERLAY=(1:DATE1(-)-1)),         
                               *             
         IFTHEN=(WHEN=(1,1,CH,EQ,C'2'),       
            OVERLAY=(1:DATE1(-)-2)),         
         IFTHEN=(WHEN=(1,1,CH,EQ,C'3'),       
            OVERLAY=(1:DATE1(-)-3))           
WER268A  OUTREC STATEMENT  : SYNTAX ERROR     
WER449I  SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE


Thanks.

Re: Date Manipulation through Syncsort

PostPosted: Fri Oct 24, 2008 12:00 am
by Alissa Margulies
Which release and maintenance level of SyncSort are you running?

Re: Date Manipulation through Syncsort

PostPosted: Fri Oct 24, 2008 9:18 am
by ranga_subham
We are using SYNCSORT FOR Z/OS 1.2.3.1R

Re: Date Manipulation through Syncsort

PostPosted: Wed Oct 29, 2008 1:50 am
by Alissa Margulies
Change all your DATE1 to &DATE1 (the character preceding DATE1 is an ampersand) and see if that corrects the syntax error.

Re: Date Manipulation through Syncsort

PostPosted: Wed Oct 29, 2008 8:21 pm
by ranga_subham
Below is the changed code per your suggestion but still fails........... :|

SYSIN :                                     
 SORT FIELDS=COPY                           
 OUTREC IFTHEN=(WHEN=(1,1,CH,EQ,C'1'),       
           OVERLAY=(1:&DATE1(-)-1)),         
                               *             
        IFTHEN=(WHEN=(1,1,CH,EQ,C'2'),       
           OVERLAY=(1:&DATE1(-)-2)),         
        IFTHEN=(WHEN=(1,1,CH,EQ,C'3'),       
           OVERLAY=(1:&DATE1(-)-3))         
WER268A  OUTREC STATEMENT  : SYNTAX ERROR   
WER449I  SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE


Thanks.