Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Sort Bank Holiday Dates using DFSORT

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
evanswillo

New User


Joined: 28 Jun 2007
Posts: 23
Location: Bmth England

PostPosted: Tue Aug 07, 2007 2:33 pm    Post subject: Sort Bank Holiday Dates using DFSORT
Reply with quote

The dataset below contains the bank holidays for the currencies CNY INR IDR and THB, I need to sort through the dataset and find those dates when all four currencies have a Bank Holiday.

I have written this routine based on include statements and trailer counts

Code:
 INCLUDE COND=(2,3,CH,EQ,C'CNY',OR,             
              2,3,CH,EQ,C'INR',OR,             
              2,3,CH,EQ,C'IDR',OR,             
              2,3,CH,EQ,C'THB')               
 SORT FIELDS=(10,5,CH,A)                       
 OUTFIL REMOVECC,NODETAIL,                     
 SECTIONS=(10,5,                               
 TRAILER3=(10,5,15:'TOTAL ',COUNT=(LENGTH=3)))


Code:
 INCLUDE COND=(22,1,CH,EQ,C'4') 
 SORT FIELDS=(1,5,CH,A)       


The answer is 01 01 is the only date when all four countries are off.

Can anyone think of something else. Is it possible to build a SUM control statement to extract records when all four match.

Code:
CNY Mon 01 01 New Year's Day               
CNY Tue 01 02 BANK HOLIDAY                 
CNY Wed 01 03 BANK HOLIDAY                 
CNY Mon 02 19 Chinese New Year Observed     
CNY Tue 02 20 Second Day of Chinese New Year
CNY Thu 02 22 Chinese New Year Holiday Perio
CNY Fri 02 23 Chinese New Year Holiday Perio
CNY Tue 05 01 Labour Day                   
CNY Wed 05 02 Labour Day                   
CNY Fri 05 04 Labour Day                   
CNY Mon 05 07 Labour Day                   
CNY Mon 10 01 National Day                 
CNY Tue 10 02 National Day                 
CNY Wed 10 03 National Day                 
CNY Thu 10 04 National Day                 
CNY Fri 10 05 National Day                 

INR Mon 01 01 BANK HOLIDAY   
INR Fri 01 26 Republic Day   
INR Tue 01 30 BANK HOLIDAY   
INR Fri 02 16 BANK HOLIDAY   
INR Mon 03 19 BANK HOLIDAY   
INR Tue 03 27 BANK HOLIDAY   
INR Fri 04 06 Good Friday     
INR Tue 05 01 May Day         
INR Wed 05 02 Buddha Purnima 
INR Wed 08 15 Independence Day
INR Mon 08 20 BANK HOLIDAY   
INR Tue 10 02 Gandhi Jayanti 
INR Fri 11 09 Deepavali       
INR Tue 12 25 Christmas Day   

IDR Mon 01 01 NEW YEARS DAY   
IDR Mon 03 19 BANK HOLIDAY     
IDR Fri 04 06 GOOD FRIDAY     
IDR Thu 05 17 ASCENSION DAY   
IDR Fri 06 01 BANK HOLIDAY     
IDR Fri 08 17 INDEPENDENCE DAY
IDR Fri 10 12 BANK HOLIDAY     
IDR Thu 12 20 IDUL ADHA       
IDR Tue 12 25 CHRISTMAS DAY   

THB Mon 01 01 New Year's Day               
THB Tue 01 02 New Year's Holiday           
THB Mon 03 05 Makha Bucha Day Observed     
THB Fri 04 06 Chakri Day                   
THB Fri 04 13 Songkran Festival Day         
THB Mon 04 16 Songkran Festival Day         
THB Tue 05 01 Labour Day                   
THB Mon 05 07 Coronation Day Observed       
THB Thu 05 31 BANK HOLIDAY                 
THB Mon 07 30 BANK HOLIDAY                 
THB Mon 08 13 Queen's Birthday Observed     
THB Tue 10 23 King Chulalongkorn Memorial Da
THB Wed 12 05 King's Birthday               
THB Mon 12 10 Constitution Day             
THB Mon 12 31 New Year's Eve
Back to top
View user's profile Send private message

evanswillo

New User


Joined: 28 Jun 2007
Posts: 23
Location: Bmth England

PostPosted: Tue Aug 07, 2007 3:21 pm    Post subject: Sort Bank Holiday Dates
Reply with quote

Ok this is what I've come up with today

Code:
//TOOLIN DD *                                 
  SORT FROM(IN) TO(OUT) USING(CTL1)           
  SELECT FROM(OUT) TO(FIN) ON(10,5,CH) EQUAL(4)
//CTL1CNTL DD *                               
  SORT FIELDS=(10,5,CH,A)                     
  INCLUDE COND=(2,3,CH,EQ,C'CNY',OR,           
                2,3,CH,EQ,C'INR',OR,           
                2,3,CH,EQ,C'IDR',OR,           
                2,3,CH,EQ,C'THB')
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1439
Location: Bangalore,India

PostPosted: Tue Aug 07, 2007 3:22 pm    Post subject:
Reply with quote

evanswillo,

Quote:
Can anyone think of something else. Is it possible to build a SUM control statement to extract records when all four match.


What do you want to SUM if all the four currencies match?
Back to top
View user's profile Send private message
saiprasadh

Active User


Joined: 20 Sep 2006
Posts: 154
Location: US

PostPosted: Tue Aug 07, 2007 4:55 pm    Post subject:
Reply with quote

Hi Evanswillo,

I used the below sort card , Which gave the expected output for me.

Code:

  SORT FIELDS=(10,5,CH,A)                                           
  INREC FIELDS=(1:1,80,81:C'1')                                     
  SUM FIELDS=(81,1),FORMAT=ZD                                       
  OUTFIL FNAMES=SORTOUT,                                             
    NODETAIL,REMOVECC,                                                 
    INCLUDE=(81,1,CH,EQ,C'4'),                                       
    TRAILER1=(1:'HOLIDAY FOR FOUR BANK :',24:COUNT=(M10,LENGTH=03)) 


Output

Code:
HOLIDAY FOR FOUR BANK :  1


Correct me if i am wrong

Thanks
Sai
Back to top
View user's profile Send private message
evanswillo

New User


Joined: 28 Jun 2007
Posts: 23
Location: Bmth England

PostPosted: Tue Aug 07, 2007 5:40 pm    Post subject: Sort Bank Holiday Dates
Reply with quote

I need to know the date when all four currencies are off.
Back to top
View user's profile Send private message
saiprasadh

Active User


Joined: 20 Sep 2006
Posts: 154
Location: US

PostPosted: Tue Aug 07, 2007 5:49 pm    Post subject:
Reply with quote

Hi,
Use this Sort Card,

Code:

  SORT FIELDS=(10,5,CH,A)     
  OPTION ZDPRINT                                   
  INREC FIELDS=(1:1,80,81:C'1')                                   
  SUM FIELDS=(81,1),FORMAT=ZD                                     
  OUTFIL FNAMES=SORTOUT,                                           
     NODETAIL,REMOVECC,                                               
     INCLUDE=(81,1,CH,EQ,C'4'),                                     
     TRAILER1=(1:'HOLIDAY FOR FOUR BANK :',24:COUNT=(M10,LENGTH=03),
            27:' MONTH :',35:09,2,37:' DAY :',43:12,2,36X)   


Thanks
Sai
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Tue Aug 07, 2007 9:30 pm    Post subject:
Reply with quote

evanswillo,

You were on the right track. Here's a DFSORT/ICETOOL job that will do what you asked for:

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN DD DSN=...  input file
//OUT DD SYSOUT=*
//TOOLIN   DD    *
SELECT FROM(IN) TO(OUT) ON(10,5,CH) EQUAL(4) USING(CTL1)
/*
//CTL1CNTL DD *
  INCLUDE COND=(2,3,CH,EQ,C'CNY',OR,
                2,3,CH,EQ,C'INR',OR,
                2,3,CH,EQ,C'IDR',OR,
                2,3,CH,EQ,C'THB')
  OUTFIL FNAMES=OUT,REMOVECC,NODETAIL,
    HEADER2=(2:'Dates when all four currencies have a holiday'),
    SECTIONS=(10,5,
      TRAILER3=(2:10,5))
/*
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Tue Aug 07, 2007 9:38 pm    Post subject:
Reply with quote

Sai,

I think you want 10,2 instead of 9,2 and 13,2 instead of 12,2. But your solution will only show the last date if there is more than one date. For example, if the target dates were 01 01 and 12 02, your solution would show:

Code:

HOLIDAY FOR FOUR BANK :  2 MONTH :12 DAY :02 


whereas my solution would show:

Code:

 Dates when all four currencies have a holiday   
 01 01                                           
 12 02                                           
Back to top
View user's profile Send private message
saiprasadh

Active User


Joined: 20 Sep 2006
Posts: 154
Location: US

PostPosted: Wed Aug 08, 2007 9:28 am    Post subject:
Reply with quote

Hi Frank,
I Copied the input what evanswillo gave without leading space so the month and day is in the position 9 & 12.I think the below sort card will generate all the days when four banks are off.

Code:

  SORT FIELDS=(09,5,CH,A)                                         
  INREC FIELDS=(1:1,80,81:C'1')
  OPTION ZDPRINT                                   
  SUM FIELDS=(81,1),FORMAT=ZD                                     
  OUTFIL FNAMES=SORTOUT,                                           
   NODETAIL,REMOVECC,                                               
   INCLUDE=(81,1,CH,EQ,C'4'),                                     
   TRAILER1=(1:'TOTAL NO OF HOLIDAYS :',23:COUNT=(M10,LENGTH=3)),
  SECTIONS=(1,10,                                               
  TRAILER3=(1:'MONTH :',8:9,2,10:' DAY :',16:12,2))   


Output

Code:
MONTH :01 DAY :01             
MONTH :01 DAY :02             
TOTAL NO OF HOLIDAYS :  2   


Thanks
Sai
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Wed Aug 08, 2007 7:34 pm    Post subject:
Reply with quote

Sai,

Since you have 81,1,CH,EQ,C'4', I added OPTION ZDPRINT to your control statements. Although ZDPRINT=YES is DFSORT's supplied installation default, sites can change it to ZDPRINT=NO, so it's best to specify ZDPRINT. Alternatively, you could use 81,1,ZD,EQ,4 and then you wouldn't need ZDPRINT.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Innovations in Your Mainframe Sort Arun Raj PC Guides & IT News 4 Wed Mar 15, 2017 10:38 pm
No new posts SORT VSAM file with each field one by... maxsubrat DFSORT/ICETOOL 6 Tue Mar 14, 2017 1:07 pm
No new posts SORT requirement sjiraga COBOL Programming 6 Thu Mar 09, 2017 9:11 pm
No new posts SORT to append Month and YEAR in MMYY... tisamf DFSORT/ICETOOL 1 Wed Mar 08, 2017 4:46 pm
No new posts DFSORT MUL FIELDS tspr52 DFSORT/ICETOOL 16 Fri Mar 03, 2017 11:53 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us