IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Current Date/Time thru JCL without writing any pgm


IBM Mainframe Forums -> JCL & VSAM
Post new topic   This topic is locked: you cannot edit posts or make replies.
View previous topic :: View next topic  
Author Message
apandey

New User


Joined: 31 Aug 2009
Posts: 73
Location: Mumbai

PostPosted: Fri Sep 23, 2011 2:15 pm
Reply with quote

Hi All,
I have a requirement where I need to create a output file with only 2 records.
layout/date is as below:

SENDDATE=CURRENT_DATE
TIMESTAMP=CURRENT_TIME

Here SENDDATE and TIMESTAMP are constant fields. and CURRENT_DATE/TIME should be system's date and time.
For Ex:
SENDDATE=2011-09-23
TIMESTAMP=04.31.58

Is there is anyway to do this thru JCL(SORT) or some any other utility.
Pls help me on this.
Back to top
View user's profile Send private message
Gnanas N

Active Member


Joined: 06 Sep 2007
Posts: 792
Location: Chennai, India

PostPosted: Fri Sep 23, 2011 2:30 pm
Reply with quote

If you have DFSORT installed, please refer "Insert date and time of run into records" section of the below document.

ftp.software.ibm.com/storage/dfsort/mvs/sorttrck.pdf
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Fri Sep 23, 2011 3:12 pm
Reply with quote

Below DFSORT step will give desired...
Code:

//S1    EXEC  PGM=SORT                 
//SYSOUT    DD  SYSOUT=*               
//SORTIN DD *                           
 DUMMY                                 
/*                                     
//SORTOUT DD  SYSOUT=*                 
//SYSIN    DD    *                     
  SORT FIELDS=COPY                     
  OUTFIL REMOVECC,NODETAIL,             
  HEADER1=(C'SENDDATE=',DATE=(4MD-),/,C'TIMESTAMP=',TIME=(24.))
/*                                     

Output will be like...
Code:

SENDDATE=2011-09-23 
TIMESTAMP=10.44.07   
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Fri Sep 23, 2011 4:01 pm
Reply with quote

You could also use EZACFSM1 to achieve the same results.
Back to top
View user's profile Send private message
apandey

New User


Joined: 31 Aug 2009
Posts: 73
Location: Mumbai

PostPosted: Wed Sep 28, 2011 2:32 pm
Reply with quote

Hi All,
I have a input file where I have 2 fields as MDL-PROCESS-DATE and
MDL-PROCESS-TIME, this 2 fields contains date in YYYYMMDD format and time in HHMM format.
now I want to overwrite this 2 fields value with Current Date and Time.
Date field starts from position 5th and Time field starts from position 13th.

I tried below SORT Card but its giving Syntax error. can any one pls help.

******************* TOP OF DATA*******************
SYNCSORT FOR Z/OS 1.3.2.2R U.S. PATENTS: 4210961, 5117495 (C) 2007 SYNCSO
Chrysler Group LLC z/OS 1.11.0
SYNCSORT LICENSED FOR CPU SERIAL NUMBER 36515, MODEL 2097 711 LICEN
SYSIN :
SORT FIELDS=COPY
OUTREC FIELDS=((5:5,&DATENS=(4MD)),(13:13,&TIMENS=(24)))
*
WER268A OUTREC STATEMENT : SYNTAX ERROR
WER211B SYNCSMF CALLED BY SYNCSORT; RC=0000
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE
******************** BOTTOM OF DATA *********************
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Sep 28, 2011 2:59 pm
Reply with quote

Try taking out the brackets around your two fields, unless you got that from a manual? Not seen it before, no SyncSort manual to check.

EDIT: And put anything which you have gone to the bother of formatting into the Code tags, else you have just wasted your time and will waste ours as it looks like everything starts in the wrong column and the * points to the wrong place.
Back to top
View user's profile Send private message
apandey

New User


Joined: 31 Aug 2009
Posts: 73
Location: Mumbai

PostPosted: Wed Sep 28, 2011 3:11 pm
Reply with quote

Thanks Bill ..
Anyway another moderator of this forum sits near to me in my project(luckily). icon_razz.gif
He is 'Anuj Dhawan' , He solved my doubt. Thanks Anuj.
Here is the sort card:
//SYSIN DD *
SORT FIELDS=COPY
OUTREC FIELDS=(5:&DATE1,13:&TIME2)
/*
Back to top
View user's profile Send private message
nandeshwar

New User


Joined: 11 Oct 2010
Posts: 45
Location: Delhi

PostPosted: Thu May 11, 2017 4:12 pm
Reply with quote

apandey wrote:
Thanks Bill ..
Anyway another moderator of this forum sits near to me in my project(luckily). icon_razz.gif
He is 'Anuj Dhawan' , He solved my doubt. Thanks Anuj.
Here is the sort card:
//SYSIN DD *
SORT FIELDS=COPY
OUTREC FIELDS=(5:&DATE1,13:&TIME2)
/*


@Anuj Dhawan... I really want to thank you for the sort you gave me in just two lines.. icon_smile.gif
&DATE function is really helpful with &DATE1, &DATE2, &DATE3, &DATE4 and &DATE5 .. it solved my problem which I was working on for past 3-4 days
Back to top
View user's profile Send private message
nupurbhui

New User


Joined: 25 May 2023
Posts: 18
Location: India

PostPosted: Thu May 25, 2023 5:55 pm
Reply with quote

Hi,

I need the date format to be YYYYMMDDHHMMSS format using HEADER1 fucntion, from the 34th column.

Ive tried using the below but not able to get this exact format:

34:DATENS=(YMD) ------------------> 230525
:DATE=(4MD-) --------------------> 2023-05-25
34:DATENS=(YMD),TIME=(24 ) ---> 23052507 55 42

Code:
//STEP01 EXEC PGM=SORT
//SORTIN DD DSN=FILE1,DISP=SHR
//SORTOUT DD DSN=FILE2,DISP=SHR
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL REMOVECC,
HEADER1=(1:C'$F BDAINTRA',25:C'XXXXXXX',34:&DATE4),
TRAILER1=(1:C'$E BDAINTRA',25:C'XXXXXXX')
/*
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2012
Location: USA

PostPosted: Fri May 26, 2023 12:03 am
Reply with quote

apandey wrote:
Hi All,
I have a requirement where I need to create a output file with only 2 records.
layout/date is as below:

SENDDATE=CURRENT_DATE
TIMESTAMP=CURRENT_TIME

Here SENDDATE and TIMESTAMP are constant fields. and CURRENT_DATE/TIME should be system's date and time.
For Ex:
SENDDATE=2011-09-23
TIMESTAMP=04.31.58

Is there is anyway to do this thru JCL(SORT) or some any other utility.
Pls help me on this.

Code:
// EXPORT SYMLIST=*
// . . . . . . . . . . . . .
//GENERATE EXEC PGM=IEBGENER
//SYSPRINT DD  DUMMY
//SYSIN    DD  DUMMY
//SYSUT1   DD  *,SYMBOLS=EXECSYS
SENDDATE=&LYR4-&LMON-&LDAY
TIMESTAMP=&LHR..&LMIN..&LSEC.
//*
//SYSUT2   DD  . . . . output dataset
//


P.S.
All "&L..." above stand for "local time".
Without letter 'L' you can use UTC time and date.
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1231
Location: Bamberg, Germany

PostPosted: Fri May 26, 2023 10:59 am
Reply with quote

Export of the SYMLIST is not necessary for this case.

To consider is, that the Jobclass must allow the use of symbols. For ex:
Code:
$HASP837 JOBCLASS(A)         SYSSYM=ALLOW
Back to top
View user's profile Send private message
nupurbhui

New User


Joined: 25 May 2023
Posts: 18
Location: India

PostPosted: Mon May 29, 2023 5:23 pm
Reply with quote

Hi,

I need the date format to be YYYYMMDDHHMMSS format using HEADER1 fucntion, from the 34th column.

Ive tried using the below but not able to get this exact format:

34:DATENS=(YMD) ------------------> 230525
:DATE=(4MD-) --------------------> 2023-05-25
34:DATENS=(YMD),TIME=(24 ) ---> 23052507 55 42

Code:
//STEP01 EXEC PGM=SORT
//SORTIN DD DSN=FILE1,DISP=SHR
//SORTOUT DD DSN=FILE2,DISP=SHR
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL REMOVECC,
HEADER1=(1:C'$F BDAINTRA',25:C'XXXXXXX',34:&DATE4),
TRAILER1=(1:C'$E BDAINTRA',25:C'XXXXXXX')
/*
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2012
Location: USA

PostPosted: Mon May 29, 2023 5:34 pm
Reply with quote

0. Do not tailgate previous topics for your own new questions.

1. Learn how to use the Code button when posting your samples. Otherwise >75% of users ignore your appeals.

2. Present exactly what you really get after your attempts, and how you’d like to see your results.
Back to top
View user's profile Send private message
nupurbhui

New User


Joined: 25 May 2023
Posts: 18
Location: India

PostPosted: Mon May 29, 2023 6:18 pm
Reply with quote

Hi,

Sorry, I'm new to this forum. Could you please help me understand how to add code snippet images in the messages.
I will start the issue as a new topic.

Thanks for the reply!
Back to top
View user's profile Send private message
Willy Jensen

Active Member


Joined: 01 Sep 2015
Posts: 712
Location: Denmark

PostPosted: Mon May 29, 2023 6:23 pm
Reply with quote

"how to add code snippet"
Paste the code, mark the text, hit the 'Code' botton.
Back to top
View user's profile Send private message
nupurbhui

New User


Joined: 25 May 2023
Posts: 18
Location: India

PostPosted: Mon May 29, 2023 6:44 pm
Reply with quote

Willy Jensen wrote:
"how to add code snippet"
Paste the code, mark the text, hit the 'Code' botton.


Got it. Thanks a lot !
Back to top
View user's profile Send private message
nupurbhui

New User


Joined: 25 May 2023
Posts: 18
Location: India

PostPosted: Mon May 29, 2023 7:10 pm
Reply with quote

I have started it as a new topic also. Thanks!
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   This topic is locked: you cannot edit posts or make replies. View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts To get the the current time DFSORT/ICETOOL 13
No new posts RC query -Time column CA Products 3
No new posts Need to convert date format DFSORT/ICETOOL 20
No new posts C Compile time time stamps Java & MQSeries 10
Search our Forums:

Back to Top