Page 1 of 1

converting date yyyy-mm-dd to yymmdd to set the date in jcl

PostPosted: Mon Jun 03, 2013 6:49 pm
by Venkichaitu
I have one file which has 3 records and has date format yyyy-mm-dd(starting from 1st position) format i have to convert this date to yymmdd and the i need to write the output first record as //SET SET DATE =DYYMMDD , second record as //SET SET DATE1=DYYMMDD and third record as //SET SET DATE2=YYMMDD .Could you please let me know how to write all these 3 records in one file .

Regards
Venkat

Re: converting date yyyy-mm-dd to yymmdd to set the date in

PostPosted: Mon Jun 03, 2013 9:31 pm
by bodatrinadh
Hi Venkat,

You may try this code-

//STEP00 EXEC PGM=SORT                   
//SYSPRINT DD SYSOUT=*
//SYSOUT   DD SYSOUT=*
//SORTIN   DD *
2013-01-31
2013-02-28
2013-03-31
//SORTOUT   DD SYSOUT=*
//SYSIN    DD *
  OPTION COPY
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,2,ZD)),
        IFTHEN=(WHEN=(81,2,ZD,EQ,+1),BUILD=(01:C'//SET SET DATE=',
                                     3,2,6,2,9,2)),
        IFTHEN=(WHEN=(81,2,ZD,EQ,+2),BUILD=(01:C'//SET SET DATE1=',
                                     3,2,6,2,9,2)),
        IFTHEN=(WHEN=(81,2,ZD,EQ,+3),BUILD=(01:C'//SET SET DATE2=',
                                     3,2,6,2,9,2))


And O/p -
//SET SET DATE=130131
//SET SET DATE1=130228
//SET SET DATE2=130331