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

Need help to append a date&tsp at the end of each record


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

New User


Joined: 11 Aug 2023
Posts: 4
Location: India

PostPosted: Fri Aug 11, 2023 1:00 pm
Reply with quote

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 icon_redface.gif
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


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

PostPosted: Fri Aug 11, 2023 1:20 pm
Reply with quote

What have you tried so far?
Back to top
View user's profile Send private message
Isabellemary

New User


Joined: 11 Aug 2023
Posts: 4
Location: India

PostPosted: Fri Aug 11, 2023 2:44 pm
Reply with quote

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
View user's profile Send private message
Joerg.Findeisen

Senior Member


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

PostPosted: Fri Aug 11, 2023 5:09 pm
Reply with quote

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
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2023
Location: USA

PostPosted: Fri Aug 11, 2023 9:43 pm
Reply with quote

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. 824.gif icon_pray.gif sterb050.gif
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2023
Location: USA

PostPosted: Fri Aug 11, 2023 10:39 pm
Reply with quote

Code:
 . . . . . . . . .
// EXPORT SYMLIST=*
 . . . . . . . . .                                                               
//DATETIME DD *,SYMBOLS=EXECSYS
&LDATE&LTIME
//*
 . . . . . . . . . . .   
//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
View user's profile Send private message
Joerg.Findeisen

Senior Member


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

PostPosted: Sat Aug 12, 2023 1:12 am
Reply with quote

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
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2023
Location: USA

PostPosted: Sun Aug 13, 2023 1:57 am
Reply with quote

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
View user's profile Send private message
Joerg.Findeisen

Senior Member


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

PostPosted: Sun Aug 13, 2023 10:12 am
Reply with quote

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
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2023
Location: USA

PostPosted: Sun Aug 13, 2023 6:09 pm
Reply with quote

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
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 Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
Search our Forums:

Back to Top