Billy, as Sri said there's no way to ask SORT tools to put a different TS on every record. Hereby a "try" to start with an arbitrary TS (in TOD format to generate as you like) and then generate a number of consecutive TS part (HHMMSSuuuuuu) with a distance of 1 us.
It's a two steps and probably can be shrinked into one. Consider it as an idea to further develop. This doesn't guarantee any uniqueness between two different runs or single run generating more than "1 day" number of records. Hope this helps. Max //*-------------------------------------------------------------------* //* LET'S GENERATE A ARBITRARY NUMBERS OF ROWS WITH THE SEQNUM IN * //* BINARY FORMAT AND A FIX TOD. LET'S CALL IT BASE TOD. * //*-------------------------------------------------------------------* //ST001 EXEC PGM=SORT //SYSOUT DD SYSOUT=* //SORTIN DD * ABC //SORTOUT DD DSN=&&TMP,DISP=(,PASS),SPACE=(TRK,(10,10),RLSE) //SYSIN DD * SORT FIELDS=COPY OUTFIL REPEAT=100000, BUILD=(SEQNUM,4,BI,START=0,X'DE956F5F25C18000') * 2024-01-31-23.59.59.999000 * BUILD=(SEQNUM,4,BI,X'DE9542AB0E800000') * 2024-01-31-20.40.00.000000 /* //*-------------------------------------------------------------------* //* TOD IS A 8 BYTES BINARY WHERE BIT 51 IS 1 US * //* IT MEANS YOU HAVE TO DIVIDE TOD BY 4096 TO CALC NUM OF US * //* SO: * //*-------------------------------------------------------------------* //* +129171456000000000 1 YEAR * //* +353894400000000 1 DAY * //* +14745600000000 1 HOUR * //* +245760000000 1 MINUTE * //* +4096000000 1 SECOND * //* +4096 1 US * //*-------------------------------------------------------------------* //* SORT CAN TRANSFORM TOD TO DATE OR TIME. * //* FOR TIME THE MAXIMUM PRECISION IS HUNDREDTHS SECOND. * //* WE NEED TO CALCULATE THE LAST 4 DIGITS OF MICROSECONDS. * //*-------------------------------------------------------------------* //* FIRST ADD SEQNUM US TO THE BASE TOD. * //* EVERY RECORD WILL HAVE ONE US MORE. * //* LET'S PRINT TOD AS TC4: HHMMSSHH. * //* LET'S CALC LAST 4 DIGITS AS REMAINDER OF TOD BY 40960000. * //* THIS IS THE VALUE IN TOD US UNITS. DIVIDE IT BY 4096 TO GET US. * //*-------------------------------------------------------------------* //* WE USE THIS MECHANISM TO USE TOD AS COUNTER AND AVOID EVALUATING * //* DAY CHANGE ETC. * //*-------------------------------------------------------------------* //ST002 EXEC PGM=SORT //SYSOUT DD SYSOUT=* //SORTIN DD DSN=&TMP,DISP=(OLD,DELETE) //SORTOUT DD SYSOUT=* //SYSIN DD * INREC FIELDS=(1,4, SEQNUM 5,8, BASE TS 1,4,BI,MUL,+4096,ADD,5,8,BI,TO=BI,LENGTH=8, ADD SEQNUM US TO BASE TS ((1,4,BI,MUL,+4096,ADD,5,8,BI), CALC REMAINDER US*10000 MOD,+40960000),DIV,+4096,TO=BI,LENGTH=4) SORT FIELDS=COPY OUTREC FIELDS=(C'XXXX', 13,8,TC4, 21,4,BI,EDIT=(TTTT)) /* Il giorno mer 31 gen 2024 alle ore 20:10 Billy Ashton < bill00ash...@gmail.com> ha scritto: > Thanks so much for this, Kolusu. I was hoping to find a way to get a new > time on every record, but I think I can work with this and the following > sequence number. > > I hope you have a great day today! > > Thank you and best regards, > Billy Ashton > > > ------ Original Message ------ > From "Sri h Kolusu" <skol...@us.ibm.com> > To IBM-MAIN@listserv.ua.edu > Date 1/31/2024 1:32:23 PM > Subject Re: Generating output in SORT with a time value > > >>> Hi there Kolusu, I messed up my format, and should have had colons > instead of commas. > > > >Billy, > > > >Apart from usage of Colons, did you realize that you have OVERLAPPING > data? > > > >At position 82 you wanted to write 82:C'This is my data field 3', and > then at position 102 you wanted to write this 102:C'AZ', > > > >The length of the text at 82 is 23 bytes long. > > > >----+----1----+----2---- > >THIS IS MY DATA FIELD 3 > > > >You want to write 23 bytes into a 20-byte length which is NOT possible. > > > >>> I checked the APG, and could not find a way to use only the timestamp. > > > >Not every user requirement in the world can be documented. You get the > timestamp and strip of the values and get the desired value. > > > >btw I hope you do realize that TIMESTAMP is got ONCE and since you are > writing 1500 records, every record will have the SAME exact timestamp. > The Timestamp is NOT changed for every record. > > > >For example, this is the time stamp > > > >----+----1----+----2----+--- > >yyyy-mm-dd-hh.mm.ss.nnnnnn > >2024-01-31-11.05.40.559424 > > > >Now you want to remove the separators and have the time as 110540559424. > > > >That value will remain the SAME value for all the 1500 records. > > > >If you want the same time for all the records, then here is the JCL that > would get you the desired results ( I fixed the overlapping fields ) > > > >2 lines(see the lines in bold) is what is required to get the time > without separators. > > > >//STEP0100 EXEC PGM=SORT > >//SYSOUT DD SYSOUT=* > >//SORTIN DD * > >ABC > >//SORTOUT DD SYSOUT=* > >//SYSIN DD * > > OPTION COPY > > INREC BUILD=(DATE5) > > OUTFIL REPEAT=1500, > > BUILD=(01:C'TLX1', > > 05:12,15,UFF,M11,LENGTH=12, > > 17:SEQNUM,5,ZD,START=10001,INCR=3, > > 22:C'THIS IS MY DATA FIELD 1', > > 52:C'THIS IS MY DATA FIELD 2', > > 82:C'THIS IS MY DATA FIELD 3', > > 112:C'AZ', > > 114:C'111110000') > >/* > >Thanks, > >Kolusu > >DFSORT Development > >IBM Corporation > > > > > > > >---------------------------------------------------------------------- > >For IBM-MAIN subscribe / signoff / archive access instructions, > >send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN > > ---------------------------------------------------------------------- > For IBM-MAIN subscribe / signoff / archive access instructions, > send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN > ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN