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

Insert system time/date (timestamp) using only a JCL


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
nupurbhui

New User


Joined: 25 May 2023
Posts: 18
Location: India

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

Hi,

I need the date format to be YYYYMMDDHHMMSS using HEADER1 function, from the 6th column in o/p file.

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'DATE',6:&DATE4),
/*


I've tried using the below formats but not able to get YYYYMMDDHHMMSS :

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

Expected DATE o/p:
Code:
1234567890123456789 ------> cols
DATE 20230511040235


How can i do that in this header function?
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2141
Location: USA

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

If you tried to run your sample of code, you’d get SORT error (syntax error). The SORT control statements CANNOT start from position 1; especially - continuation lines.

You MUST fix such kindergarten bugs by yourself, and present here ONLY the code you really ran successfully, plus present here the actual results, to demonstrate: what exactly you are not satisfied with?

IMPORTANT NOTE
You asked about “JCL only solution” but for unknown reason you are trying to use the SORT utility, which in no way can be called JCL.
If you really need a “JCL only solution”, then try to read this:
www.ibm.com/docs/en/zos/2.3.0?topic=symbols-dynamic-system
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 9:33 pm
Reply with quote

Yes I have given the job card and got maxcc=00 for all the date formats I mentioned in place of &DATE4 while testing, that are:

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

But I need the format to be YYYYMMDDHHMMSS, as I have mentioned in the expected o/p.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2141
Location: USA

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

1. Read about TIMENS= parameter
(Note: the manuals do exist specifically for users to read, and to investigate available options BY THEMSELVES)

2. Once again: THINK ABOUT YOUR OWN REQUIREMENT “JCL ONLY SOLUTION”
Back to top
View user's profile Send private message
nupurbhui

New User


Joined: 25 May 2023
Posts: 18
Location: India

PostPosted: Tue May 30, 2023 2:57 pm
Reply with quote

sergeyken wrote:
1. Read about TIMENS= parameter
(Note: the manuals do exist specifically for users to read, and to investigate available options BY THEMSELVES)

2. Once again: THINK ABOUT YOUR OWN REQUIREMENT “JCL ONLY SOLUTION”


Hi,
I checked the TIMENS parameter and was able to get the HHMMSS part. So I tried placing the date and time together after generating it as separate parameters.
This worked for the format I needed i.e, YYYYMMDDHHMMSS:
Code:
6:DATENS=(4MD),15:&TIMENS


Output:
Code:
1234567890123456789 ------> cols
     20230511040235


Thanks a lot for your suggestion!
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


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

PostPosted: Tue May 30, 2023 4:22 pm
Reply with quote

Omit the 15: part, and stick to one notation. Either &DATENS/&TIMENS, or without the &'s.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Help with SORT - I need to validate d... DFSORT/ICETOOL 0
No new posts Date format correction using dfsort DFSORT/ICETOOL 3
No new posts System add a USER parm when job submi... TSO/ISPF 4
No new posts Sorting Date Field DFSORT/ICETOOL 4
No new posts CONVERT a given date from UTC TO BST CICS 0
Search our Forums:

Back to Top