Adding dates in JCL sort



Support for NetApp SyncSort for z/OS, Visual SyncSort, SYNCINIT, SYNCLIST and SYNCTOOL

Adding dates in JCL sort

Postby deva_048 » Wed Apr 10, 2013 9:45 am

I have two input fields such as
File1: Input 1: 2013-08-18
File 2: Input 2: 9th postion i have 2.00

O/p should be 2013-08-20

I tried using sync sort by manually hard coded the day 2. But i need to get the day from 2nd file from 9th position and add it in first file.

SORT FIELDS=COPY
OUTREC FIELDS=(1:C'''',2:DATEADD(1,10,DT=(4MD-),+2,DAY), * 12:C'''', 68X)


Please advice...

Code'd
deva_048
 
Posts: 72
Joined: Thu Feb 02, 2012 9:28 pm
Has thanked: 1 time
Been thanked: 0 time

Re: Adding dates in JCL sort

Postby BillyBoyo » Wed Apr 10, 2013 11:24 am

Please use the Code tags to preserve spacing.

Is there anything on the 2nd file in any of the positions occupied by the date on the first file which would reliably tell you one record or the other? What are the REFCM and LRECL of your files?
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Adding dates in JCL sort

Postby deva_048 » Wed Apr 10, 2013 12:24 pm

No Billy. 2nd file by default 9th postion will have some numbers 2 or 3... LRECL=80 RECFM=FB
deva_048
 
Posts: 72
Joined: Thu Feb 02, 2012 9:28 pm
Has thanked: 1 time
Been thanked: 0 time

Re: Adding dates in JCL sort

Postby BillyBoyo » Wed Apr 10, 2013 1:51 pm

Concatenate your files on SYSIN, 2nd first, 1st second.

I'm unable to test with DATEADD, but you should see that you have all the information for your BUILD (I'd recommend ignoring OUTREC on OUTFIL, BUILD is entirely the same and will not cause confusion with OUTREC) on the current record by this method.

//STEP0100 EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SORTOUT  DD SYSOUT=*
//SYSIN    DD *
  OPTION COPY
                                                         
  INREC IFTHEN=(WHEN=INIT,
             OVERLAY=(81:SEQNUM,1,ZD)),
  IFTHEN=(WHEN=GROUP,BEGIN=(81,1,CH,EQ,C'1'),
                 PUSH=(82:9,1))
  OUTFIL INCLUDE=(81,1,CH,EQ,C'2'),
           BUILD=(C'JUST FOR DEMO>',1,10,C'<>',82,1,C'<')
//SORTIN   DD *
        7
2013-08-18

Output is:

JUST FOR DEMO>2013-08-18<>7<
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Adding dates in JCL sort

Postby deva_048 » Wed Apr 10, 2013 2:49 pm

Finally day should be added right? But i didnt see any added dates in output above.
deva_048
 
Posts: 72
Joined: Thu Feb 02, 2012 9:28 pm
Has thanked: 1 time
Been thanked: 0 time

Re: Adding dates in JCL sort

Postby BillyBoyo » Wed Apr 10, 2013 2:58 pm

I'm unable to test with DATEADD, but you should see that you have all the information for your BUILD (I'd recommend ignoring OUTREC on OUTFIL, BUILD is entirely the same and will not cause confusion with OUTREC) on the current record by this method.


So, take what you have as FIELDS, make it BUILD on OUTFIL changing the +2 to 82,1 and replacing my BUILD. I've no idea about the syntax error and comments you have on your OUTREC.

  BUILD=(C'''',2:DATEADD(1,10,DT=(4MD-),82,1,DAY)


Note: I've taken off the column (the "1:") as the default for BUILD is to start in column one, so putting in the same thing is not needed, confusing, gives you a chance of introducing an error, all for no benefit.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times


Return to Syncsort/Synctool

 


  • Related topics
    Replies
    Views
    Last post