View previous topic :: View next topic
Author
Message
Isabellemary New User Joined: 11 Aug 2023Posts: 4 Location: India
Hi Veterans,
I need a help creating a JCL with the following requirement. Tying to avoid writing cobol program if it is doable using JCL utilities
1. Write the current system timestamp into a file - HLQ.DSN.DATETSP
2. Use this timestamp and append it to the end of each record in another file - HLQ.DSN.INPUT1 The output file generated in this step HLQ.DSN.OUTPUT1 should have the same date&tsp from the file appended at the end of all the records in the file.
3. I need to do this for another 10 files - so I cannot use a dynamic Date&tsp but need to use the original data&tsp from HLQ.DSN.DATETSP
Any help is much appreciated.
Isabelle
Back to top
Joerg.Findeisen Senior Member Joined: 15 Aug 2015Posts: 1335 Location: Bamberg, Germany
What have you tried so far?
Back to top
Isabellemary New User Joined: 11 Aug 2023Posts: 4 Location: India
I have googled and looked at the some handbooks, not able to find a way of doing this. I am comfortable getting the current Date and Timestamp into a file but not sure how to read that static value from the file into another Step.
Please help with sample or pointers
Back to top
Joerg.Findeisen Senior Member Joined: 15 Aug 2015Posts: 1335 Location: Bamberg, Germany
Input DSN#00..09 are assumed to be FB;80 here. This way you can update all ten Datasets with one ICETOOL step.
Code:
//WHATEVER EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//DUMMY DD *
WHATEVER
/*
//DATETIME DD DISP=(NEW,PASS),UNIT=SYSALLDA,SPACE=(80,(1,1)),AVGREC=U
//DSN#00 DD DISP=SHR,DSN=&SYSUID..TEST00
//OUT#00 DD DSN=&SYSUID..TEST0014,
// DISP=(NEW,CATLG),UNIT=SYSALLDA,
// SPACE=(TRK,(2,1),RLSE),
// DSORG=PS,RECFM=FB,BLKSIZE=0
//DSN#01 DD DISP=SHR,DSN=&SYSUID..TEST01
//OUT#01 DD DSN=&SYSUID..TEST0114,
// DISP=(NEW,CATLG),UNIT=SYSALLDA,
// SPACE=(TRK,(2,1),RLSE),
// DSORG=PS,RECFM=FB,BLKSIZE=0
//DSN#02 DD DISP=SHR,DSN=&SYSUID..TEST02
//OUT#02 DD DSN=&SYSUID..TEST0214,
// DISP=(NEW,CATLG),UNIT=SYSALLDA,
// SPACE=(TRK,(2,1),RLSE),
// DSORG=PS,RECFM=FB,BLKSIZE=0
:
//DSN#09 DD DISP=SHR,DSN=&SYSUID..TEST09
//OUT#09 DD DSN=&SYSUID..TEST0914,
// DISP=(NEW,CATLG),UNIT=SYSALLDA,
// SPACE=(TRK,(2,1),RLSE),
// DSORG=PS,RECFM=FB,BLKSIZE=0
//TOOLIN DD *
COPY FROM(DUMMY) TO(DATETIME) USING(TIME)
SORT JKFROM TO(OUT#00) USING(CTL0)
SORT JKFROM TO(OUT#01) USING(CTL1)
SORT JKFROM TO(OUT#02) USING(CTL2)
:
SORT JKFROM TO(OUT#09) USING(CTL9)
/*
//TIMECNTL DD *
OPTION STOPAFT=1
INREC BUILD=(DATENS=(4MD),TIMENS=(24),80:X)
/*
//CTL0CNTL DD *
OPTION COPY
JOINKEYS F1=DSN#00,FIELDS=(81,1,A)
JOINKEYS F2=DATETIME,FIELDS=(80,1,A),SORTED,NOSEQCK
REFORMAT FIELDS=(F1:1,80,F2:1,14)
/*
//CTL1CNTL DD *
OPTION COPY
JOINKEYS F1=DSN#01,FIELDS=(81,1,A)
JOINKEYS F2=DATETIME,FIELDS=(80,1,A),SORTED,NOSEQCK
REFORMAT FIELDS=(F1:1,80,F2:1,14)
/*
//CTL2CNTL DD *
OPTION COPY
JOINKEYS F1=DSN#02,FIELDS=(81,1,A)
JOINKEYS F2=DATETIME,FIELDS=(80,1,A),SORTED,NOSEQCK
REFORMAT FIELDS=(F1:1,80,F2:1,14)
/*
:
//CTL9CNTL DD *
OPTION COPY
JOINKEYS F1=DSN#09,FIELDS=(81,1,A)
JOINKEYS F2=DATETIME,FIELDS=(80,1,A),SORTED,NOSEQCK
REFORMAT FIELDS=(F1:1,80,F2:1,14)
/*
//JNF1CNTL DD *
INREC OVERLAY=(81:X)
/*
Back to top
sergeyken Senior Member Joined: 29 Apr 2008Posts: 2141 Location: USA
Again: the newcomers are not able to create even a single line of code by themselves...
They are able only to copy-and-paste (e.g. to steal) others results.
Back to top
sergeyken Senior Member Joined: 29 Apr 2008Posts: 2141 Location: USA
Code:
. . . . . . . . .
// EXPORT SYMLIST=*
. . . . . . . . .
//DATETIME DD *,SYMBOLS=EXECSYS
&LDATE<IME
//*
. . . . . . . . . . .
//TOOLIN DD *
COPY JKFROM TO(OUT#00) USING(CTL0)
COPY JKFROM TO(OUT#01) USING(CTL1)
COPY JKFROM TO(OUT#02) USING(CTL2)
:
COPY JKFROM TO(OUT#09) USING(CTL9)
/*
//CTL0CNTL DD *
JOINKEYS F1=DSN#00,FIELDS=(81,1,A)
JOINKEYS F2=DATETIME,FIELDS=(70,1,A), <-- pos 73-80 may be renumbered!
SORTED,NOSEQCK
REFORMAT FIELDS=(F1:1,80,F2:1,14)
/*
. . . . . . .
Back to top
Joerg.Findeisen Senior Member Joined: 15 Aug 2015Posts: 1335 Location: Bamberg, Germany
I used DFSORT date/time operators just in case a different format is required. Using system symbols is of course also fine.
Back to top
sergeyken Senior Member Joined: 29 Apr 2008Posts: 2141 Location: USA
Joerg.Findeisen wrote:
I used DFSORT date/time operators just in case a different format is required. Using system symbols is of course also fine.
1. System variables can be used to provide any format
Code:
&YEAR
&MON
&DAY
&HOUR
&MINS
&SEC
2. Extra SORT section is not needed to form date/time string.
3. SORT and OPTION COPY are not required
4. Position 80 is not good choice to join all-to-one.
Back to top
Joerg.Findeisen Senior Member Joined: 15 Aug 2015Posts: 1335 Location: Bamberg, Germany
sergeyken wrote:
1. System variables can be used to provide any format
Code:
&YEAR
&MON
&DAY
&HOUR
&MINS
&SEC
You cannot code DFSORTs TIME=(12:)/TIMENS=(12) format this way.
sergeyken wrote:
3. SORT and OPTION COPY are not required
Omitting OPTION COPY from CTLnCNTL DD's will give ICE010A 0 NO SORT OR MERGE CONTROL STATEMENT in DFSORT, so it is needed there.
Back to top
sergeyken Senior Member Joined: 29 Apr 2008Posts: 2141 Location: USA
Joerg.Findeisen wrote:
sergeyken wrote:
3. SORT and OPTION COPY are not required
Omitting OPTION COPY from CTLnCNTL DD's will give ICE010A 0 NO SORT OR MERGE CONTROL STATEMENT in DFSORT, so it is needed there.
… only when SORT FROM() TO() is used under //TOOLIN DD instead of COPY FROM() TO()
Back to top
Please enable JavaScript!