Date/time constants in JCL
You can use DATE, DATE=(abcd), DATENS=(abc), YDDD=(abc) and
YDDDNS=(ab) to generate CH/ZD constants for the current data (that is, today's
date) as follows:
- DATE creates a
constant in the form C'mm/dd/yy' which on March 15, 2005 would be
C'03/15/04'.
- DATE=(abcd) creates a
constant in the form C'adbdc' where a, b and c can be M for mm, D for dd,
Y for yy or 4 for yyyy, and d is the separator character. For example,
DATE=(DM4.) creates C'dd. mm.yyyy’ which on March 15, 2005 would be C'15.
03.2005’.
- DATENS=(abc) creates a
constant in the form C'abc' where a, b and c can be M for mm, D for dd, Y
for yy or 4 for yyyy. For example, DATE=(DMY) creates C'ddmmyy' which on
March 15, 2005 would be C'150304'.
- YDDD=(abc) creates a
constant in the form C'acb' where a and b can be D for ddd, Y for yy or 4
for yyyy, and c is the separator character. For example, YDDD=(4D-)
creates C'yyyy-ddd' which on March 15, 2005 would be C'2005-075'.
YDDDNS=(ab)
creates a constant in the form C'ab' where a and b can be D for ddd, Y for yy
or 4 for yyyy. For example, YDDD=(DY) creates C'dddyy' which on March 15, 2005
would be C'07504'.
You
can use TIME, TIME=(abc) or TIMENS=(ab) to generate CH/ZD constants for the
current time (that is, the time of the run) as follows:
- TIME creates a
constant in the form C'hh: mm: ss’ (24-hour time) which at 01:55:43 PM
would be C'135543'.
- TIME=(24c) creates a
constant in the form C'hhcmmcss' (24-hour time) where c is the separator
character. For example, TIME=(24.) creates C'hh. mm.ss’, which at 01:55:43
PM would be C'13. 55.43’.
- TIME=(12c) creates a
constant in the form C'hhcmmcss xx' (12-hour time) where c is the
separator character and xx is 'am' or' pm'. For example, TIME=(12.)
creates C'hh. Mm.ss xx' which at 01:55:43 PM would be C'01. 55.43 pm'.
- TIMENS=(24) creates a
constant in the form C'hhmmss' (24-hour time) which at 01:55:43 PM would
be C'135543'.
- TIMENS=(12) creates a
constant in the form C'hhmmss xx' (12-hour time) where xx is 'am' or' pm'
which at 01:55:43 PM would be C'015543 pm'.
You can also use DATEn and
DATEn(c) to generate CH/ZD constants for the current date (that is, today's
date) and TIMEn and TIMEn(c) to generate CH/ZD constants for the current time
(that is, the time of the run). The separator (c) can be any character except
blank. Here are tables that show the character/zoned decimal constant generated
for each DATEn and DATEn(c) operand along with an example using / for c where
relevant, and for each TIMEn and TIMEn(c) operand along with an example using:
for c where relevant.
Operand
|
Constant
|
Type
|
March 15, 2005 01:55:43 PM
|
DATE1
|
C'yyyymmdd'
|
CH, ZD
|
C'20050315'
|
DATE1(c)
|
C'yyyycmmcdd'
|
CH
|
C'2005/03/15'
|
DATE2
|
C'yyyymm'
|
CH, ZD
|
C'200503'
|
DATE2(c)
|
C'yyyycmm'
|
CH
|
C'2005/03'
|
DATE3
|
C'yyyyddd'
|
CH, ZD
|
C'2005075'
|
DATE3(c)
|
C'yyyycddd'
|
CH
|
C'2005/075'
|
DATE4
|
C'yyyy-mm-dd-hh.mm.ss'
|
CH
|
C'2005-03-15-13. 55.43’
|
Operand
|
Constant
|
Type
|
01:55:43 PM
|
TIME1
|
C'hhmmss'
|
CH, ZD
|
C'135543'
|
TIME1(c)
|
C'hhcmmcss'
|
CH
|
C'13: 55:43’
|
TIME2
|
C'hhmm'
|
CH, ZD
|
C'1355'
|
TIME2(c)
|
C'hhcmm'
|
CH
|
C'13: 55’
|
TIME3
|
C'hh'
|
CH, ZD
|
C'13'
|
If
you wanted to create two different timestamps at the start of each output
record as follows:
C'TS1 IS yyyy-mm-dd hh:mm:ss, TS2 IS yyyydddhhmm '
you
could use this OUTFIL statement:
OUTFIL OUTREC=(C'TS1 IS ', DATE1 (-), X, TIME1 (:),
C', TS2 IS ', DATE3, TIME2, X,
1,80)
Packed decimal date/time
constants: You can use DATEnP to generate PD constants for the current date
(that is, today's date). You can use TIMEnP to generate constants for the
current time (that is, the time of the run). Here are tables that show the
packed decimal constant generated for each DATEnP and TIMEnP operand along with
examples.
|
||||||||||||||||
|
||||||||||||||||
|
If
you wanted to place a P'hhmm' constant for the time of the DFSORT run in
positions 21-23 of your output records, and a P'yyyymm' constant for the date
of the DFSORT run in positions 55-58 of your output records, you could use the
following OUTREC statement:
OUTREC FIELDS=(5:16,10,21:TIME2P,
28:37,20,55:DATE2P, 65:1,8)
SAMPLE JCL:
//STEP1
EXEC PGM=ICETOOL,
//
COND=(0,NE)
//*
//TOOLMSG
DD SYSOUT=*
//*
//DFSMSG
DD SYSOUT=*
//*
//SORTIN
DD *
1
//SORT1
DD DSN=ACMSTMP.RADHA.TEST1,
// DISP=(OLD, CATLG, DELETE),
//
UNIT=SYSDA, SPACE=(CYL, (250,100), RLSE),
//
DCB=(RECFM=FB, LRECL=231,BLKSIZE=2310)
//SORT2
DD DSN=ACMSTMP.RADHA.TEST2,
//
DISP=(OLD, CATLG, DELETE),
//
UNIT=SYSDA, SPACE=(CYL,(250,100),RLSE),
//
DCB=(RECFM=FB, LRECL=231,BLKSIZE=2310)
//SORT3
DD DSN=ACMSTMP.RADHA.TEST3,
//
DISP=(OLD, CATLG, DELETE),
//
UNIT=SYSDA, SPACE=(CYL,(250,100),RLSE),
//
DCB=(RECFM=FB, LRECL=231,BLKSIZE=2310)
//SORT4
DD DSN=ACMSTMP.RADHA.TEST4,
//
DISP=(OLD, CATLG, DELETE),
//
UNIT=SYSDA, SPACE=(CYL,(250,100),RLSE),
//
DCB=(RECFM=FB, LRECL=231,BLKSIZE=2310)
//SORT5
DD DSN=ACMSTMP.RADHA.TEST5,
//
DISP=(OLD, CATLG, DELETE),
//
UNIT=SYSDA, SPACE=(CYL,(250,100),RLSE),
//
DCB=(RECFM=FB, LRECL=231,BLKSIZE=2310)
//SORT6
DD DSN=ACMSTMP.RADHA.TEST6,
//
DISP=(OLD, CATLG, DELETE),
//
UNIT=SYSDA, SPACE=(CYL, (250,100), RLSE),
//
DCB=(RECFM=FB, LRECL=231,BLKSIZE=2310)
//TOOLIN
DD * *** CONSTANT CONTROL CARDS
***
COPY FROM
(SORTIN) USING (CTL1)
//CTL1CNTL
DD * *** CONSTANT CONTROL CARDS
***
OUTFIL
FNAMES=SORT1,
OUTREC=(C'COST PRD MTH:’ C’,', DATE1 (-),
206X)
OUTFIL FNAMES=SORT2,
OUTREC=(C'COST PRD WK:', C’,', TIME1 (:),
208X)
OUTFIL
FNAMES=SORT3,
OUTREC=(C'TIME :', TIME=(12.), 206X)
OUTFIL
FNAMES=SORT4,
OUTREC=(C'DATE :', TIME1 (:), 209X)
OUTFIL
FNAMES=SORT5,
OUTREC=(C'DATE :',DATE=(DM4.), 207X)
OUTFIL
FNAMES=SORT6,
OUTREC=(C'DATE :',DATE1,TIME1,203X)
/*
//*
OUTPUT OF THE JCL:
BROWSE ACMSTMP.RADHA.TEST1 Line 00000000 Col 001 080
Command
===>
Scroll ===> CSR
********************************* Top of Data
**********************************
COST PRD MTH :,2006-01-03
******************************** Bottom of Data
********************************
BROWSE ACMSTMP.RADHA.TEST2
Data
Set - Browsed
Command
===>
Scroll ===> CSR
********************************* Top of Data
*********************************
COST PRD WK
:,00:22:38
******************************** Bottom of Data
*******************************
BROWSE ACMSTMP.RADHA.TEST3
Data
Set - Browsed
Command
===>
Scroll ===> CSR
********************************* Top of Data
**********************************
TIME
:12.22.38 am
******************************** Bottom of Data
********************************
BROWSE ACMSTMP.RADHA.TEST4 Data Set -
Browsed
Command
===>
Scroll ===> CSR
********************************* Top of Data
**********************************
DATE
:00:22:38
******************************** Bottom of Data
********************************
BROWSE ACMSTMP.RADHA.TEST5 Data Set -
Browsed
Command ===>
Scroll ===> CSR
********************************* Top of Data
**********************************
DATE
:03.01.2006
******************************** Bottom of Data
********************************
BROWSE ACMSTMP.RADHA.TEST6 Data Set -
Browsed
Command
===>
Scroll ===> CSR
********************************* Top of Data
**********************************
DATE
:20060103002238
******************************** Bottom of Data
********************************
presosQprob_me-1997 Katie Perry https://www.ajaya.org/profile/osytharehemahosytha/profile
ReplyDeletepuclutome