Page 1 of 1

Write record in PS through JCL

PostPosted: Thu Nov 08, 2007 8:36 pm
by durgac
I wanted to write the current timestamp into a dataset through JCL. Can this be done? Could any one help me out?

Re: Write record in PS through JCL

PostPosted: Thu Nov 08, 2007 8:51 pm
by CICS Guy
Where are you getting this 'timestamp'?
Can sort header/trailer processing against a dummy input give you what you want?

Re: Write record in PS through JCL

PostPosted: Thu Nov 08, 2007 9:54 pm
by Frank Yaeger
Here's a DFSORT job that will write the current date in the form 'yyyymmdd' in an output record.

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
RECORD
//SORTOUT DD DSN=...  output file (FB/8)
//SYSIN    DD    *
  OPTION COPY
  INREC BUILD=(DATE1)
/*


If you want something else, be more specific about what you want (form of date, RECFM and LRECL of output data set, etc).

Re: Write record in PS through JCL

PostPosted: Thu Nov 08, 2007 10:14 pm
by durgac
Thank you very much!

Re: Write record in PS through JCL

PostPosted: Tue Aug 19, 2008 6:57 pm
by munni_03
//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
RECORD
//SORTOUT DD DSN=...  output file (FB/8)
//SYSIN    DD    *
   OPTION COPY
   INREC BUILD=(DATE1)
/*


its giving output date format as yyyymmdd but i want in mmddyyyy.

Re: Write record in PS through JCL

PostPosted: Tue Aug 19, 2008 8:39 pm
by Frank Yaeger
For 'mmddyyyy', you can use this DFSORT INREC statement:

  INREC BUILD=(DATENS=(MD4))

Re: Write record in PS through JCL

PostPosted: Wed Aug 20, 2008 3:28 pm
by munni_03
Hi

I got the exact output but i am comparing date fields.
in this i want date of 60 days before by subtracting 60 days frm it...
but its giving error..can u help on tis



//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
RECORD
//SORTOUT DD DSN=... output file (FB/8)
//SYSIN DD *
OPTION COPY
OUTREC BUILD=(DATE-60)
/*

Re: Write record in PS through JCL

PostPosted: Wed Aug 20, 2008 8:26 pm
by Frank Yaeger
Sigh. Why didn't you say what you actually wanted in your first post or subsequent posts? It's not clear how what you've said you want so far has to do with your statement "i am comparing date fields".

However, if you want the current date - 60 days in the form 'mmddyyyy', you can use these DFSORT statements:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
RECORD
//SORTOUT DD DSN=... output file (FB/8)
//SYSIN    DD    *
  OPTION COPY
  INREC IFTHEN=(WHEN=INIT,BUILD=(DATE1-60)),
    IFTHEN=(WHEN=INIT,BUILD=(5,4,1,4))
/*


If that isn't what you want, then explain in detail exactly what it is you want to do.