View previous topic :: View next topic
Author
Message
Senthilkumar k Warnings : 1 New User Joined: 07 May 2009Posts: 51 Location: Chennai
How can I subtract the one day from current date in TRAILER1. If I use DATE1-1 it is not working in TRAILER1. Please find my code below,
OUTFIL REMOVECC,NODETAIL,
TRAILER1=(DATE1-1,C',MD,',TOT=(1,1,ZD,TO=ZD,LENGTH=8)
I am able to get current using DATENS=(4MD). Can anyone help how to substract one day from current date.
Back to top
Skolusu Senior Member Joined: 07 Dec 2007Posts: 2205 Location: San Jose
Senthilkumar k,
You cannot use a relative date on trailer/header parms. You can use the relative date on INREC/OUTREC. use the following DFSORT JCL.
Code:
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
1
2
3
4
5
6
7
8
9
0
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INREC BUILD=(1,1,DATE1-1,12X)
OUTFIL REMOVECC,NODETAIL,
TRAILER1=(2,8,C',MD,',TOT=(1,1,ZD,TO=ZD,LENGTH=8))
/*
This will create a 21 byte FB file like this
Code:
20090827,MD,00000045
If you want a 80 byte output file then change the inrec to the following
Code:
INREC BUILD=(1,1,DATE1-1,80:X)
Back to top
vasanthz Global Moderator Joined: 28 Aug 2007Posts: 1742 Location: Tirupur, India
Hi,
I have the same requirement but I am unable to use the BUILD statement as suggested above to get the relative date, since a BUILD is already used in the below code,
Code:
OPTION COPY
INCLUDE COND=(69,3,CH,EQ,C'SLA',AND,
124,2,SS,EQ,C'01,02,03,04,05,06,11,14,99',AND,
1,8,CH,EQ,DATE1-1)
INREC IFOUTLEN=100,
IFTHEN=(WHEN=(124,2,CH,EQ,C'01'),BUILD=(DATE1-1,9:C'100000000')),
IFTHEN=(WHEN=(124,2,CH,EQ,C'02'),BUILD=(DATE1-1,9:C'010000000')),
IFTHEN=(WHEN=(124,2,CH,EQ,C'03'),BUILD=(DATE1-1,9:C'001000000')),
IFTHEN=(WHEN=(124,2,CH,EQ,C'04'),BUILD=(DATE1-1,9:C'000100000')),
IFTHEN=(WHEN=(124,2,CH,EQ,C'05'),BUILD=(DATE1-1,9:C'000010000')),
IFTHEN=(WHEN=(124,2,CH,EQ,C'06'),BUILD=(DATE1-1,9:C'000001000')),
IFTHEN=(WHEN=(124,2,CH,EQ,C'11'),BUILD=(DATE1-1,9:C'000000100')),
IFTHEN=(WHEN=(124,2,CH,EQ,C'14'),BUILD=(DATE1-1,9:C'000000010')),
IFTHEN=(WHEN=(124,2,CH,EQ,C'99'),BUILD=(DATE1-1,9:C'000000001'))
OUTFIL REMOVECC,NODETAIL,
TRAILER1=(MIN=(1,8,ZD),C',MD,',TOT=(9,1,ZD,TO=ZD,LENGTH=8),
C',',TOT=(10,1,ZD,TO=ZD,LENGTH=8),
C',',TOT=(11,1,ZD,TO=ZD,LENGTH=8),
C',',TOT=(12,1,ZD,TO=ZD,LENGTH=8),
C',',TOT=(13,1,ZD,TO=ZD,LENGTH=8),
C',',TOT=(14,1,ZD,TO=ZD,LENGTH=8),
C',',TOT=(15,1,ZD,TO=ZD,LENGTH=8),
C',',TOT=(16,1,ZD,TO=ZD,LENGTH=8),
C',',TOT=(17,1,ZD,TO=ZD,LENGTH=8))
/*
The input file has date in YYYYMMDD format from 1-8 positions.
The aim is to count the number of occurences of individual records at
124,2,CH and add previous day's date and produce a CSV report like below,
Code:
20090906 ,MD,00000061,00000000,00000137,00000013,00000000,00000000
,00000000,00002472,00000008
The code works ok, but when there are no records that meet the include condition criteria, the report is something like,
Code:
0,MD,00000000,00000000,00000000,00000000,00000000,00000000
,00000000,00000000,00000000
The need is to have the relative date intact even if the records that meet the include condition are 0.
Could you please suggest a fix for this or an another solution.
Pls let me know if you need more information.
Thanks & Regards,
Back to top
Please enable JavaScript!