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

Date format in trailer1


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Senthilkumar k
Warnings : 1

New User


Joined: 07 May 2009
Posts: 51
Location: Chennai

PostPosted: Fri Aug 28, 2009 4:34 pm
Reply with quote

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

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri Aug 28, 2009 9:57 pm
Reply with quote

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

Global Moderator


Joined: 28 Aug 2007
Posts: 1742
Location: Tirupur, India

PostPosted: Tue Sep 08, 2009 12:55 am
Reply with quote

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
sterb050.gif

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
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 Populate last day of the Month in MMD... SYNCSORT 2
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Need to convert date format DFSORT/ICETOOL 20
No new posts Need help to append a date&tsp at... DFSORT/ICETOOL 9
Search our Forums:

Back to Top