header date dd/mm/yy to yyyymmdd



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

header date dd/mm/yy to yyyymmdd

Postby shyamsaravan » Wed May 12, 2010 12:10 pm

i have a GDG input file,it is created daily except Saturday and sunday,,It has a header record saying that date format is dd/mm/yy.(Pos : 10-17)LRECL is 88 FB
My requirement is to fetch the previous date record with compare of header date.FORMAT IS YYYYMMDD(pos:8-15)
I/p file is :
000001 00HEADER 11/05/10
.
162200 0311RON2010051000009628470678300000000000000
162201 0311EUR2010051000013022594400100000000000000
.
168852 99TRAILER 000146 000010 168694 000000 168850

My o/p should be

000001 00HEADER 11/05/10
000002 0311RON2010051000009628470678300000000000000
000003 0311EUR2010051000013022594400100000000000000
000004 99TRAILER 0000002 0000001 000001 0000004---------TOTAL NO OF RECORDS
|-------NO OF RECORDS

If the header date day is Monday means..input file Like

000001 00HEADER 10/05/10

112560 0311EUR2010050700012746637522400000000000000
022619 0311RON2010050700003044050000000000000000000
.
85168852 99TRAILER 000146 000010 168694 000000
o/p should be
000001 00HEADER 10/05/10
000002 0311EUR2010050700012746637522400000000000000
000003 0311RON2010050700003044050000000000000000000
000004 99TRAILER 0000002 0000001 000001 0000004


see the date:20100507 but header date is 10/05/10(bcoz of 08 and 09 is saturday and sunday)

Can you help me

Thanks
Shyamsaravan
shyamsaravan
 
Posts: 40
Joined: Tue May 11, 2010 7:56 pm
Has thanked: 0 time
Been thanked: 0 time

Re: header date dd/mm/yy to yyyymmdd

Postby shyamsaravan » Wed May 12, 2010 12:13 pm

For the above requirement is to do with JCL SORT
shyamsaravan
 
Posts: 40
Joined: Tue May 11, 2010 7:56 pm
Has thanked: 0 time
Been thanked: 0 time

Re: header date dd/mm/yy to yyyymmdd

Postby shyamsaravan » Wed May 12, 2010 8:25 pm

It will run on daily by scheduler except Saturday and sunday
shyamsaravan
 
Posts: 40
Joined: Tue May 11, 2010 7:56 pm
Has thanked: 0 time
Been thanked: 0 time

Re: header date dd/mm/yy to yyyymmdd

Postby skolusu » Thu May 13, 2010 12:51 am

shyamsaravan,

The following DFSORT JCL will give you the desired results.
//STEP0100 EXEC PGM=SORT   
//SYSOUT   DD SYSOUT=*     
//SORTIN   DD DSN=your input fb 88 byte file,DISP=SHR
//SORTOUT  DD SYSOUT=*                                                 
//SYSIN    DD *                                                         
  SORT FIELDS=COPY                                                     
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(89:C'20')),                         
  IFTHEN=(WHEN=GROUP,BEGIN=(1,2,CH,EQ,C'00'),PUSH=(91:16,2,13,2,10,2)),
  IFTHEN=(WHEN=(8,10,CH,LE,89,8,CH),                                   
  OVERLAY=(97:SEQNUM,6,ZD))                                             
  OUTFIL INCLUDE=(97,1,CH,GT,C' '),IFOUTLEN=88,                         
  IFTHEN=(WHEN=(1,2,ZD,EQ,99),                                         
  BUILD=(1,10,11:C'0000002 0000001 000001 ',97,6))                     
//*
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
skolusu
 
Posts: 586
Joined: Wed Apr 02, 2008 10:38 pm
Has thanked: 0 time
Been thanked: 39 times

Re: header date dd/mm/yy to yyyymmdd

Postby shyamsaravan » Thu May 13, 2010 12:35 pm

Thanks Skolusu
Thank you for the quick reply,,but the above code is not fulfil my requirement,,It is just copied all input records to the o/p GDG file,the only change reflected is'99TRailer 0000002 0000001 000001' It is also not...ok,,I explain in detail

I need to fetch the only those records from the current version of GDG input file..The i/p file created every day except Sat and SUN,So the header date and compare field date will vary,,I am giving the input file created on 11th May 2010

00HEADER 11/05/10
0311RON2010051000009628470678300000000000000 --COMPARE FIELD IS '0311RON20100510'--Pos 1-15(date pos 8-15)
0311EUR2010051000013022594400100000000000000 --COMPARE FIELD IS '0311EUR20100510'
0310EUR2010051000012686000000000000000000000 --COMPARE FIELD IS '0310EUR20100510'
0310RON2010051000003039290848100000000000000 --COMPARE FIELD IS '0310RON20100510'
99TRAILER

Note: in Compare field 0311RON20100510---20100510 is the previous date of HEADER DATE
The trailer has count of o/p records and 1 header record,1 trailer record and total no of records(incl of header and trailer)
for this case no of records 000004,header record 000001,trailer record 000001 total records 000006
99TRAILER 000002 000001 000001 000006---IT IS THE FORMAT

One more thing,,If we used for Monday created GDG input file means it doesnt have previous day record..for this case we go for friday date record(that is 2 day in advance)..for example SEE THE FILE Header date is 10th may2010(Monday),but it has friday date record(20100507) at the position 8-15
I/p file

000001 00HEADER 10/05/10
.
106553 0310EUR2010050700012746000000000000000000000
112560 0311EUR2010050700012746637522400000000000000
021977 0310RON2010050700003043457497600000000000000
022619 0311RON2010050700003044050000000000000000000
'
168852 99TRAILER 000146 000010 168694 000000 168850

my o/p should be

000001 00HEADER 10/05/10
000002 0311EUR2010050700012746637522400000000000000
000003 0311RON2010050700003044050000000000000000000
000004 0310RON2010050700003043457497600000000000000
000005 0310EUR2010050700012746000000000000000000000
000006 99TRAILER 0000004 0000001 000001 0000006

Please let me know,if anything more
I am eagerly waiting for the solution

Kndly;
Shaymsaravan
shyamsaravan
 
Posts: 40
Joined: Tue May 11, 2010 7:56 pm
Has thanked: 0 time
Been thanked: 0 time

Re: header date dd/mm/yy to yyyymmdd

Postby skolusu » Thu May 13, 2010 11:53 pm

If we used for Monday created GDG input file means it doesnt have previous day record..for this case we go for friday date record(that is 2 day in advance)..for example SEE THE FILE Header date is 10th may2010(Monday),but it has friday date record(20100507) at the position 8-15 Please let me know,if anything more I am eagerly waiting for the solution


Shyamsaravan,

You try to complicate a simple request. From what I understood till now is that

1. Header record will have the current day date (can be monday thru friday)
2. The detail records will have the prior day records.

If that is true then use the following DFSORT JCL.

//STEP0100 EXEC PGM=SORT   
//SYSOUT   DD SYSOUT=* 
//SYMNAMES DD * 
WKDAY,S'&LWDAY'     
//SORTIN   DD DSN=your input fb 88 byte file,DISP=SHR
//SORTOUT  DD SYSOUT=*
//SYSIN    DD *                                                 
  SORT FIELDS=COPY                                               
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(89:WKDAY)),                   
  IFTHEN=(WHEN=(89,3,CH,EQ,C'SUN'),OVERLAY=(92:DATE1-2)),       
  IFTHEN=(WHEN=(89,3,CH,EQ,C'MON'),OVERLAY=(92:DATE1-3)),       
  IFTHEN=(WHEN=NONE,OVERLAY=(92:DATE1-1))                       
                                                                 
  OUTREC IFTHEN=(WHEN=(1,2,SS,EQ,C'00,99',OR,8,8,CH,EQ,92,8,CH),
  OVERLAY=(100:SEQNUM,6,ZD),HIT=NEXT),                           
  IFTHEN=(WHEN=(1,2,ZD,EQ,99),                                   
  OVERLAY=(11:C'0000002 0000001 000001 ',100,6,48X))             
                                                                 
  OUTFIL BUILD=(1,88),INCLUDE=(100,1,CH,GT,C' ')                 
//*


PS: If your header date has anything other than current date and if you want to do the comparison, then you need to write a program to perform the date arithmetic on any given date as sort products do not have capability of performing date arithmetic on any date.
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
skolusu
 
Posts: 586
Joined: Wed Apr 02, 2008 10:38 pm
Has thanked: 0 time
Been thanked: 39 times

Re: header date dd/mm/yy to yyyymmdd

Postby shyamsaravan » Fri May 14, 2010 3:56 pm

Thanks again;

1.Header date will not be the current date,but the new JCl will not run the current header date,,It may run any date,,
2.You are right..The detail record will have the Prior day record .(If the priod day record is not available for the time of comparision,we
should fetch for two day prior record -For Ex..Header date is 10/05/10,this file doent have a prior days records,bcoz prior days are SUNDAY
and SATURDAY,so we have to fetch FRIDAY(07/05/10) detail record.
3.Trailer record should have a no.of detail record,No.of Header record,No.of Trailer record and Total no.of records
like 99TRAILER 0004 0001 0001 0006--This is for the above o/p file counts,,,,4 detail record,1 head rec,1Trail rec,6--total rec

4.Comparision key is like these only 0310EUR+priordate,0310RON+priordate,0311EUR+priordate and 0311RON+priordate

For Example Header date is 11/05/10 is the comparision keys will be the

0310EUR20100510
0310RON20100510
0311EUR20100510
0311RON20100510
for eg Header date is 10/05/10 means ,the comparision keys will be the

0310EUR20100507
0310RON20100507
0311EUR20100507
0311RON20100507--two day prior(bcoz 20100509 is SUNDAY,20100508 is Saturday)


So search the prior day with that comparisonkey,if the record idexist move to Output GDG,If not search the two day prior with comparioson key,if exist move to O/P .Please dont mind in current date

Please let me know,if any

Kindly;
Shyamsaravan
shyamsaravan
 
Posts: 40
Joined: Tue May 11, 2010 7:56 pm
Has thanked: 0 time
Been thanked: 0 time

Re: header date dd/mm/yy to yyyymmdd

Postby shyamsaravan » Fri May 14, 2010 8:08 pm

mY input GDG

00HEADER 10/05/10
.
.
0304HRY2010030100092746000000000000000000000
0310FRK2001120500082746000000000000000000000
0311EUR2010050700012746637522400000000000000
0310CDD2010110700003043457497600000000000000
0311RON2010050700003044050000000000000000000
0310EUR2010050700012746000000000000000000000
0307EUR2010050700016746000000000000000000000
0310RON2010050700012746000000000000000000000
.
.
99TRAILER 000146 000010 168694 000000 168850

my o/p should be (Search key is 0311EUR,0311RON,0310RON,0310EUR,,+ PRIOR DAY DATE(FOR THIS EX: 2 DAYS IN ADVANCE))

000001 00HEADER 10/05/10
000002 0311EUR2010050700012746637522400000000000000
000003 0311RON2010050700003044050000000000000000000
000004 0310RON2010050700003043457497600000000000000
000005 0310EUR2010050700012746000000000000000000000
000006 99TRAILER 0000004 0000001 000001 0000006
shyamsaravan
 
Posts: 40
Joined: Tue May 11, 2010 7:56 pm
Has thanked: 0 time
Been thanked: 0 time

Re: header date dd/mm/yy to yyyymmdd

Postby skolusu » Fri May 14, 2010 8:34 pm

Shyamsaravan,

Did you read this in my last post?

skolusu wrote:PS: If your header date has anything other than current date and if you want to do the comparison, then you need to write a program to perform the date arithmetic on any given date as sort products do not have capability of performing date arithmetic on any date.
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
skolusu
 
Posts: 586
Joined: Wed Apr 02, 2008 10:38 pm
Has thanked: 0 time
Been thanked: 39 times

Re: header date dd/mm/yy to yyyymmdd

Postby shyamsaravan » Mon May 17, 2010 11:19 am

Yes Kolusu;

I read the the lat post...Just convert(Reformat) the header date format(dd/mm/yy) to Record date format(YYYYMMDD) and check the prior day of header date Record in detail records with additional searck key of '0310EUR','310RON','0311EUR','0311RON', if is available,do write that selected records to output record,if it is not available means check two days prior day record in detail record and write to o/p file.
Trailer record should have a count of Detail record,count of Header record,cont of Trailer record,and count total records(incl of Head,TRial,and Detail record cont)..

If the header date is 14/05/10 means
|------date format is YYYYMMDD
The search key are, 0310EUR20100513,,0310RON20100513,,0311EUR20100513,,0311RON20100513

If the header date is 17/05/10 means

The search key are, 0310EUR20100514,,0310RON20100514,,0311EUR20100514,,0311RON20100514

Please help me;
shyamsaravan
 
Posts: 40
Joined: Tue May 11, 2010 7:56 pm
Has thanked: 0 time
Been thanked: 0 time

Next

Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post