View previous topic :: View next topic
|
Author |
Message |
nupurbhui
New User
Joined: 25 May 2023 Posts: 18 Location: India
|
|
|
|
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 |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2141 Location: USA
|
|
|
|
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 |
|
|
nupurbhui
New User
Joined: 25 May 2023 Posts: 18 Location: India
|
|
|
|
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 |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2141 Location: USA
|
|
|
|
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 |
|
|
nupurbhui
New User
Joined: 25 May 2023 Posts: 18 Location: India
|
|
|
|
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 |
|
|
Joerg.Findeisen
Senior Member
Joined: 15 Aug 2015 Posts: 1337 Location: Bamberg, Germany
|
|
|
|
Omit the 15: part, and stick to one notation. Either &DATENS/&TIMENS, or without the &'s. |
|
Back to top |
|
|
|