can we compare time fields in SORT card of JCL
Suppose I have 12 position of a record holding time field of 8 bytes. Can I compare it with current timestamp? Can I do arithmetic operations on that filed like adding an hour or subtracting few m开发者_开发问答inutes etc. Your responses will be highly appreciated. Thanks!
Addendum.. for better understanding:
I need your help in getting time fields compared while writing records from output. For instance I have 12th position of the file hloding timestamp of 8bytes. I want to write to output when the timestamp on the record is less than or equal to the current timestamp by an hour. In the process of attaining this i was stuck at below:
INCLUDE COND=(12,8,??,GE,&TIME1-1),
what could be the data representation (in the place of ??
for this.)
Prior to all can we achieve this using SORT? If so, please gimme SORT card (amend my card if feasible otherwise gimme your version). And also please share the material/repo on time and date comparisons and better handling. Thanks in advance for help.
Regards, Raja.
I think see what you are trying to do, but have doubts as to whether it will work. These are my thoughts:
- I have only ever seen the &TIME1(c) character string used for output. For example: OUTREC BUILD(1,11,12,&TIME1(:)) will place the current time in HH:MM:SS format into the output record starting at position 12. To the best of my knowedge, TIME cannot be used in an ICETOOL/DFSORT COND statement as you have indicated in your question.
- Even if TIME were supported within COND statements, the +/- operators are not supported as you might have seen with DATE (eg. DATE1+1 to get current date plus 1 day). Adding some constant to a TIME is not supported.
- Have you given any consideration to what would happen if your job were to run a few minutes before midnight? Adding an hour to the time causes a roll over to morning of the next day. At that point you need to take the date into condideration in the COND.
Something that might work: Add a pre-step to run a REXX, or some other, prgram. Let this program generate all or part of the INCLUDE statements used in a subsequent ICETOOL step. Here is an example REXX procedure that will create an INCLUDE statement similar to the one given in your question. The record is written to the file allocated to DD CNTLREC:
/* REXX */
PULL DELTA /* Number of hours to add to current time */
PARSE VALUE TIME('N') WITH HH ':' MM ':' SS /* current time */
HH = LEFT((HH + DELTA) // 24, 2, '0') /* add DELTA, check rollover */
QUEUE " INCLUDE COND=(12,8,CH,GE,C'"HH":"MM":"SS"'),"
EXECIO * DISKR CNTLREC(FINIS
EXIT
Assign this file to the appropriate ICETOOL control statement DD and it should work for you.
Warning: This example does not deal with adjustments that might be required to the COND parameters in the event of a rollover midnight.
Note: If you stored the above REXX procedure in a PDS as: "MY.REXX(FOO)", your pre-step JCL would look something like:
//RUNREXX EXEC PGM=IKJEFT01
//SYSEXEC DD DSN=MY.REXX,DISP=SHR
//SYSTSPRT DD SYSOUT=A
//SYSTSIN DD *
%FOO
1
/*
//
The '1' following %FOO is the DELTA number of hours referenced in the procedure.
If you DFSORT is fairly up-to-date, October 2010, DATE5 will have the equivalent of DATE4 but including microseconds, so like a DB2 "timestamp".
OPTION COPY
INREC OVERLAY=(1:DATE5)
gives
2013-04-08-19.29.41.261377
精彩评论